Skip to content

Remove mapbox.js and old raster map implementation - #2473

Merged
MartinaeyNL merged 14 commits into
masterfrom
remove-mapbox.js
Feb 4, 2026
Merged

MartinaeyNL merged 14 commits into
masterfrom
remove-mapbox.js

Conversation

@Ekhorn

@Ekhorn Ekhorn commented Jan 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR removes the mapbox.js dependency and references to the old raster map implementation as we don't intend on using or supporting it anymore. You can still use raster maps through MapLibre.

Some of the code in the or-map component namely in mapwidget.ts has also been refactored, so it's easier to maintain.

Changelog

  • Removes the mapbox.js dependency
  • Removes the @types/mapbox dev dependency
  • Removes /api/manager/map/getSettingsJs endpoint
  • Removes MapType and any references to Raster maps
  • Refactors mapwidget.ts code

Checklist

@Ekhorn Ekhorn self-assigned this Jan 28, 2026
@Ekhorn
Ekhorn marked this pull request as ready for review January 29, 2026 09:01
@Ekhorn
Ekhorn requested a review from a team January 29, 2026 09:01

@MartinaeyNL MartinaeyNL left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! No comments from my end.

Let's double check with the others if it's OK to remove the Raster implementation in the HTTP API / backend as well.

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

Removes the legacy mapbox.js/raster-map path and associated backend API/config, consolidating map rendering on MapLibre and refactoring the or-map MapWidget accordingly.

Changes:

  • Drops mapbox.js + @types/mapbox dependencies and related bundler/knip configuration.
  • Removes the /api/.../map/js (getSettingsJs) endpoint and the MapType/mapType configuration.
  • Refactors ui/component/or-map/src/mapwidget.ts to a single MapLibre-based implementation.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
yarn.lock Removes mapbox.js transitive packages (Leaflet, mustache, etc.).
ui/util/webpack.util.js Updates CSS handling regex to drop mapbox-specific matching.
ui/knip.jsonc Removes @types/mapbox from ignored dependencies.
ui/component/or-map/src/util/index.ts Removes Leaflet bounds helper used by the old raster implementation.
ui/component/or-map/src/style.ts Removes mapbox/leaflet-specific selectors tied to the deprecated implementation.
ui/component/or-map/src/mapwidget.ts Removes raster/mapbox.js code paths; refactors to a single MapLibre map implementation.
ui/component/or-map/src/index.ts Removes type: MapType usage and updates MapWidget construction accordingly.
ui/component/or-map/rspack.config.js Removes mapbox.js vendor/global binding configuration.
ui/component/or-map/package.json Removes mapbox.js and @types/mapbox dependencies.
ui/component/or-map/README.md Updates component description from Mapbox to MapLibre.
ui/component/core/src/index.ts Removes manager.mapType accessor (no longer backed by config).
ui/app/storybook/rsbuild.config.ts Updates CSS handling regex to drop mapbox-specific matching.
model/src/main/java/org/openremote/model/map/MapResource.java Removes getSettingsJs endpoint and updates MapLibre naming in docs/operation summaries.
model/src/main/java/org/openremote/model/manager/MapType.java Removes the MapType enum entirely.
model/src/main/java/org/openremote/model/manager/ManagerConfig.java Removes mapType field from manager configuration model.
manager/src/main/java/org/openremote/manager/map/MapService.java Removes getMapSettingsJs implementation.
manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java Removes getSettingsJs endpoint implementation.
Comments suppressed due to low confidence (1)

ui/component/or-map/src/mapwidget.ts:15

  • maplibre-gl is imported at module scope (runtime) and also dynamically imported in build() (await import('maplibre-gl')). The static import will pull the library into the initial bundle, which defeats the purpose of code-splitting and can lead to confusion about which module instance to use. Either remove the dynamic import and use the static import throughout, or convert the top-level import to type-only imports and use the dynamically imported module for runtime usage (including the geocoder).
import manager, { DefaultColor4 } from "@openremote/core";
import maplibregl, {
    AddLayerObject,
    IControl,
    GeolocateControl,
    LngLat,
    LngLatLike,
    Map as MapGL,
    MapOptions,
    MapMouseEvent,
    Marker,
    NavigationControl,
    StyleSpecification,
    GeoJSONSourceSpecification,
} from "maplibre-gl";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/style.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved

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

Copilot reviewed 16 out of 17 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (2)

manager/src/main/java/org/openremote/manager/map/MapService.java:387

  • mapSettingsJs cache is still declared but getMapSettingsJs() was removed, so this map is now unused and will never be cleared/populated meaningfully. Remove the unused field to avoid confusion and dead state.
    /**
     * Dynamically build MapLibre GL settings based on mapsettings.json
     */
    public ObjectNode getMapSettings(String realm, URI host) {
        String realmUriKey = realm + host.toString();
        if (mapSettings.containsKey(realmUriKey)) {
            return mapSettings.get(realmUriKey);
        }

ui/component/or-map/src/mapwidget.ts:674

  • marker._element is an internal/non-public property of MapLibre's Marker and may change across versions (and may not be in typings). Use the public marker.getElement() API and cast/check that element against OrClusterMarker instead.
        for (const id in this._markersOnScreen) {
            const marker = newMarkers[id];
            if (!marker
              || marker._element instanceof OrClusterMarker && !marker._element.hasTypes(Object.keys(this._assetTypeColors))
            ) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/src/mapwidget.ts Resolved
Comment thread ui/component/or-map/README.md Resolved
@Ekhorn
Ekhorn requested a review from MartinaeyNL February 4, 2026 11:35

@MartinaeyNL MartinaeyNL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@MartinaeyNL
MartinaeyNL enabled auto-merge (squash) February 4, 2026 15:12
@MartinaeyNL
MartinaeyNL merged commit e171339 into master Feb 4, 2026
1 of 2 checks passed
@MartinaeyNL
MartinaeyNL deleted the remove-mapbox.js branch February 4, 2026 16:21
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.

Remove (mapbox.js) raster map implementation

3 participants