Leaflet is a nice javascript library for slippy maps, but you still need to bring your own tileserver (OSM is not free to embed for anything beyond light usage I believe)
They also have ongoing operational problems/expenses from people using their tile servers, and it's possible that they will one day break you in order to keep their own site functioning.
There are already several javascript libraries that use OSM tiles out there, most popular being OpenLayers[0] which offers an comprehensive API and Cloudmade's Leaflet[1]
LeafletJS is awesome. It's an important open source offering within the OpenStreetMap ecosystem. If you're looking for an "OpenStreetMap API" for embedding a map, then you're looking for LeafletJS! ...or another one called OpenLayers, or various other lesser used options. You have a choice! With OpenStreetMap you also have a choice of where you get your map "tiles" from, or you can render and host them yourself. Check out this website which explains a lot more about the various options for making the switch to OpenStreetMap:
Leaflet is just great. I made a demo as soon as I heard about it a few weeks ago. I combined leaflet on the client side with varnish as a tile cache and nginx as a tile server. I plan to switch to node.js as soon as it supports sendfile.
It's not hard to produce your own tiles from OpenStreetMap data and serve them from your own server using something as Leaflet. If you only need to show maps, and if OSM data is good enough in your part of the world (a big if), this is the way to go.
What is very hard is coming up for a replacement of either geocoding/reverse geocoding, or routing; many solutions exist but most don't really work or are quite difficult to setup (IMHO).
Here are three things I'd like to do with Leaflet, or generally just have from an online mapping tool:
1. Use WebTorrent[1] as the tile provider (would probably need a canonical WebTorrent server so that all tiles would always have at least one seeder).
2. A Progressive Web Map (teehee) so that users can store tiles offline and use the mapping service while offline. Obviously not a new concept but AFAIK there isn't a map provider that does it in the browser.
3. Client-side routing/navigation. This could start as a simple Dijkstra in JavaScript (like is demonstrated in [2]), but maybe could be made more powerful and capable soon with WebAssembly.
Is anybody working on these sorts of things? Is anybody interested in them? I've heard of peermaps[3] but it hasn't been updated in over 6 months. I'd be interested in contributing or teaming up with others on these sorts of things.
Cool! It looks like they're using leaflet and hosting their own tile server from Open Street Map data. I really like that they opened up how to connect to their tile server (thanks to chippy for the link: https://www.mediawiki.org/wiki/Maps ). When I was looking at options for creating a side project with open street map data earlier I ended up using Mapquest's open data api because Google maps had API restrictions after a number of calls and it was easy to integrate with leaflet, but if I was making it again I would consider using wikimedia's option. (Fyi, the sideproject is a static site hosted at http://newsatlas.io - it takes a news/rss feed & attempts to parse the location client side by parsing the news article's summary text and displaying the location on a map - it was written in JS with angular and leaflet as dependencies - hosted on S3).
* Leaflet is based completely on the web platform. It achieves a zoomable slippy map experience by animating DOM elements - usually image tiles.
* MapLibre GL JS is a BSD licensed fork of Mapbox GL JS version 1. Instead of consuming bitmap image tiles, it consumes tiles corresponding to the same coordinate extents as the above tiles, but containing tagged geometry features. So instead of sending a PNG image you're sending what is essentially an SVG, but in binary format and with some domain-specific compression.
* The GL JS renderers also rasterize those vector tiles using WebGL, which means that all the geometry data exists in GPU memory and can be scaled, rotated, and recolored etc in realtime efficiently, and also implement their own limited text rendering so even labels can be rotated in realtime.
That might be doable if the library is jquery or whatever, but how are you going to replace google maps? Hosting an OSM tiles server is non-trivial, and I highly doubt that you'll be able to host it with better reliability than google.
Hmm, thats cool, but I need to have raster maps pushed to my endpoints.
Do you know any easy way to use mvt maps and generate tiles from them
on the fly (CGI backend + caching) and then use Leaflet to render those?
I have my own tiny personal project for maps renderer using Leaflet.
For now I use 3 sources for tiles (Google, OSM and Esri) but having more sources would be very cool.
If you're looking for a complete javascript mapping library, I'd stick with openlayers for now. In the future though, I hope leaflet takes off and offers some competition
TileMill is a lot of fun; you can download it and be making custom maps in just a few minutes. There's a lot of very sophisticated open source cartography hiding under the covers, not to mention nodejs wizardry. They've done a great job of packaging it all and making an easy to use tool for map-makers without requiring a lot of GIS or OSGeo expertise.
One particularly nice option is the ability to "print" your pre-rendered map to an MBTiles bundle for serving in a slippy map on the web.
OpenStreetMap.org's tileservers don't supply retina tiles. But OSM's tileservers are effectively a tech demo and a resource for mappers, not a user-facing service. If you're building a consumer-grade product, you're expected either to use OSM data to render your own tiles, or use a third-party provider which provides tiles based on OSM data (such as Thunderforest, Geofabrik or Mapbox). Leaflet, as the client-side JS part of your mapping solution, can happily show retina tiles from such a provider or your own tileserver.
Another happy MapQuest user here as well. We saved tens of thousands a year by switching from Google Maps to OSM/MapQuest. Leaflet [1] is also a big feather in the cap - easy API, actively maintained, and it easily integrates with any number of tile providers with no provider-specific code.
TileMill is great, I used it to style our replacement maps, since google maps decided to start charging. Here is an example: http://tile.ridewithgps.com/leaflet.html
TileMill is addictive to play with, though very tedious if you don't have a fast machine with some SSD's, as refreshes take a while to reload various zoom levels to see your work. Not much to be done there except throw hardware it.
Edit: I am hosting our maps on my own hardware, mapnik2+mod_tile. I just used the slick client to create a mapnik XML file for rendering.
reply