Actions

Widget

Infomap: Difference between revisions

From Dragon Eye Atlas

No edit summary
No edit summary
Line 44: Line 44:
});
});
   
   
map.on('mouseenter', 'biomes', function(e) {
map.on('mousemove', 'biomes', function(e) {
   // Change the cursor style as a UI indicator.
   if (e.features.length > 0) {
  map.getCanvas().style.cursor = 'pointer';
      // Change the cursor style as a UI indicator.
      map.getCanvas().style.cursor = 'pointer';


  // Populate the popup and set its coordinates
      // Populate the popup and set its coordinates
  // based on the feature found.
      // based on the feature found.
  popup.setLngLat(e.lngLat.wrap())
      popup.setLngLat(e.lngLat.wrap())
      .setHTML(e.features[0].properties.biome)
        .setHTML(e.features[0].properties.biome)
      .addTo(map);
        .addTo(map);
  }
});
});
   
   

Revision as of 17:08, 22 September 2019

Mapbox-GL-JS Information Map Widget

Parameters

  • lon, lat, zoom - longitude, latitude and zoom for the map (defaults: 1, 30, 4)
  • width, height - dimensions of the map itself on the page, in px or % (defaults: 100%, 600px)

Examples

  • {{#widget:Mapbox|bounds=[[0, 25], [8, 31]]}}
  • {{#Widget:Mapbox|lat=31|lon=-15.5|zoom=3}}