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

PmTilesVectorTileProvider doesn't shows any details of higher zoom levels #17

Closed
netvandal opened this issue Feb 6, 2024 · 4 comments · Fixed by #24
Closed

PmTilesVectorTileProvider doesn't shows any details of higher zoom levels #17

netvandal opened this issue Feb 6, 2024 · 4 comments · Fixed by #24
Labels
bug Something isn't working vector_map_tiles_pmtiles

Comments

@netvandal
Copy link
Contributor

netvandal commented Feb 6, 2024

Hi There,
Can you give me any hint or suggestion on how to work and improve the rendering of the Map. Testing the sample app I can get it working but seems that the vector_map_tiles_pmtiles map is quite basic. Using ProvidedThemes.lightTheme() render like this:

Screenshot 2024-02-06 at 15 50 09
I have some questions:

  1. is this the expected look?
  2. Have you any hint on how to improve it (I'll be happy to help if you give me a starting point)
  3. Can be the style.json here: https://maps.protomaps.com/#map=7.99/45.234/10.21&theme=light&renderer=maplibregl&tiles=https://build.protomaps.com/20240206.pmtiles be of any help?
    Thankyou very much for your work.
@josxha
Copy link
Owner

josxha commented Feb 6, 2024

Hi @netvandal, thanks for bringing some attention to this.

  1. is this the expected look?

No indeed is is not. After some testing I'm still not sure what causes this bug. Since vector_map_tiles_pmtiles is more or less just the binding between vector_map_tiles and pmtiles it's likely that the bug might be hidden in one of these packages.

One important thing: The VectorTileLayer caches it's rendered tiles when using layerMode: VectorTileLayerMode.raster, which is the default. You can either use layerMode: VectorTileLayerMode.vector or disable the caches:

              VectorTileLayer(
                  theme: _style,
                  // disable cache while testing
                  fileCacheTtl: Duration.zero,
                  memoryTileCacheMaxSize: 0,
                  memoryTileDataCacheMaxSize: 0,
                  fileCacheMaximumSizeInBytes: 0,
                  textCacheMaxSize: 0,
  1. Have you any hint on how to improve it (I'll be happy to help if you give me a starting point)

Thanks, I'd glad to accept any help. vector_map_tiles supports the rendering of more details (see the example project and screenshots here). It could be that pmtiles mvt has some other format than the has some other pbf tiles that come from a tile provider like Mapbox or StadiaMaps? ...although I can only guess at the moment.

  1. Can be the style.json here:

I tried with the protomaps style.json but it didn't work either.

@josxha josxha changed the title Theme/Style Sample PmTilesVectorTileProvider doesn't shows any details of higher zoom levels Feb 6, 2024
@netvandal
Copy link
Contributor Author

Seems a "Theme" problem.
Starting from this:
https://github.com/greensopinion/flutter-vector-map-tiles-examples/blob/main/lib/examples/light_custom_theme.dart
and from this: https://github.com/greensopinion/dart-vector-tile-renderer/blob/3930bf8b0cd31105ee80a7d5b39790644130aef2/lib/src/themes/light_theme.dart#L4

And then analyzing the tiles with this tool:
https://protomaps.github.io/PMTiles/?url=https%3A%2F%2Fbuild.protomaps.com%2F20240207.pmtiles#map=0.93/0/0
I can spot some difference in the layer naming.
Trying to make a custom theme seems to work (at least changing some of the style ), and I, for example, be able to display buildings .
I'll try to come up with something usable.

@netvandal
Copy link
Contributor Author

Bingo!
Screenshot 2024-02-07 at 15 09 47
I'll do a pull request soon :)

@josxha
Copy link
Owner

josxha commented Feb 7, 2024

Well done! Looking good so far.

netvandal added a commit to netvandal/flutter_map_plugins that referenced this issue Feb 7, 2024
@josxha josxha linked a pull request Feb 8, 2024 that will close this issue
@josxha josxha added the bug Something isn't working label Feb 8, 2024
josxha added a commit that referenced this issue Feb 10, 2024
* added protomap themes and changed the vector_map_tiles_pmtiles to use it, fixing #17

* add all protomaps themes, update example app

* add `silenceTileNotFound` parameter

* update docs

* change image urls to absolute paths

otherwise they won't visible on pub.dev

* Update pubspec.yaml

* Revert "Update pubspec.yaml"

This reverts commit a41cebd.

* add more instrutions for a custom style to the readme

* Update CHANGELOG.md

---------

Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vector_map_tiles_pmtiles
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants