Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions assets/js/events_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ function getColorByCategory(category) {
let singleEventPopupLayer = null;

function renderEvents(geojsonData, singleEventGeojsonData) {
// FIX: Remove events with missing/null coordinates
geojsonData.features = geojsonData.features.filter(f => {
return (
f.geometry &&
f.geometry.coordinates &&
f.geometry.coordinates.length === 2 &&
f.geometry.coordinates[0] !== null &&
f.geometry.coordinates[1] !== null
);
});
if (!geojsonData) {
return
}
Expand Down Expand Up @@ -82,6 +92,9 @@ function renderEvents(geojsonData, singleEventGeojsonData) {

const geojsonLayer = L.geoJSON(geojsonData, {
pointToLayer: (feature, latlng) => {
if (!feature.geometry || !feature.geometry.coordinates || feature.geometry.coordinates.includes(null)) {
return; // skip this feature entirely
}
const category = feature.properties.event_category;
const color = getColorByCategory(category);
const marker = L.circleMarker(latlng, {
Expand Down