定制 srhinow/simple-map-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

srhinow/simple-map-bundle

最新稳定版本:5.4.0

Composer 安装命令:

composer require srhinow/simple-map-bundle

包简介

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

README 文档

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

统计信息

  • 总下载量: 638
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2020-02-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固