rnmapbox / maps

A Mapbox react native module for creating custom maps
MIT License
2.28k stars 847 forks source link

Unable to set a worldview (to change displayed borders) #897

Closed dancherb closed 4 years ago

dancherb commented 4 years ago

Hello - I'm struggling from the documentation to see how to set a worldview for the map. I'm using a Mapbox map from a style URL, derived from one of the basic style templates.

Ideally, I'd like to change the country boundaries and labels based on whether a user is in India or the US. As a fallback, I'd be happy to set a fixed worldview (in this case IN) - e.g. from Mapbox Studio for the style itself.

This article suggests a "setFilter" method is available, though it's not clear if/how this is exposed via the package: https://blog.mapbox.com/dynamically-change-disputed-national-borders-14c820cae923

Thanks!

label-actions[bot] commented 4 years ago

:thinking: @dancherb, this is rather a question than an issue
please use our gitter or stackoverflow for this.

dancherb commented 4 years ago

🤔 @dancherb, this is rather a question than an issue please use our gitter or stackoverflow for this.

Hello robot. I'll check out Gitter but I'm a bit weirded out that you can only log in via GitHub (will this also bother any organizations I'm affiliated with?) and GitLab (why does this need read/write access to my projects?)

dancherb commented 4 years ago

Would still appreciate some input here, can consider this post as an issue with the documentation for worldview and similar filters even if it's not re-opened.

mfazekas commented 4 years ago

@dancherb We have the ability to set filter for layers created in RNMBGL. So if you add those layers yourself it should work.

https://docs.mapbox.com/help/tutorials/get-started-mapbox-boundaries/

We don't have a way to refer to existing layers at the moment AFAIK, in future that could work like this:

<LineLayer id="admin-0-boundary" existing filter={[...]} />