Skip to content

Commit

Permalink
Always use MarkerCluster to display items (#1799)
Browse files Browse the repository at this point in the history
For a FeatureCollection of mixed geometry types Marker Cluster is able to put all features on the map and make clusters for all Point features
  • Loading branch information
webb-ben authored Aug 23, 2024
1 parent 15be1dc commit 1429a81
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions pygeoapi/templates/collections/edr/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,13 @@
layer.bindPopup(html);
}
});
{% if data.type == "FeatureCollection" and data.features and data.features[0]['geometry']['type'] == 'Point' %}
var markers = L.markerClusterGroup({
disableClusteringAtZoom: 9,
chunkedLoading: true,
chunkInterval: 500,
});
markers.clearLayers().addLayer(items);
map.addLayer(markers);
{% endif %}
map.fitBounds(items.getBounds(), {maxZoom: 15});
{% endif %}
</script>
Expand Down
4 changes: 0 additions & 4 deletions pygeoapi/templates/collections/items/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,13 @@ <h1>{% for l in data['links'] if l.rel == 'collection' %} {{ l['title'] }} {% en
layer.bindPopup(html);
}
});
{% if data['features'][0]['geometry']['type'] == 'Point' %}
var markers = L.markerClusterGroup({
disableClusteringAtZoom: 9,
chunkedLoading: true,
chunkInterval: 500,
});
markers.clearLayers().addLayer(items);
map.addLayer(markers);
{% else %}
map.addLayer(items);
{% endif %}

map.fitBounds(items.getBounds());
</script>
Expand Down

0 comments on commit 1429a81

Please sign in to comment.