-1

I use Leaflet for most work. Leaflet's default zoom levels use 256x256 pixel tiles. Often this does not allow me to focus nicely on regions, because I cannot set intermediate values in Leaflet's default zoom method; only integers work.

If I knew how to render my own tiles (e.g. 100x100 pixel tiles as described here, though I did not understand), I could still use Leaflet. Since I do not, I am considering switching to jvectormaps, but it seems to lack a good documentation.

Problems:

  • I cannot zoom to an intermediate level using Leaflet's default zoom and scale methods.
  • I do not know how to render my own tiles.
  • If it would help any, I do not understand the Leaflet documentation to create custom layer: http://leafletjs.com/reference-1.0.3.html#gridlayer

Question 1: How can I use intermediate (between 256x256 pixel tile size) zoom levels in Leaflet?

Question 2: Can you recommend any open-source web-mapping library which offers detailed (smaller than 256x256 pixel) pre-rendered tiles (other than jvectormap)?

  • 1
    aren't the tiles dependent on the service/server you use not the framework? – Ian Turton Feb 14 '17 at 17:30
  • Yeah, most web map libraries (at least leaflet and openlayers, the ones I know of) are able to load tiles of arbitrary size, and even render vector tiles. – IvanSanchez Feb 14 '17 at 18:28
  • I hope with my edit it is now clearer. Thanks iant♦ and IvanSanchez. Yes, my problem is not with Leaflet, just with its default of using 256x256 pixel tiles for zoom levels. I would like to retain Leaflet for my work, but I do not know how to create AND use arbitrary size tiles. Please help – Naibaf Feb 14 '17 at 18:39
  • I suggest you research into the zoomSnap option of L.Map, and the tileSize option of L.TileLayer/L.GridLayer. I do not know if you need more granularity of the zoom levels, request smaller tiles, or something else. – IvanSanchez Feb 14 '17 at 19:14
  • Thanks Ivan. I do not want to get too close on zoom level 5 or not close enough on level 4, for example. I hope this makes sense. Sorry, I cannot describe this better – Naibaf Feb 14 '17 at 19:40
1

I want to thank IvanSanchez for the help. I was working in Leaflet 0.7.7 which did not have a zoomSnap option.

When defining L.Map, one can get between-integer zoom levels by defining a zoomSnap factor between 0 and 1 (being the default), as IvanSanchez suggested. Nota bene: This was not available in 0.7.7. And it's awesome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.