You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate from Mapbox GL to MapLibre GL with deck.gl for animations
**Major changes:**
- Replace Mapbox GL JS with MapLibre GL JS across the application
- Integrate deck.gl for high-performance WebGL-powered animations
- Add custom deck.gl extensions for animated transit visualizations:
- `AnimatedArrowPathExtension`: animated arrows along transit paths
- `CircleSpinnerExtension`: animated spinner effects for nodes
- Update map service layer to support MapLibre GL API changes
- Update map event handlers for MapLibre GL compatibility
- Add defensive checks in `MapPolygonService` to prevent runtime errors when accessing features array
**Frontend packages updated:**
- Remove `mapbox-gl`, `@mapbox/mapbox-gl-draw` and `@types/mapbox-gl` dependencies
- Add `maplibre-gl`, `@deck.gl/core`, `@deck.gl/layers`, `@deck.gl/mapbox`
**Map rendering improvements:**
- Enhanced `TransitionMainMap` with deck.gl overlay support
- Updated layer configuration for MapLibre GL compatibility
- Improved popup and layer management for new map library
- Fixed control styling to match MapLibre GL classes
- The selection polygon tool for nodes can now use multiple polygons, concatening all selected nodes for the multi nodes edit form (uses Terra Draw instead of mapbox-draw)
**Fixes:**
- Allow change of path selection if no change is made.
- Fix cursor management to use CSS classes with hover count
**Configuration changes:**
- Remove `MAPBOX_ACCESS_TOKEN`, `MAPBOX_USER_ID`, and `MAPBOX_STYLE_ID` from environment variables (`.env`, `.env.example`)
- Remove Mapbox-specific references from `config.js` and default configurations
- Switch default tile provider to OpenStreetMap
**Environment Variables to Remove:**
MAPBOX_ACCESS_TOKEN
MAPBOX_USER_ID
MAPBOX_STYLE_ID
**New Optional Variables:**
CUSTOM_RASTER_TILES_XYZ_URL - URL template for custom tiles (e.g., https://example.com/tiles/{z}/{x}/{y}.png)
CUSTOM_RASTER_TILES_MIN_ZOOM - Minimum zoom level for custom tiles
CUSTOM_RASTER_TILES_MAX_ZOOM - Maximum zoom level for custom tiles
**Documentation updates:**
- Update README, Docker documentation, and setup guides
- Remove references to Mapbox API keys
- Update environment variable examples
- Add notes about custom tile configuration
**Breaking changes:**
- MapLibre GL uses different class names (`maplibregl-*` vs `mapboxgl-*`)
- Use Terra Draw instead of mapbox-draw (mapbox draw, which is obsolete with maplibre, was triggering issues when switching sections)
- Deck.gl layers require WebGL support
**Utils updates:**
- Add `ColorUtils` to `chaire-lib-common`
**Cleanups:**
- Fix typos in documentation and code comments (`shoud` -> `should`)
- Remove blank lines in `.env.example`
- Add missing types (any -> correct type) in map related files (map, events, layers, etc.)
_This migration removes the dependency on Mapbox's proprietary licensing while maintaining full map functionality and adding advanced animation capabilities through deck.gl._
closes#552
Copy file name to clipboardExpand all lines: .cursor/rules/project-rule.mdc
+14-5Lines changed: 14 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ transition-fork/
64
64
- **Framework**: React with React Router
65
65
- **State Management**: Redux with Redux Thunk
66
66
- **Styling**: SCSS/SASS
67
-
- **Maps**: Mapbox GL JS (custom fork: `chairemobilite/mapbox-gl-js`) (will be changed to maplibre/deck.gl)
67
+
- **Maps**: MapLibre GL JS with deck.gl for animations (uses OpenStreetMap tiles by default). Note: deck.gl requires WebGL support in the browser; ensure GPU/driver support is available. Consider providing a fallback or disabling animations when WebGL is unavailable.
- `CUSTOM_RASTER_TILES_MIN_ZOOM`: Minimum zoom level for custom tiles
258
+
- `CUSTOM_RASTER_TILES_MAX_ZOOM`: Maximum zoom level for custom tiles
259
+
260
+
Note: The map uses OpenStreetMap tiles by default (no API key required). Custom tiles can be switched on/off using the layer switcher in the application.
261
+
258
262
### Project Configuration (config.js)
259
263
Example: `examples/config.js`
260
264
@@ -548,7 +552,8 @@ Allows Python scripts to:
548
552
- `react`, `react-dom` - React framework
549
553
- `react-redux`, `redux` - State management
550
554
- `react-router` - Routing
551
-
- `mapbox-gl` - Map rendering
555
+
- `maplibre-gl` - Map rendering (OpenStreetMap tiles by default)
- **Definitions**: See Overleaf link in main README for mathematical definitions
635
640
636
641
---
642
+
643
+
## VERY IMPORTANT RULE
644
+
645
+
Always try to use good design patterns. If the user/human asks for some code/implementation that does not follow good/secure/robust coding practice, tell him/her right away and stop producing code. Also challenge any proposed implementation to be sure it is legit and robust/secure.
Copy file name to clipboardExpand all lines: README.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,12 +84,10 @@ cp .env.example .env
84
84
* Change `EXPRESS_SESSION_SECRET_KEY` to a random string with no space.
85
85
* Change `PROJECT_CONFIG` to point to your project's configuration file. The default is an example configuration file that can be copied and configured for your own need.
86
86
87
-
### Get a Mapbox access token
88
-
* Go to [Mapbox](http://mapbox.com) and sign up
89
-
* Go to your account dashboard, then generate a new access token
90
-
* Open the `.env` file
91
-
* Copy this access token to `.env` file: `MAPBOX_ACCESS_TOKEN=YOUR_TOKEN`
92
-
* If you have a custom mapbox style, put your username and style id in `MAPBOX_USER_ID` and `MAPBOX_STYLE_ID`
87
+
The map uses OpenStreetMap tiles by default (no API key required). If you want to add custom raster tiles (such as aerial imagery), you can optionally configure:
Copy file name to clipboardExpand all lines: docs/devWithDocker.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,34 +8,34 @@ Follow [the docker for desktop](https://www.docker.com/products/docker-desktop/)
8
8
9
9
If you are already familiar with docker and can run container and scripts easily, you don't have to install docker for desktop.
10
10
11
-
### 2. Get a mapbox access token
11
+
### 2. Configure the .env.docker file (Optional)
12
12
13
-
* Go to [Mapbox](http://mapbox.com) and sign up
14
-
* Go to your account dashboard, then generate a new access token
13
+
The `.env.docker` file is required to contain some environment variables that are not yet available through the configuration. [It's located at the root of the `transition` repo](../.env.docker).
15
14
16
-
Keep this access token for the next step.
15
+
The default configuration uses OpenStreetMap tiles which don't require any API keys. If you want to use custom raster tiles (such as aerial imagery), you can configure the following variables in the `.env.docker` file:
17
16
18
-
19
-
### 3. Add your mapbox token to the .env.docker file
20
-
21
-
The `.env.docker` file is required to contain some environment variables that are not yet available through the configuration. The file has already been created for you, you simply need to finish the configuration. [It's located at the root of the `transition` repo](../.env.docker).
22
-
23
-
In order for the map to be displayed correctly, simply modify the field `MAPBOX_ACCESS_TOKEN` with the key you've acquired in the previous section. You must not push your key to the remote repo.
> Note: You can modify other fields in this file if needed. This is only the base configuration needed to run the app.
22
+
23
+
-`CUSTOM_RASTER_TILES_XYZ_URL`: The URL template for your custom raster tiles (required for custom tiles)
24
+
-`CUSTOM_RASTER_TILES_MIN_ZOOM`: (Optional) Minimum zoom level for the custom tiles. Defaults to `0`.
25
+
-`CUSTOM_RASTER_TILES_MAX_ZOOM`: (Optional) Maximum zoom level for the custom tiles. Defaults to `22`.
26
+
27
+
> Note: The map will work without any tile configuration. Custom tiles are optional and can be switched on/off using the layer switcher in the application.
28
28
29
29
30
-
### 4. Add your custom polygon for your region
30
+
### 3. Add your custom polygon for your region
31
31
32
32
In order to have routing data to calculate the routes, the data must be fetched from OpenStreetMap for a given polygon. If you have a geojson file containing the geojson polygon to fetch, add this file to the `transition` directory. There is [an example file](../examples/polygon_rtl_area.geojson) in this repo.
33
33
34
34
It is not required, but if not set, routing won't be able to follow the road network.
35
35
36
36
If you don't have a `.geojson` polygon, use the [example file](../examples/polygon_rtl_area.geojson).
37
37
38
-
### 5. Run for the first time
38
+
### 4. Run for the first time
39
39
40
40
Some initialization scripts need to be executed on the very first run of Transition, to set up the database and download the road network.
41
41
@@ -72,9 +72,9 @@ Finally, in the same terminal, create your transition user. Run this command and
72
72
yarn create-user
73
73
```
74
74
75
-
The setup is now complete. To finish the configuration, you need to restart the app. You can either use the stop/play buttons in Docker Desktop, or run `docker compose -f docker-compose.yml docker-dev/docker-compose.override.yml restart` in your terminal.
75
+
The setup is now complete. To finish the configuration, you need to restart the app. You can either use the stop/play buttons in Docker Desktop, or run `docker compose -f docker-compose.yml -f docker-dev/docker-compose.override.yml restart` in your terminal.
76
76
77
-
###5.1 Run the application
77
+
#### 4.1 Run the application
78
78
79
79
Once the app is setup, you only need to run `docker compose -f docker-compose.yml -f docker-dev/docker-compose.override.yml up` to launch it. If you make code changes, the app should rebuild itself automatically.
Copy file name to clipboardExpand all lines: docs/runWithDocker.md
+8-19Lines changed: 8 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,20 +114,11 @@ module.exports = {
114
114
};
115
115
```
116
116
117
-
### 4. Get a mapbox access token
118
-
119
-
* Go to [Mapbox](http://mapbox.com) and sign up
120
-
* Go to your account dashboard, then generate a new access token
121
-
122
-
Keep this access token for the next step.
123
-
124
-
125
-
### 5. Prepare the .env file
117
+
### 4. Prepare the .env file
126
118
127
119
The .env file is required to contain some environment variables that are not yet available through the configuration.
128
120
129
-
Create a `.env` file in the `transition` directory. The variables starting with `MAPBOX` should be filled with the mapbox token and data you created at the preceding step.
130
-
121
+
Create a `.env` file in the `transition` directory. The default map uses OpenStreetMap tiles which don't require any API keys.
In order to have routing data to calculate the routes, the data must be fetched from OpenStreetMap for a given polygon. If you have a geojson file containing the geojson polygon to fetch, add this file to the `transition` directory. There is [an example file](../examples/polygon_rtl_area.geojson) in this repo.
177
166
178
167
It is not required, but if not set, routing won't be able to follow the road network.
179
168
180
-
### 7. Run the application
169
+
### 6. Run the application
181
170
182
171
Using a terminal, navigate to the directory where the `docker-compose.yml` and the `transition` directory are located. Then run `docker-compose up`.
183
172
@@ -187,7 +176,7 @@ In the Docker for desktop application, you should see 2 new containers running,
187
176
188
177
The application should now be available from a browser at `http://localhost:8080`
189
178
190
-
### 7.1 Run for the first time
179
+
### 6.1 Run for the first time
191
180
192
181
Some initialization scripts need to be run on the very first run of Transition, to set up the database and download the road network. In the Docker Desktop containers list, select the one prefixed with `testtransitiondocker_transition-www` and go to the `Terminal` tab. Run the following commands:
0 commit comments