Tuesday, May 29, 2018

Find the Elevation of any Location

According to WikiPedia: the elevation of a geographic location is its height above or below a fixed reference point, most commonly a reference geoid, a mathematical model of the Earth's sea level as an equipotential gravitational surface.

In the geo-spatial industry, getting and working with the elevations of points is a very common task for many obvious reasons. Elevation value of points can be obtained through various techniques such as land surveying and GPS observations.

Using the techniques above, there will be a challenge when you need to obtain the points that are difficult to access. In such situations, you will have to consider a remote service to get such elevation values. One of such remote services that provide access to elevation data we will discuss in this blog post is: Open-Elevation.com





Given the latitude and longitude of a location, Open-Elevation.com API will probably has its elevation value in its database which they made available for free public access.

Open-Elevation is a free and open-source alternative to the Google Elevation API and similar offerings. It uses DEM data from SRTM, that is published and can be downloaded freely from USGS.

To obtain an elevation using the Open-Elevation.con API, you need to supply the latitude and longitude values of the location. For example, lets get the elevation of Zuma rock, in Niger state Nigeria.



To make use of the API, you just need to supply latitude and longitude values to the url: https://api.open-elevation.com/api/v1/lookup?locations=latitude,longitude

Above is just for one point. If you need for multiple points, separate the latitude and longitude values with vertical bar "|" the url is like this:
https://api.open-elevation.com/api/v1/lookup?locations=latitude,longitude|latitude,longitude|latitude,longitude


The result is returned in JSON format.


Here I have a list of points across Zuma rock that I did like to obtain there elevations for profile plotting. It is almost impossible for me to climb on the rock just to collect elevation values, so I will use Open-Elevation.com API discussed above for this exercise.


The url will look like this:-
https://api.open-elevation.com/api/v1/lookup?locations=9.20070,7.23351|9.20231,7.23904|9.20320,7.24583|9.20409,7.24993|9.20445,7.25564|9.20749,7.25922|9.21177,7.26314|9.21480,7.26707|9.21838,7.26868|9.22266,7.27046|9.22873,7.27153|9.23319,7.27207|9.23605,7.27332|9.23926,7.27707|9.24140,7.28082


The JSON result is like this:-

{"results": [{"latitude": 9.2007, "elevation": 472, "longitude": 7.23351}, {"latitude": 9.20231, "elevation": 483, "longitude": 7.23904}, {"latitude": 9.2032, "elevation": 490, "longitude": 7.24583}, {"latitude": 9.20409, "elevation": 538, "longitude": 7.24993}, {"latitude": 9.20445, "elevation": 571, "longitude": 7.25564}, {"latitude": 9.20749, "elevation": 556, "longitude": 7.25922}, {"latitude": 9.21177, "elevation": 527, "longitude": 7.26314}, {"latitude": 9.2148, "elevation": 525, "longitude": 7.26707}, {"latitude": 9.21838, "elevation": 522, "longitude": 7.26868}, {"latitude": 9.22266, "elevation": 532, "longitude": 7.27046}, {"latitude": 9.22873, "elevation": 563, "longitude": 7.27153}, {"latitude": 9.23319, "elevation": 556, "longitude": 7.27207}, {"latitude": 9.23605, "elevation": 514, "longitude": 7.27332}, {"latitude": 9.23926, "elevation": 506, "longitude": 7.27707}, {"latitude": 9.2414, "elevation": 509, "longitude": 7.28082}]}


To get the most out of this, you will need to parse the JSON result using programming language such as Python, JavaScript etc to extract the elevation from the raw JSON string.

This will be a topic for another day. You can read similar topic at: CREATING AN ELEVATION PROFILE GENERATOR IN PYTHON

No comments:

Post a Comment