systemapic / pile

PostGIS tile server
0 stars 2 forks source link

Optimize raster vectorization #42

Open knutole opened 8 years ago

knutole commented 8 years ago

Currently the vectorize raster function (ST_DumpAsPolygon) is taking around 20-30 seconds to process a 1.6MB raster.

It's all being done one 1 CPU. Possibly there's a way to cut this job into pieces and do them parallel, utilizing 6-8 CPU's.

strk commented 8 years ago

We should be already cutting the raster into pieces of 128x128 pixels at import time. The scandinavia snow raster cuts in 96 rows here, at full resolution. It takes ~28 seconds on my system to dump each of those 96 rasters into 517,825 polygons and write them into a new table using a (ST_DumpAsPolygons(rast)).* query. The time halves removing the ().* syntax, as it is known to run the internal function once for each output field (2 fields in our case). Is that enough of an improvement ? Where's the code doing the vectorialization ?

strk commented 8 years ago

I found two places, both using the ().* syntax: src/pile.js:420 src/vectorize_raster.sh