TransWikia.com

onEachFeature bindPopup

Geographic Information Systems Asked on February 10, 2021

I am trying to use Mapbox to display my maps.

a) I need to bind a popup on each polygon within a Tileset. I have done it in Leaflet using the onEachFeature function. The data should come from the Tileset’s vector fields. Please focus on the Tileset as the source of information.

b) I also need to label the polygons using a field within the Tileset.

I simple script will do me just fine. This is where I am right now


<script>
        L.mapbox.accessToken = 'Token';
var map = L.mapbox.map('map')
.setView([-1.3328338, 36.8831222], 17)
.addLayer(L.mapbox.styleLayer('mapbox://styles/map/Tileset'));

var featureLayer = L.mapbox.featureLayer({
type: 'vector',
features: [{
type: 'Feature',

    onEachFeature: function (feature, layer) {

        var content = '<a "href="PlotMainDetails.apx?"' + feature.properties.plotno_1 + '" </a>"';
        layer.bindPopup(content);

        
    },
}]
})
.addTo(map);

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP