Monday, 30 October 2017

convert - How can I compute raster pixel width and height given raster bounds, row count, and column count?


Restated, how do I convert arc degrees to meters? For example, I have an elevation data raster that has the following metadata:


WEST LONGITUDE=64.97798789° E
NORTH LATITUDE=33.02003415° N
EAST LONGITUDE=66.03338707° E
SOUTH LATITUDE=31.98030163° N

PROJ_DESC=Geographic (Latitude/Longitude) / WGS84 / arc degrees
PROJ_DATUM=WGS84
PROJ_UNITS=arc degrees
EPSG_CODE=4326
NUM COLUMNS=9001
NUM ROWS=9001
PIXEL WIDTH=0.0001111 arc degrees
PIXEL HEIGHT=0.0001111 arc degrees

I can compute by hand the pixel width in arc degrees as follows:



(EAST LONGITUDE - WEST LONGITUDE) / NUM COLUMNS

Similarly, I can compute by hand the pixel height in arc degrees as follows:


(NORTH LATITUDE - SOUTH LATITUDE) / NUM ROWS

My question is how to compute the pixel width and height in meters.



Answer



You can use the quick-and-dirty (yet fairly accurate) conversion described here. As an example,





  • Pixel height will be essentially constant (it is constant on a sphere and approximately so, to a fraction of a percent variation, on the WGS84 ellipsoid). 0.00011111 degrees = 1/9000 degrees = (approximately) 111111/9000 meters = 12.35 meters.




  • Pixel width will be the cosine of the latitude times the height. At the top of your grid, cos(33.02003415) = 0.8385, whence the width will be 10.35 meters. At the bottom of your grid, cos(31.98030163) = 0.8482 for a width of 10.47 meters. The variation is so small you can safely linearly interpolate between these to estimate widths at other locations in the grid.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...