dem-net/DEM.Net

How to get point elevation

Closed this issue · 8 comments

I have some DEM data and I am able to follow the line elevation example however lets say I don't have a line but a single point I am trying to get the elevation for, how would I go about modifying the example to allow me to get elevation for a single point?

Hi @corcoranj0 ! Thanks for your interest. I’ll see what I can do. Note that if your point falls in between DEM grid, we could have undertermined result depending on the interpolation model.

@xfischer Thanks so much for the response. To be honest the reason I need this is because I am trying to convert an old C++ project over to C#. It uses OpenCV to do all the calculations but I have been struggling with converting and finding all the native methods over the last couple weeks.

Basically, I have a bunch of GeoTiff's. They contain an index file that contains some basic info that is also existent within the GeoTiff metadata. I have a point and I am trying to query the corresponding elevation.

My Test Point is:
Lat:39.713092
Lon: -77.725708

OpenCV gives me back: 208.937219023705

I feel like I am really close to finding a good solution to this using what you have just need a little help.

Hi again @corcoranj0.
You can check in the sample app the PointDEMTest method, which gives us a nice elevation of 213.48992919921875 meters.
Edit : please note that the 30m dataset was used for calculations.

Thanks @xfischer I will give it a shot now!

This location is very close to runway threshold of airport http://155.178.201.160/d-tpp/1805/05114AD.PDF.
Diagram says that elevation is at 703 feet -> 214.274 meters.

@xfischer I pulled down the code I am just going to modify it to use the geoTiffs I have on my local machine since at the end of the day that is what the app needs to use.

@xfischer I just tried it out and worked spectacularly! Thank you so much for putting that in there for me

Cool ! Good to see it’s useful ! Let me know if you have troubles (could get bad estimation near geotiff edges, but can handle adjacent geotiffs with some more work ;)