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
Shapely's Polygon instantiation causes an `AttributeError´: 'list' object has no attribute '__array_interface__'
Here's what I was expecting
A list of Polygons
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
Here's what I did
Here's what I got
Shapely's
Polygon
instantiation causes an `AttributeError´: 'list' object has no attribute '__array_interface__'Here's what I was expecting
A list of Polygons
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
produces the desired result.