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

Custom Mapbox styles don't apply #65

Closed
alkaitagi opened this issue Jun 30, 2022 · 7 comments
Closed

Custom Mapbox styles don't apply #65

alkaitagi opened this issue Jun 30, 2022 · 7 comments

Comments

@alkaitagi
Copy link

I've tried to use the plugin with custom styles which I've created in Mapbox Studio and then downloaded as .jsons. Unfortunately, this plugin doesn't seem to apply the styles as the map displays with the default Mapbox Light and Dark (i.e. not dimming texts and borders like I've specified in my styles).

For references, this is how my custom light map should look:
image

I've made a minimal repo to demo the issue: https://github.com/alkaitagi/vector_map_test/tree/master/lib. I'll appreciate any help.

@greensopinion
Copy link
Owner

I've had a look at your example and there are a couple of issues here: https://github.com/alkaitagi/vector_map_test/blob/master/lib/mapbox.dart#L22-L27

  1. This library only supports web URL schemes, i.e. https and http - it looks like you're using mapbox:
  2. This library expects an URL template to point to tiles directly

For example if you go to https://www.mapbox.com/maps/streets and tap on "Preview", you'll see a map come up. If you check how the map was loaded, you'll find that it loads a URI that looks like this: https://api.mapbox.com/v4/mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2.json?secure&access_token=
Looking at the response, you can find how the tiles are loaded, in this case https://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2/{z}/{x}/{y}.vector.pbf?access_token=...
It's this last URL that you want to use with this library.

@alkaitagi
Copy link
Author

Thanks for the quick response. I've tried with this link, but nothing have changed.

@greensopinion
Copy link
Owner

There was a bug introduced a few days ago, since fixed, that prevented some themes from working. You may want to try the latest version 2.1.2 to see if that resolves the issue for you.

@alkaitagi
Copy link
Author

I have updated the package and once again checked the URL. I see only see default style without my customization. No errors shows up on the console. I think you were too early to close this issue since the problem is not resolved.

@greensopinion
Copy link
Owner

@alkaitagi I've created an example that uses mapbox. Let me know if that makes a difference for you.

https://github.com/greensopinion/flutter-vector-map-tiles/tree/mapbox-example

This is the commit with the relevant changes: 00cdb61

This is what it looks like:

Screen Shot 2022-07-08 at 7 39 34 AM

@alkaitagi
Copy link
Author

alkaitagi commented Jul 16, 2022

No, this still doesn't work for custom styles created with Mapbox Studio. It only applies the default theme (dark) instead of my own theme based off it, like it is described in the original post on this issue. No errors are present in the console. I suggest you create your own theme (e.g. change country borders from solid to dashed) and try making that work.

Also, believe me I appreciate your communication and intention to help, but why is this issue still being held as closed while clearly the problem is not resolved.

@greensopinion
Copy link
Owner

@alkaitagi I've had a go with a custom theme, I made the streets red. Here's the result:

Screen Shot 2022-07-16 at 3 51 07 PM

To get that to work you will need to get the style using an URL that looks something like this: https://api.mapbox.com/styles/v1/greensopinion/cl5oh4q3t000216o0tc9cngxh?access_token=$mapboxApiKey
You'll also need to publish your custom theme (so that it's available in production on mapbox)

See 5161457 which demonstrates how to use a custom theme.

why is this issue still being held as closed while clearly the problem is not resolved

The issue is still closed because it looks like there isn't a problem with this library. I'm happy to reopen it if there's clearly a problem, but in this case there has been a lack of data pointing to a problem.

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