Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HereMaps Isochrones returning faulty geometry #32

Open
chrstnbwnkl opened this issue Jun 25, 2021 · 0 comments
Open

HereMaps Isochrones returning faulty geometry #32

chrstnbwnkl opened this issue Jun 25, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@chrstnbwnkl
Copy link
Contributor

chrstnbwnkl commented Jun 25, 2021

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

  • 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

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

produces the desired result.

@chrstnbwnkl chrstnbwnkl mentioned this issue Jun 25, 2021
8 tasks
@chrstnbwnkl chrstnbwnkl added the bug Something isn't working label Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant