'Mapbox get layer data when route is close to a coordinate point

I am trying to get layer data when a route is close to the coordinate listed in the layer. So far I have created my own solution by mapping through all of the layers I am interested in and matching close coordinates. The data is gathered in new arrays to be referenced.

Does mapbox have any built in api features that could duplicate my results in a more effective solution?

Can I pair mapbox with another api to duplicate my results in a more effective solution?



Solution 1:[1]

I'm not entirely sure from your description if this is a fit, but this sounds to me like the Tilequery API might be a fit https://docs.mapbox.com/playground/tilequery/. Given a coordinate, it will return nearby features within select layers of a style.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mikel Maron