Actions

Widget

Difference between revisions of "Markers"

From Dragon Eye Atlas

Line 13: Line 13:
map.on("load", function() {
map.on("load", function() {
   map.on('click', function(e) {
   map.on('click', function(e) {
       map.setLayoutProperty('{{{layer}}}', 'visibility', 'visible');
       map.setLayoutProperty('<!--{$layer|escape:'html'|default:'POIs'}-->', 'visibility', 'visible');
       var features = map.queryRenderedFeatures(e.point, {
       var features = map.queryRenderedFeatures(e.point, {
         layers: ['{{{layer}}}']
         layers: ['<!--{$layer|escape:'html'|default:'POIs'}-->']
       });
       });


Line 26: Line 26:
       var popup = new mapboxgl.Popup({ offset: [0, -15] })
       var popup = new mapboxgl.Popup({ offset: [0, -15] })
         .setLngLat(feature.geometry.coordinates)
         .setLngLat(feature.geometry.coordinates)
         .setHTML('<h3>' + feature.properties.{{{title}}} + '</h3><p>' + feature.properties.{{{description}}} + '</p>')
         .setHTML('<h3>' + feature.properties.<!--{$title|escape:'html'|default:'type'}--> + '</h3><p>' + feature.properties.<!--{$title|escape:'html'|default:'type'}--> + '</p>')
         .addTo(map);
         .addTo(map);
   });
   });

Revision as of 17:33, 5 October 2019

Enable Clickable Markers

Parameters

  • layer - which layer to activate markers for
  • title - which data field to use for pop-up title
  • description - which data field to use for pop-up text