Skip to content

Support Vector Tiles (via Mapbox Style JSONs)#1748

Merged
Phocacius merged 33 commits into
developfrom
work/datasource-vectortiles
Jul 28, 2025
Merged

Support Vector Tiles (via Mapbox Style JSONs)#1748
Phocacius merged 33 commits into
developfrom
work/datasource-vectortiles

Conversation

@Phocacius

Copy link
Copy Markdown
Member

This PR enables a new data source to be used: Vector Tiles using the Mapbox Style JSON Specification.

Preconditions

  • checkout New data source vector tiles mapbender-starter#155 and run composer install (or manually enable the VectorTilesBundle and run composer update, the mapbender/openlayers6-es5 needs to be present in version >= 10.6.1.2)
  • create new database tables for vector tiles: bin/console doctrine:schema:update --force

Things that work

  • Embedding in db or yaml applications
  • Usage in overview
  • Rotating while keeping labels correctly aligned (using Alt+Shift+Mouse)
  • Feature Info

Things that don't work (yet)

  • Legend
  • Print

Other changes

  • Refactored mapbender.source.js into separate files for each class
  • Refactored feature info handling: All sources now return a promise and the feature info handling is done directly in the source class instead of in the featureinfo element
  • Fix keyboard navigation in scale selector
  • Fix keyboard navigation in feature info tabs/accordion
  • Add "unsupported projection" as error type in layertree

Usage (GUI)

  • Add a new data source in the corresponding manager page:
grafik

Usage (YAML):

Use the following sample yaml application and adapt to your needs:

parameters:
    applications:
        vectortiles_yaml:
            title: Vectortiles Demo YAML
            published: true
            template:  Mapbender\CoreBundle\Template\Fullscreen
            layersets:
                themes:
                    selected: true
                    mapbender_users:
                        type: wms
                        title: Mapbender Users
                        url: https://wms.wheregroup.com/cgi-bin/mapbender_user.xml
                        version: 1.3.0
                        toggle: true
                        layers:
                            4: { name: Mapbender_User,    title : User, visible: true, legendurl: https://wms.wheregroup.com/cgi-bin/mapbender_user.xml?version=1.3.0&service=WMS&request=GetLegendGraphic&sld_version=1.1.0&layer=Mapbender_User&format=image/png&STYLE=default }
                            5: { name: Mapbender_Names,   title : Name, visible: true, queryable: true}
                background themes:
                    selected: true
                    basemap_vector:
                        type: vector_tiles
                        title: Basemap VT
                        jsonUrl: https://sgx.geodatenzentrum.de/gdz_basemapde_vektor/styles/bm_web_col.json
                        # jsonUrl: https://wms.wheregroup.com/tileserver/style/osm-bright.json
                        ## All configuration from here onwards is optional
                        isBaseSource: true
                        allowSelected: true
                        # bbox: [7.6,47.9,7.8,48.1]
                        selected: true
                        opacity: 100
                        minScale: 0
                        maxScale: 50000000
                        featureInfo: true
                        featureInfoAllowToggle: false
                        featureInfoTitle: ${name} (${klasse})
                        hideIfNoTitle: true
                        propertyMap:
                          - klasse
                          - name
                          - mvt:layer: Layername
            elements:
                content:
                    map:
                        class: Mapbender\CoreBundle\Element\Map
                        layersets: [themes,background themes]
                        srs: EPSG:3857
                        extents:
                            # Freiburg
                            start: [866322.89,6102554.89,881937.85,6112331.21]
                            max: [-20037508.34278924,-20037508.34278924,20037508.34278924,20037508.34278924]
                        scales: [50000000,25000000,10000000,5000000,1000000,500000,100000,50000,25000,10000,7500,5000,2500,1000,500]
                        otherSrs: ["EPSG:25832","EPSG:25833","EPSG:31466","EPSG:31467","EPSG:3857"]
                    zoombar:
                        class: Mapbender\CoreBundle\Element\ZoomBar
                        target: map
                        anchor: right-top
                        draggable: false
                    scalebar:
                        class: Mapbender\CoreBundle\Element\ScaleBar
                        target: map
                        anchor: 'right-bottom'
                        maxWidth: 200
                        units: km
                        screenType: desktop
                    scaledisplay:
                        class: Mapbender\CoreBundle\Element\ScaleDisplay
                        target: map
                        anchor: right-top
                        scalePrefix: Scale
                        unitPrefix: true
                        screenType: desktop
                    featureinfo:
                        class: Mapbender\CoreBundle\Element\FeatureInfo
                        target: map
                        screenType: desktop
                        autoOpen: true
                        deactivateOnClose: false
                        highlighting: true
                sidepane:
                    layertree:
                        class: Mapbender\CoreBundle\Element\Layertree
                        target: map
                        type: element
                        autoOpen: false
                        showBaseSource: true
                        layerRemove: true
                        menu: [opacity,zoomtolayer,metadata,layerremove,select_style]
                        hideNotToggleable: true
                        hideSelect: true
                        hideInfo: false
                        useTheme: false
                footer:
                    activityindicator:
                        class: Mapbender\CoreBundle\Element\ActivityIndicator
                        screenType: desktop
                    coordinates:
                        class: Mapbender\CoreBundle\Element\CoordinatesDisplay
                        target: map
                        label: false
                        empty:  "x: - y: -"
                        prefix: "x: "
                        separator:  " y: "
                        numDigits: 2
                        screenType: desktop
                    scaleselector:
                        class: Mapbender\CoreBundle\Element\ScaleSelector
                        target: map
                        screenType: desktop
                    srs:
                        class: Mapbender\CoreBundle\Element\SrsSelector
                        target: map
                        screenType: desktop

Phocacius added 26 commits July 16, 2025 14:56
…nfo behaviour into common base class for WMS/WMTS (WIP),

make feature info behaviour more generic (WIP)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive support for Vector Tiles as a new data source using Mapbox Style JSON specifications. The feature enables rendering of vector tile layers directly in Mapbender with full integration into the layertree, feature info functionality, and YAML configuration support.

Key changes include:

  • Implementation of a complete Vector Tiles bundle with source/instance entities, form types, and frontend JavaScript classes
  • Refactoring of the feature info system to use promises and handle source-specific implementations
  • Enhanced accessibility features including keyboard navigation for scale selector and feature info tabs
  • Addition of projection support validation for layers

Reviewed Changes

Copilot reviewed 74 out of 74 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/Mapbender/VectorTilesBundle/ Complete new bundle implementing vector tiles support with entities, forms, loaders, and configuration
src/Mapbender/CoreBundle/Resources/public/mapbender.element.featureInfo.js Refactored to use promise-based feature info loading from sources
src/Mapbender/CoreBundle/Resources/public/mapbender-model/ Split monolithic source.js into separate files and added GetFeatureInfoSource base class
src/Mapbender/WmsBundle/Resources/public/mapbender.geosource.wms.js Updated to extend GetFeatureInfoSource and removed duplicate scale checking logic
src/Mapbender/ManagerBundle/Component/ImportHandler.php Enhanced import handling to support different source types via factory pattern

Comment thread src/Mapbender/CoreBundle/Resources/public/sass/element/button.scss
Comment thread src/Mapbender/CoreBundle/Resources/translations/messages.ru.yaml Outdated
Comment thread src/Mapbender/VectorTilesBundle/Resources/public/geosource.vectortiles.source.js Outdated
Comment thread src/Mapbender/ManagerBundle/Form/DataTransformer/YAMLDataTransformer.php Outdated
Comment thread src/Mapbender/VectorTilesBundle/Component/VectorTilesConfigGenerator.php Outdated
@Phocacius Phocacius added this to the 4.2 milestone Jul 16, 2025

@swinkelmann swinkelmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing to complain about. 🥇

@Phocacius Phocacius merged commit 234b43e into develop Jul 28, 2025
@Phocacius Phocacius deleted the work/datasource-vectortiles branch July 28, 2025 11:23
@astroidex astroidex mentioned this pull request Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants