I have the point layer as you can see below:
where the semicircles are fine but points not necessarily. I would like to customize these points as well.
The problem is, that I can't find a good option for doing it.
One reasonable hint for me was here:
Leaflet: Style function does not work for point layer
which define two separate methods L.Circle
and L.Semicircle
at once. This is exactly what I would like to have.
My code looks like this:
var webcam = L.geoJSON(eurocam, {
pointToLayer: function (pointFeature, latlng) {
var rangeMarker = L.semiCircle(latlng, {
radius: 300,
startAngle: pointFeature.properties.AzimuthI,
stopAngle: pointFeature.properties.AzimuthII,
fill: true,
color: '#FF0000',
weight: 1
});
var webcamPoint = L.circleMarker(geojsonMarkerOptions, rangeMarker)
return webcamPoint;
},
onEachFeature: function (pointFeature, layer) {
const stream = pointFeature.properties.Stream;
let liveStr;
if (stream === 1) {
liveStr = "<p class='webcam_refresh'> Live Stream </p>"
} else {
liveStr = "<p class='webcam_refresh'> Image refresh </p>"
}
var popupContent = L.popup({
className: 'map-popup',
closeButton: true,
})
.setLatLng(map.getBounds().getCenter())
.setContent(
"<p><h2 class='webcam_location'>" + pointFeature.properties.Location + "</h2></p>" +
"<h4 class='webcam_provider'>" + pointFeature.properties.Provider + "</h4>" +
"<iframe src=" + pointFeature.properties.Link + "'&output=embed'height='200' width='300'
title = 'camera thumbnail' > < /iframe>" +
liveStr + "<b class='popup_category'>Rotation:</b> " + pointFeature.properties.Rotation
);
layer.bindPopup(popupContent);
}
}).addTo(map);
Unfortunately, it doesn't work properly. I have the error:
Uncaught TypeError: Cannot read properties of null (reading 'lat')
How can I style these remaining blue points in Leaflet?
.setLatLng(e.latlng)
before you zoom to bounds. i've ran into this error before