greensopinion / dart-vector-tile-renderer

A vector tile renderer for use in creating map tile images or writing to a canvas. Written in Dart to enable use of vector tiles with Flutter.
BSD 3-Clause "New" or "Revised" License
42 stars 24 forks source link

ImageRenderer and scale between 1 and 4 #71

Closed Sprechen closed 1 year ago

Sprechen commented 1 year ago

Hi guys, First of all thank you for developing this very interesting library. I'm using this library directly in flutter_map for better performance and custom tile loading, instead of the "classical" vector_map_tiles. I was wondering why you put in the code of ImageRenderer the assert fo the scale parameter, enforcing it between 1 and 4. Currently, I have forked your project and removed this restriction, using a scale parameter up to 16. I'm using the flutter_map as a full screen widget and, for my data source, I'm limited to use a maxNativeZoom to 14. With this limitation, I wasn't able to obtain nice and high resolution tiles of the map on zoom between 16 and 19, also working with the zoomScaleFactor and zoom parameters in the render method, and the scale parameter maximum value was too limiting.

Have you any other solution to improve this setup?

Thank you!

greensopinion commented 1 year ago

Hey thanks for the issue! Looking back at the commit that introduced the restriction, it looks like I put it there as an arbitrary sanity check. Likely we had no use-case for having a scale > 4. Feel free to issue a PR to relax the constraint!

I'm really interested to hear more about your use-case and how using this library directly instead of vector_map_tiles improves performance. If you have a repo demonstrating improvements I'd love to see it!

Sprechen commented 1 year ago

At this moment I cannot provide a repo, but basically we cached the generated tiles as standard png and served them directly since the second request. Since we have a complete control on the tile request, with this method we can also mixed both local and remote loading (so from a local mbtiles repository or from traditional raster tile sever). I know that with this method the storage usage is extremely increased, but in some situation, as a specific app for some specific devices, this is not a problem.

I also noticed that there are some other asserts in the tile_model.dart file. A couple of times, I see an exception thrown by these asserts (unfortunately I can't provide you steps to reproduce the problem, since it hasn't happen in a systematic way). This problem caused a "gray" rendered tile, of course. Maybe, also in this case, it is possible to "relax" this assertions and, at least, provide a partially rendered tile (maybe without all of the intended details), that's probably better than nothing! Anyway, I will try to investigate on this problem.

greensopinion commented 1 year ago

Closing since this issue is stale. We can reopen if/when needed.