I have a digital terrain model and a digital surface model which contain data in an Esri grid. The data in this files looks like this

ncols 1251
nrows 1001
xllcorner 742499.5
yllcorner 328999.5
cellsize 1.0
nodata_value 9999.00
-9999 -9999 5 2
-9999 20 100 36
3 8 35 10
32 42 50 6
88 75 27 9
13 5 1 -9999

See also: https://en.wikipedia.org/wiki/Esri_grid

What I would like to do now is to calculate the height of positions through substractions of the values from the DTM and DSM.

I imagine this quite easy, as long as I can convert the xllcorner value to coordinates like 15,34° N.

What I want to do finally is put in coordinates a user selects on map and return the height of objects at this point. I want to solve this with PHP, so I need a formular to convert the xllcorner and yllcorner values.

I'm new to this, so maybe I image this much easier than it is, but I'm thankful for hints.

  • 2
    You need to ask your data supplier what projection the raster is in. – Ian Turton Jan 5 at 19:37
  • @IanTurton and as soon as I know that, how can I proceed? – obs Jan 5 at 20:36
  • 1
    then you can use gdal_translate – Ian Turton Jan 6 at 10:56
  • After doing some research, using gdal seems a bit overkill for my task. All I want to do is translate the xllcorner value to Lat/Long values. Isn't there a way to calculate this on my own? – obs Jan 9 at 20:14
  • No, the cellsize and possibly the orientation of the grid will change too. This can lead to the need to recalculate all the cell values. gdal is a standard tool with hardly any overhead – Ian Turton Jan 10 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.