Welcome to Advanced Interactive Web Mapping, Programming, and Design, Class 7

This is a web page that can be viewed as slides.

→ to move forward

← to go back

Advanced Interactive Web Mapping, Programming, and Design

Class 7

source
example

events

L.Map events

L.Map

You add these to a map and handle them like any other event

L.Map
var map = L.map('map');
map.on('mouseover', function () {
    console.log('mouseover!');
});

in-class exercise, part 1

L.Path events

L.Path

Add these to layers and markers from a GeoJSON layer

in the onEachFeature option

L.geoJson(data, {
  onEachFeature: function (feature, layer) {
    layer.on('click', function () {
      console.log('click.');
    };
  }
};
L.geoJson(data, {
  onEachFeature: function (feature, layer) {
    layer.on('click', function () {
      console.log('click.');
    };
  }
};

in-class exercise, part 2