Skip to content

Add service layer#12

Merged
stefanschaller merged 10 commits into
mainfrom
add-service-layer
Jun 29, 2026
Merged

Add service layer#12
stefanschaller merged 10 commits into
mainfrom
add-service-layer

Conversation

@stefanschaller

@stefanschaller stefanschaller commented Jun 26, 2026

Copy link
Copy Markdown
Member

Add clustered POI layer support

Adds first-class support for clustered point-of-interest overlays on top of RouteMap, mirroring the declarative style of NoServiceAreaLayer.

Motivation

Consumers (e.g. route-ticket-app) need to render service points and border crossings as clustered, interactive markers. Previously this had to be hand-rolled against the underlying MapLibreMapController. This PR ports that pattern into route_map as a reusable API.

What's new

RouteMapPoiLayer + RouteMapPoiCategory
RouteMap(
  poiLayers: [
    RouteMapPoiLayer(
      identifier: 'poi',
      createSource: () async => GeojsonSourceProperties(data: ...),
      clusterTheme: RouteMapPoiClusterTheme(...),
      categories: [
        RouteMapPoiCategory(
          identifier: 'service-point',
          filter: ['==', ['get', 'type'], 'service'],
          markerPath: pinPath,
          svgIconPath: 'assets/icon.svg',
          theme: RouteMapIconTheme(background: blue, foreground: white),
          interactive: true,
          label: RouteMapPoiCategoryLabel(...),
        ),
      ],
    ),
  ],
  onPoiTapped: (event) => ...,
)

@stefanschaller stefanschaller changed the title Add service layer Draft: Add service layer Jun 26, 2026
Adds RouteMapPoiLayer + RouteMapPoiCategory for clustered, optionally
interactive point-of-interest overlays. Features:

* Declarative API mirroring NoServiceAreaLayer — pass a list of POI
  layers to RouteMap and visibility can be toggled via the controller.
* Categories render as pin-shaped markers matching the visual style of
  regular RouteMapIcons (same markerPath + RouteMapIconTheme).
* Optional clustering with configurable circle + count-text appearance.
* GeoJSON-expression labels with light/dark mode colors.
* Per-feature tap events forwarded via onPoiTapped.

Extracts the pin-marker rasterization logic from RouteMapIconManager
into the reusable rasterizePinMarker helper so both regular icons and
POI categories share the exact same rendering.
Make RouteMapIconTheme.foreground nullable. When null, rasterizePinMarker
keeps the original fill/stroke attributes of the SVG instead of overriding
them — useful for multi-color brand icons. Asserts that foreground is
non-null whenever a RouteMapIcon renders text.
@stefanschaller stefanschaller changed the title Draft: Add service layer Add service layer Jun 26, 2026
Comment thread lib/src/poi_layer_extension.dart
@stefanschaller
stefanschaller merged commit eb294e2 into main Jun 29, 2026
1 check passed
@stefanschaller
stefanschaller deleted the add-service-layer branch June 29, 2026 11:00
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.

2 participants