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

Add convenience methods to Directions/Matrix/Isochrone #2

Open
chrstnbwnkl opened this issue Nov 16, 2022 · 1 comment
Open

Add convenience methods to Directions/Matrix/Isochrone #2

chrstnbwnkl opened this issue Nov 16, 2022 · 1 comment

Comments

@chrstnbwnkl
Copy link
Collaborator

As of now, I've adapted an approach similar to routingpy's when it comes to parsing the response and making the returned coordinates easily accessible. I think that in browsers, memory is more of a concern, so I propose to not parse the response by default and thereby ending up with a lot of duplicate data, but instead providing the parsing as a static method that can be optionally called:

v.directions(
    [
        [8.512516, 47.380742],
        [8.557835, 47.359467],
    ],
    "auto"
).then((d) => {
    L.GeoJSON(d.toFeatureCollection()).addTo(map)  // e.g. if you want to display the results in Leaflet
})

We could even attach more attributes to the features than the common ones we're making accessible in routingpy right now (distance and duration), depending on the router's response.

@nilsnolde
Copy link
Owner

I propose to not parse the response by default

Hm, how about the other way around? I mean, we could only keep the raw response if specifically requested (and default to false), but keep parsing? But I'm not really familiar how this package does it right now, we can talk about it in the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants