Curvature and traffic light data from a polyline in heremaps

25 Views Asked by At

I'm attempting to obtain route information for random routes using HERE Maps for my project. I'm successfully retrieving a polyline, and upon decoding, I obtain the correct latitudes and longitudes. However, when I attempt to request curvature (and also search for potential traffic lights) for the entire route, I receive a response with status code 200, but the data row is empty. Additionally, the location is shown as Antarctica, whereas my coordinates are from Germany. What am I doing wrong, or is there another method to retrieve this data?

origin = "52.520762, 13.406331"
destination = "52.391113, 13.063911"
url = "https://router.hereapi.com/v8/routes?transportMode=car&origin=" + origin +  "&destination=" + destination + "&apikey=" + YOUR_API_KEY
   
# Parameters for the API request
params = {
    "return": "polyline,elevation,summary",  # Include route polyline in response
    "spans" : "length,maxSpeed",
}
# Make the API request
response = requests.get(url,params=params)

# Parse the JSON response
route_data = response.json()
route_polyline = route_data["routes"][0]["sections"][0]["polyline"]
coordinates = fp.decode(route_polyline)
map_attr_url = f"https://smap.hereapi.com/v8/maps/attributes?layers=ADAS_ATTRIB_FC1&in=tile:1&polyline={polyline}&apikey={api_key}"
map_attr_response = requests.get(map_attr_url)
map_attr_data = map_attr_response.json()\

map_attr_data is returning an empty for the curvature data

0

There are 0 best solutions below