1

I have a huge raster file and want to increment all the values within a relatively small shapefile by 1 in Python. Speed is of critical importance, as I have to do this many times.

I have been looking at: http://geospatialpython.com/2011/02/clip-raster-using-shapefile.html

However, changing the code to my purposes, it seems elaborate to clip the raster, then set all values to one and update the raster with it's own clip.

1
  • Please include a code snippet that illustrates what you have tried and where you are stuck.
    – PolyGeo
    Commented Jun 10, 2016 at 10:23

1 Answer 1

0

For updating with a shapefile, you need to convert the shapefile to raster then use some map algebra in order to do the computation. The conversion from shapefile to raster is done in any case, even if it is sometimes "hidden" by some tool. for speeding up the process with ArcGIS, you could divide your huge image in small tiles and process only the tiles that intersect the extent of you small shapefile. Keeping the tiles in a mosaic (or a vrt), its like working the very large image.

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