ICT:Drupal Leaflet initial centering setting
Setting a Default Center and Zoom for the Leaflet Widget (Drupal 11)
Overview
When using the Leaflet widget in Manage form display (e.g., for a PLACE content type), the map may open centered on latitude 0, longitude 0 (the Gulf of Guinea). This happens when no default coordinates are configured.
Drupal 11 no longer provides global Leaflet map presets, so the correct place to set the initial map center and zoom is inside the widget settings of the geolocation field.
This page documents how to configure a stable, Belgium‑centered default view.
Steps
- Navigate to:
Structure → Content types → PLACE → Manage form display
- Locate the geolocation field that uses the Leaflet widget.
- Click the ⚙️ Settings icon next to the widget.
- In the widget configuration dialog, set:
* Default latitude:50.85* Default longitude:4.35* Default zoom:8
- Save the widget settings.
- Save the form display.
Recommended Values
The following coordinates provide a balanced, country‑level view of Belgium:
| Setting | Value | Notes |
|---|---|---|
| Default latitude | 50.85 |
Centers on Brussels |
| Default longitude | 4.35 |
Suitable for whole‑Belgium view |
| Default zoom | 8 |
Shows Belgium clearly without zooming too far in |
Result
When creating or editing PLACE content, the Leaflet widget will now open centered on Belgium instead of the default (0,0). This improves usability and provides a predictable, historian‑friendly starting point.
Notes
- These settings apply only to the form widget, not to Leaflet maps used in Views.
- If the field already contains coordinates, the widget will center on the stored value instead.
- No custom code or map presets are required for this solution.