1

I want to make from .shp a raster by the following code:

    gdal.Grid(raster,
              shapefile,
              algorithm='invdist:power=15',
              format='GTiff',
              width=976,
              height=1966)

The size of the raster may be even more, depending on the input .shp file. Overall, it took about 8 hours only to achieve 30% of the rasterization! It's too slow in my case! Can anyone suggest another tool or optimization to the existing one without touching resolution and input point number?

P.S. The number of features is equal to 3 085 319 P.P.S. The best solution, for now, is the answer from here: Interpolate nodata in rasters using Python

2
  • The default for Weighting power is 2. Have you tried if process is faster with that?
    – user30184
    Jul 16, 2021 at 13:48
  • The result that I want to achieve is appropriate when the power is equal to 15. But I checked it without size stating. Now I launched stating both - size and power = 2 and yes, it does calculate faster. Let me wait for the final result. Jul 16, 2021 at 13:53

1 Answer 1

1

For a reference timing from my test with gdal_grid executable (GDAL 3.3) on Windows. I took the Liechtenstein OSM extract from Geofebrik.de and converted data into SpatiaLite database. Layer "points" had 15286 features

My command

gdal_grid -a invdist:power=15 -of GTiff -outsize 976 1966 -l points liechtenstein.sqlite points.tif

Processing took 6 minutes and 10 seconds. With power=2 processing was much faster and took only about 20 seconds with my test data.

5
  • my feature count is 3 085 319 Jul 16, 2021 at 14:09
  • Maybe gdal_grid does not handle so big dataset fast enough. Iterate with increasing number of points and consider other tools. Perhaps some point cloud utilities would be better for you.
    – user30184
    Jul 16, 2021 at 14:12
  • Yeah, but I'm asking which alternative can be :) I need it no use in pair with python Jul 16, 2021 at 14:43
  • * I need it TO use in pair with python. Typo, sorry. Jul 16, 2021 at 14:53
  • 1
    Perhaps you should edit the title of your question to describe your problem better so that interpolation specialists would find it. GRASS at least can do IDW grass.osgeo.org/grass79/manuals/v.surf.idw.html.
    – user30184
    Jul 16, 2021 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.