Ground hazards
If your API key supports it, you can request detailed ground-hazard information for a particular region from Altitude Angel.
Here's a sample request:
GET https://api.altitudeangel.com/mapdata/GB/?n=51.464168128746714&e=-0.9606986970367188&s=51.45826568041162&w=-0.9748393029632325 HTTP/1.1
Host: api.altitudeangel.com
User-Agent: Fiddler
Accept: */*
Authorization: bearer [YOUR_TOKEN]
Note there are querystring parameters as well as a URL parameter to modify in this request:
- n, e are a latitude/longitude pair describing the top-left of the bounding box
- s, w are a latitude/longitude pair describing the bottom-right of the bounding box
- GB, in this instance, is the two-digit ISO country code for the country in which we want to make the request. In this example, the coordinates provided are for Reading, United Kingdom, so the country code is GB.
There are enforced limitations on the size of the area of the bounding box that you can supply to Altitude Angel and this is currently 20,000,000 sq. m.
A sample response to this call would be:
[
{
"name": "View Island",
"category": "leisure:nature_reserve",
"reason": 8,
"action": 2,
"style": "hazard",
"shape": {"type":"Polygon","coordinates":[[[-0.962892,51.4611902],[-0.9627082,51.4613056],[-0.9624449,51.4613612],[-0.9621424,51.4616505],[-0.9616427,51.4621765],[-0.9622126,51.4622072],[-0.9624797,51.462155],[-0.9627763,51.4622201],[-0.9629063,51.462317],[-0.9630646,51.4623416],[-0.9631141,51.4623989],[-0.9629868,51.4624591],[-0.9630586,51.4626455],[-0.9636285,51.4623825],[-0.9639528,51.4621108],[-0.9642772,51.4619749],[-0.9645183,51.4617513],[-0.9646454,51.4616286],[-0.9646411,51.4614708],[-0.9639704,51.4613436],[-0.9634882,51.4612165],[-0.962892,51.4611902]]]}
},
{
"name": null,
"category": "railway:rail",
"reason": 1,
"action": 1,
"style": "hazard",
"shape": {"type":"LineString","coordinates":[[-0.968737,51.4586515],[-0.9681236,51.4586422]]}
},
{
"name": "Reading",
"category": "railway:station",
"reason": 5,
"action": 1,
"style": "hazard",
"shape": {"type":"Point","coordinates":[-0.9731788,51.4590798]}
}
]
Errors
If you specify a zero-sized bounding box, you will get an error.
A word about authenticated vs. unauthenticated requests
The /mapdata endpoint currently supports calls to it that are both authenticated and unauthenticated. You will not get an error if you attempt to authenticate and fail, instead we will complete the request as if it was anonymous. Anonymous mapdata requests will return enough data for you to, for example, draw shapes on a map control, but they won't have any details that show you what those shapes represent. You must successfully make an authenticated call in order to retrieve full object details.
Updated over 5 years ago