Web Design Discussion > General Web Design Discussion

TM implementation using Leaflet for mapping

(1/7) > >>

Jim:
I spent a a few hours this evening converting TM's Google Maps API calls to the free and open Leaflet mapping API.  The conversion was remarkably straightforward.  I definitely have a bunch of kinks to work out and I have done only minimal testing so far, but I think this is going to work.  If you want to see what it looks like so far, keeping in mind that there's more I would add and a lot more testing I'd do before we make the switch, check out http://tml.teresco.org .  You can also see the new code on GitHub in the "leaflet" branch: https://github.com/TravelMapping/Web/tree/leaflet

For those unaware, our current Google Maps implementation could cease to function on June 11 when Google starts requiring billing information even for non-commercial use of their API.  I don't think we'll have any problem getting switched over to Leaflet well before that deadline hits.

yakra:
Looks nice. Panning and zooming, and overall responsiveness seem faster than the Google API as well.

Yes, you still have kinks to work out, and I may be jumping the gun here, but...
[*] Can the default layer be set to OpenStreetMap instead of Stamen Terrain?
[*] Can custom / 3rd party tile sets be added?
[*] Shame about losing the satellite view, though...

oscar:

--- Quote from: yakra on May 22, 2018, 12:36:06 am ---Looks nice. Panning and zooming, and overall responsiveness seem faster than the Google API as well.

Yes, you still have kinks to work out, and I may be jumping the gun here, but...
[*] Can the default layer be set to OpenStreetMap instead of Stamen Terrain?
[*] Can custom / 3rd party tile sets be added?
[*] Shame about losing the satellite view, though...

--- End quote ---

Can we continue accessing Google Maps and satellite view through the Leaflet API? Both are useful in various ways (for example, GM is better than OSM at showing businesses and other landmarks, that can confirm the waypoint where I entered/left a route), even if we can't use them to grab coordinates for our mapping.

Is there open-source satellite imaging we can sub in, to replace the departed MQOpenSat?

Jim:
There are tons of map tiles we can add pretty easily.  I've only tried these three to get started.  The big exception is Google's, since they don't make their tiles available directly from outside their own API, and workarounds out there that do so are a very clear violation of Google's terms.  I also don't want to make the Mapnik tiles the default, since we're not supposed to use their tile server.  We got away with it in our previous implementation but we could get blocked if usage is too heavy.  There's the option of running our own tile server to get the Mapnik which is some work but looks completely doable.

Jim:
Check out https://github.com/leaflet-extras/leaflet-providers and let's think about which of these map tiles make sense to include.  If you like one, please check out its terms of service and make sure it seems like our usage would be appropriate.  Also make sure it has an appropriate range of zoom levels.  Some don't zoom in close enough for our purposes.

Navigation

[0] Message Index

[#] Next page

Go to full version