I have a raster file that is projected not detailed enough. Every pixel in the raster should be replaced, just a bit. With ArcGIS I calculated the offset per pixel. I couldn't find a way to do this offsetting in ArcGIS, so I switched to python. I found out that I can get the current envelope with ogr with :
env = geom.GetEnvelope()
print "minX: %d, minY: %d, maxX: %d, maxY: %d" %(env[0],env[2],env[1],env[3])
And now I have to change these to the (already calculated) new origin.
Here is some sample code:
## From gdal info page
wkt = "LINESTRING (1181866.263593049 615654.4222507705, 1205917.1207499576 623979.7189589312, 1227192.8790041457 643405.4112779726, 1224880.2965852122 665143.6860159477)"
geom = ogr.CreateGeometryFromWkt(wkt)
env = geom.GetEnvelope()
I have to say that I don't entirely understand the envelope function. Is this a function that returns the minX etc from the projection? Or does it just calculates this all from the geometry?
Does anybody now how to change this or knows another workaround?
Answer
If all you need to do is move the origin of your raster slightly, i.e shift the pixels, you can use the Shift tool in ArcGIS
Summary
Moves (slides) the raster to a new geographic location, based on x and y shift values. This tool is helpful if your raster dataset needs to be shifted to align with another data file.
No comments:
Post a Comment