Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An Introduction to Leaflet

An Introduction to Leaflet

A short introduction to the Leaflet JavaScript map library I gave at my local JS meetup.

Tom Kruijsen

June 10, 2014
Tweet

More Decks by Tom Kruijsen

Other Decks in Programming

Transcript

  1. var RD = new L.Proj.CRS.TMS( 'EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079

    +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,- 1.8703473836068,4.0812 +no_defs', [-285401.92,22598.08,595401.9199999999,903401.9199999999], { resolutions: [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420] }); var map = L.map('map',{ continuousWorld: true, crs: RD }).setView([52.1551862, 5.3872315], 8); L.tileLayer('http://geodata.nationaalgeoregister.nl/tms/1.0.0/ brtachtergrondkaart/{z}/{x}/{y}.png', { continuousWorld: true, tms: true }).addTo(map);
  2. var RD = new L.Proj.CRS.TMS( 'EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079

    +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,- 1.8703473836068,4.0812 +no_defs', [-285401.92,22598.08,595401.9199999999,903401.9199999999], { resolutions: [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420] });
  3. var map = L.map('map',{ continuousWorld: true, crs: RD }).setView([52.1551862, 5.3872315],

    8); L.tileLayer('http://geodata.nationaalgeoregister.nl/tms/1.0.0/ brtachtergrondkaart/{z}/{x}/{y}.png', { continuousWorld: true, tms: true }).addTo(map);
  4. var geojson = L.geoJson(data, { style: function (feature) { return

    { color: feature.properties.color, weight: 5, opacity: 0.65 }; } }).addTo(map);