mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.19k stars 2.22k forks source link

Questions about isochrone API #10665

Closed rudyhadoux closed 3 years ago

rudyhadoux commented 3 years ago

Hi,

I don't know if I am in the good repository but I have difficulties to use your Isochrone API.

Your Isochrone API generates polygon areas with a time travel and a transport mean.

Question 1 : Is the generated area calculated with speed limits ? Besides the speed depends on hours of day.

Question 2 : How to know if a location is in or out the area ?

Thanks.

Rudy.

ryanhamley commented 3 years ago

Hi @rudyhadoux We don't maintain the Isochrone API so I don't really know the answer to question 1. For question 2, I think the right solution is going to depend on what you want to do. You could use queryRenderedFeatures to get a list of all rendered features (or querySourceFeatures for all features) and loop over them to set a property on them using the within expression with the isochrone polygon as the input. I'd recommend contacting Mapbox Support as they can give you more specific answers. Thanks.

rudyhadoux commented 3 years ago

I have contacted Mapbox technical support. For question 2, https://www.npmjs.com/package/@turf/boolean-point-in-polygon seems to be a solution.