Question

I use the longitude and latitude of any location to get the elevation using Google elevation API.

https://developers.google.com/maps/documentation/elevation/

But it gives me illogical elevations for example I am in the second floor and it gives me 88 Meter

There is anyone have an explanation for this issue ?!

Was it helpful?

Solution

The API you are looking at gives you ground level altitude based on a reference data set. It want be able to tell your on the second floor of a building. The best it will do is tell you is the altitude for the ground floor of the building.

If you want height above ground level then you could get something probably accurate to about +-0.5m on a phone with a pressure sensor but that would mean getting a reading at ground level and then at the level your interested in. There is a getAltitude(float,float) method you can use to get relative altitude at two points based off pressure readings. Without calibration the absolute altitude values will not be accurate but relative to each other they should be good. My testing shows I can see the difference just picking my xperia Active up off the desk with this setup with a bit of filtering on the raw pressure values.

OTHER TIPS

Am into this Elevation API recently So if am in right track what you get as 88 meter is the height of ground(where your building is) to sea level difference not the height from ground to second floor. you could use getAltitude() method for this but it gives you height from ellipsoid not from sea level and also it not much accurate you may have to do some calculations to correct the accuracy.

please see this question in SO the links suggested are this and thi

hope this helps you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top