Getting altitude from latitude and longitude (HERE-API)
Asked Answered
N

4

2

Is there anyway with the HERE Javascript API to obtain an altitude given a specific latitude/longitude pair? The geo point returned by map.screenToGeo() only returns latitude and longitude as far as I can tell.

Nonperishable answered 5/8, 2015 at 17:35 Comment(0)
F
6

You can't do it with the HERE API, that I can see, but you can get that information from the Google Elevation API.

By making a GET call and passing in the latitude and longitude in the query, you can get back the altitude from sea level in meters:

https://maps.googleapis.com/maps/api/elevation/json?locations=40.714728,-73.998672

This will return a json object like this:

{
   "results" : [
      {
         "elevation" : 8.883694648742676,
         "location" : {
            "lat" : 40.714728,
            "lng" : -73.998672
         },
         "resolution" : 76.35161590576172
      }
   ],
   "status" : "OK"
}

More info: https://developers.google.com/maps/documentation/elevation/intro

Fewness answered 5/8, 2015 at 17:56 Comment(3)
Nice, this just works! Is there a similar request, I could use for OpenStreetmap?Manion
@Manion From what I can see, no. There was a proposal for it that didn't go anywhere? wiki.openstreetmap.org/wiki/Proposed_features/…Fewness
Currently, an api key is required.Forfend
E
0

There is a plenty different APIs in Internet. The most popular is google on that was mentioned above. Here is the another one here: https://algorithmia.com/algorithms/Gaploid/Elevation

var input = {
    "lat": "50.2111",
    "lon": "18.1233"
};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://Gaploid/Elevation/0.3.0")
           .pipe(input)
           .then(function(output) {
             console.log(output);
           });
Evasion answered 30/7, 2016 at 12:28 Comment(1)
I was very happy with opentopodata.org, as it is very fast (almost instant reply).Korfonta
R
0

I know that the question has not been active in a long time but I happened to stumble upon the same doubt and found that this is posible using Here Routing API v8.

https://developer.here.com/documentation/routing-api/dev_guide/topics/use-cases/elevation-profile.html

Rabush answered 7/9, 2021 at 15:14 Comment(0)
F
-4

No, I don't see how this is possible since latitude and longitude are just x and y coordinates and in no way convey any type of information as to the altitude.

Fitzgerald answered 5/8, 2015 at 17:47 Comment(1)
There are big databases in the world, which contain the altitude value for each GPS position. The altitude isn't calculated from longitude/latitude, instead it's queried and interpolated.Ardy

© 2022 - 2024 — McMap. All rights reserved.