I am using a map with CRS.Simple. In order to draw polygons, I chose the SVG option. I know it's not the best way. And most likely it is not true. But please tell me how to bind SVG - popup Leaflet to polygons? Or, how to make unproject using GeoJSON so that the coordinates are displayed correctly.
var popup = L.popup()
.setContent('<p>Hello world!<br />This is a nice popup.</p>');
var svgElementBounds = [ [ 0, h ], [w, 0] ];
var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
svgElement.setAttribute('viewBox', "0 0 1200 1200");
svgElement.innerHTML = polygons
L.svgOverlay(svgElement, svgElementBounds, {
interactive: true
}
).addTo(map).bindPopup(popup);
Polygon example from SVG
<polygon id="_361" class="fil1 str0" points="975.1,185 976.5,222 1038.4,220 1036,186.6 986.8,187.7 "/>
If I use .bindPopup(popup); for svgOverlay - popup works, however it works across the entire SVG. I want to bind it to polygons