srhinow/simple-map-bundle

simple maps width pins for Contao CMS based on OSM and Mapbox

Maintainers

Package info

gitlab.com/srhinow/simple-map-bundle

Issues

Type:contao-bundle

pkg:composer/srhinow/simple-map-bundle

Statistics

Installs: 618

Dependents: 0

Suggesters: 0

Stars: 0

5.3.0 2026-04-26 16:43 UTC

README

Create and manage simple interactive maps with markers for Contao CMS. Maps can be embedded via content elements or front end modules. Based on OpenStreetMap (OSM) tile data, optional Mapbox layer API, and Leaflet JavaScript library.

Requirements

  • PHP ^8.3
  • Contao ^5.3

Installation

composer require srhinow/simple-map-bundle

After installation run php bin/console contao:migrate to set up the database tables.

Architecture

Database tables

TablePurpose
tl_simple_mapMap definition — title, address, center coordinates, zoom level, optional Mapbox config
tl_simple_map_pinMarkers (pins) attached to a map — each has its own address, coordinates, popup text, and category
tl_simple_map_categoryOptional categories for grouping markers in category-list views

Back end module

Located under OSM Maps in the Contao back end.

  1. Maps (tl_simple_map) — create a map, enter the center address, and set the zoom level. The bundle resolves coordinates automatically via OpenStreetMap Nominatim.
  2. Categories (tl_simple_map_category) — optional; assign categories to markers for filtered display.

Within a map record, individual markers (tl_simple_map_pin) are managed as child records.

Map settings

FieldDescription
setNewGeoResolve center lat/lon from the address fields via OSM Nominatim
setNewPinAuto-create a marker from the map's own address data
mapLat / mapLonMap center coordinates (stored as DECIMAL(10,8))
mapZoomInitial zoom level (1–18)
do_mapboxEnable Mapbox tile layer instead of OSM
mapboxApiKeyMapbox API key (required if Mapbox is enabled)
mapboxStyleClassic Mapbox style identifier (e.g. mapbox/streets-v12)
leafletCustomScriptOptional Leaflet JS commands (without <script> tags)

Marker settings

FieldDescription
setNewGeoRe-resolve coordinates from the marker's address
mapLat / mapLonMarker position
popupTextHTML text shown in the Leaflet popup
popupOpenOpen the popup immediately on map load
categoryOptional category assignment
publishedControls front end visibility

CSV import

Markers can be bulk-imported via CSV file. Located in the back end under the marker list's CSV import operation.

The import form allows:

  • Selecting an uploaded CSV file
  • Mapping CSV columns to marker fields
  • Running a dry-run test before importing
  • Optionally triggering geocoding for all imported markers

Upload directory: files/csv_imports/ (created automatically on first access).

Content elements and front end modules

TypeDescription
simple_map_viewRenders the Leaflet map with all published markers
simple_map_category_listLists marker data grouped by category (compatible with accordion JS)

Geo resolution

The bundle uses the Nominatim OpenStreetMap API to resolve addresses to coordinates. Geocoding is triggered when:

  • The setNewGeo checkbox is saved in a map or marker record.
  • A new marker is created and has no coordinates yet.
  • The CSV import runs with geocoding enabled.

Running tests

Tests must be run from the main Contao installation:

vendor/bin/phpunit -c vendor/srhinow/simple-map-bundle/phpunit.xml.dist

Or from the bundle root (if vendor/ is present):

vendor/bin/phpunit