Repository navigation
[FEATURE] Add marker clustering for OpenStreetMap - #383
Merged
Merged
Conversation
Implement marker clustering for OpenStreetMap based on the official Leaflet.markercluster plugin. Only point markers are clustered. The coverage polygon on hover is disabled. Move the site setting maps2.enableMarkerClusterer from the Google Maps site set into the maps2 default site set, so it applies to both map providers. The setting key is unchanged, existing site configurations keep working. Add a FlexForm option in tab "Map Options" to enable or disable clustering per content element for both providers. An empty value falls back to the site setting, so maps rendered via the maps2 API without a FlexForm are configured by TypoScript only. Add the TypoScript setting markerClusterer.styleSheet to replace the cluster theme of Leaflet.markercluster with a custom CSS file. It is the OpenStreetMap counterpart of markerClusterer.imagePath. Replace the outdated MarkerClusterer v1 for Google Maps with the official @googlemaps/markerclusterer library, because v1 does not support AdvancedMarkerElement. The cluster images of imagePath are still used. Both libraries are loaded on demand via AssetCollector. Resolves: #169 Related: #377 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #169
Adds marker clustering for OpenStreetMap and makes the existing clustering setting provider-independent. This is an alternative to #377: instead of a separate OSM-only FlexForm setting, the existing site setting is reused, so clustering also works via TypoScript for maps rendered through the maps2 API without a FlexForm.
Changes
Settings
maps2.enableMarkerClustererfrom site setMaps2 - Google MapsintoMaps2 - Default Set. The key is unchanged, existingsettings.yamlfiles keep working. It is now listed under category "Maps2 > Marker Clusterer".settings.markerClusterer.overridein tab "Map Options" for Google Maps and OpenStreetMap: use site setting / TypoScript (default, empty), enabled, disabled. An empty value never overrides TypoScript.plugin.tx_maps2.settings.markerClusterer.styleSheet(OSM only), defaultEXT:maps2/Resources/Public/Css/Leaflet/MarkerCluster.Default.css. AcceptsEXT:andfileadmin/paths and is included as-is via AssetCollector, no build step required. It is the OSM counterpart ofmarkerClusterer.imagePath(GM only).OpenStreetMap
^1.5.3(L.markerClusterGroup). Only point markers are clustered; areas, routes and radius stay on the map directly. No clustering in edit mode.showCoverageOnHoveris disabled.DOMContentLoaded, so the cluster library is available even if only a later plugin on the page enables clustering.Google Maps
AdvancedMarkerElement(marker.getPosition is not a function). The outdated MarkerClusterer v1 is replaced by the official @googlemaps/markerclusterer^2.6.2. A custom renderer keeps using the cluster imagesm1.png–m5.pngofmarkerClusterer.imagePath.LoadAssetsinstead of page-widepage.includeJSFooterlibs, so the FlexForm option also works if clustering is disabled in TypoScript.Build / Docs
build.mjsships both vendor libraries incl. licenses.Tested manually (TYPO3 14.3, ddev)
styleSheetviaEXT:andfileadmin/path is loaded.Open
SettingsHelper::prepareMarkerClusterer().ext_emconf.phpon release.🤖 Generated with Claude Code