-3

I am having a lat-long position(each stored as double) and would like to get the corresponding altitude at that point by using only GPS. This should be done without the assistance of any networking involved.

Any help is appreciated. Thanks in advance.

raghav3276
  • 1,088
  • 8
  • 14
  • @CliffRibaudo That question is corresponding to the current location. But, my question is to get altitude of a remote location without using any web service. – raghav3276 Dec 26 '14 at 13:51

2 Answers2

6

The altitude of the device does not have a lot of relationship to the latitude and longitude.

For example, a device aloft in an airplane will have a higher altitude than will a device at ground level over the same latitude and longitude. Locations retrieved by LocationManager that used GPS to get the location fix may have altitude information, but that will be the altitude of the device.

If you want the elevation of ground level at a particular latitude and longitude, you would need to look that up in some sort of GIS database. Android does not ship with one of these, and so you will need to use a search engine to find a suitable database for you use.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I am in need of the requested location's elevation. Not the device's. – raghav3276 Dec 26 '14 at 13:53
  • @raghav3276: Then you need to find yourself a GIS database that contains the data you need, for the granularity of latitude/longitude that you need, for the portion of the Earth's land mass for which you want this information. Other than needing an Android-friendly SDK for working with the database, this otherwise has nothing to do specifically with Android. – CommonsWare Dec 26 '14 at 13:55
  • So, do I need internet for achieving that? Is there any way such that we could request the GPS itself to fetch the information? – raghav3276 Dec 26 '14 at 13:56
  • @raghav3276: "do I need internet for achieving that?" -- I have no idea if there is an offline database with an Android-friendly SDK that meets your other requirements. "Is there any way such that we could request the GPS itself to fetch the information?" -- no, because this has nothing to do with GPS. GPS can tell you the altitude of the *device*. But the signals sent out by the GPS satellites do not change whether the device is in an airplane, on a high floor of an office building, at ground level, or in a cave. – CommonsWare Dec 26 '14 at 13:57
  • What you need is more like a terrain profile embedded in a map (DTED) – ecle Dec 26 '14 at 14:45
1

No, you can't do that because the altitude is a variable that changes with the height.

Ahmed Hegazy
  • 12,395
  • 5
  • 41
  • 64