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.

closed as off-topic by PolyGeo Jun 10 '16 at 10:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please include a code snippet that illustrates what you have tried and where you are stuck. – PolyGeo Jun 10 '16 at 10:23
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.