nilsnolde / routingpy

🌎 Python library to access all public routing, isochrones and matrix APIs in a consistent manner.
https://routingpy.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
272 stars 28 forks source link

HereMaps Isochrones returning faulty geometry #32

Open chrstnbwnkl opened 3 years ago

chrstnbwnkl commented 3 years ago

Here's what I did

from shapely.geometry import Polygon
from routingpy import get_router_by_name

api = get_router_by_name("heremaps")(api_key)

location = [13.479801753996686, 52.55725875370285]

isochrones = api.isochrones(location, profile="car", intervals=[300,600])

geometries = []
for isochrone in isochrones:
    geometries.append(Polygon(isochrone.geometry))

Here's what I got


Here's what I think could be improved

Since HereMaps is the only router having that problem, the bug is likely to be caused by the response parsing. It seems like the geometry is wrapped one too many times into a list, because

geometries.append(Polygon(isochrone.geometry[0])) 

produces the desired result.