Leaflet.contextmenu
Leaflet.contextmenu copied to clipboard
Problem with valid GeometryCollection type
I am having trouble with GeometryCollection. When I try to display this type of data on the map I get this error:
TypeError: layer.bindContextMenu is not a function
Here is my full code:
var geoJsonLayer = new L.geoJSON(parsedGeoJson, {
style: jsonLayerStyle,
pointToLayer: function(data, latLng) {
},
onEachFeature: function(feature, layer) {
layer.bindContextMenu({
contextmenu: false,
contextmenuWidth: 240,
contextmenuInheritItems: false,
contextmenuItems: [
{
text: "<i class='fa fa-map-marker'></i> Coordinates",
callback: showCoordinates
},
{
text: "<i class='fa fa-align-center'></i> Center",
callback: centerMap
},
"-",
{
text: "<i class='fa fa-search-plus'></i> Zoom In",
callback: zoomIn
},
{
text: "<i class='fa fa-search-minus'></i> Zoom Out",
callback: zoomOut
},
{
text: "<i class='fa fa-times'></i> Cancel",
callback: function() { return; }
}
]
});
}
}).addTo(map);
here is my data:
- https://gist.github.com/ozgursarikamis/c18f6b815e558cccdebdf3ad8014891e
- https://gist.github.com/ozgursarikamis/e63024656a6bd270376b17f3c8e54ac4
- https://gist.github.com/ozgursarikamis/de26c9a75612a047e0e298104443ee98 You may validate the data on http://geojson.io as well.
Thank you.