block by maptastik 5d3b0f8b8247f9da34f6

A Simple Leaflet Map

Full Screen

Walking through putting together the components of this map

  1. You’ll need to set up a simple web document (see html-setup.html below)
  2. Add leaflet css and js (3-4)
  3. Add the map’s container. In this case, it’s #mapdiv. (10)
  4. Add basic style for map the map container (5-7)
  5. Set the initial view of the map (24)
  6. Grab the base layer tiles from their source and them to the map (26-33)
  7. Include data. In this case we’re putting some geoJSON data straight into our HTML document. (13-22)
  8. Grab the geoJSON data from, give it a popup, and add the data to the map. (35-42)

index.html

html-setup.html