Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2025-01-23 #163

Open
wants to merge 111 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
1a16baf
Docs: Extend readme on when to docker compose build
tordans Jan 8, 2025
51e85a8
Processing: Remove deprecated `category=livingStreet`
tordans Jan 8, 2025
70f3437
Processing: Fix eTag condition when file was missing
tordans Jan 8, 2025
aee4292
Map: Update style to show border
tordans Jan 9, 2025
72751e3
BikelaneTodos: Fix type in key
tordans Jan 9, 2025
c7bb3da
Processing: Remove unused `SKIP_TAG_FILTER`
tordans Jan 9, 2025
238e36f
Processging: Run filter if filter file missing
tordans Jan 9, 2025
33964a0
Processing: Create todo tables for way geometries
tordans Jan 9, 2025
a208032
Processing: Move params.skipDownload into helper function
tordans Jan 9, 2025
9022314
Processing: Refactor download to use wget
tordans Jan 9, 2025
a69d6c8
Processing: Refactor steps to inline `params.*`
tordans Jan 9, 2025
dc2d989
Processing: Move `idFilter` conditions inside helper
tordans Jan 10, 2025
f874250
Processing: Improve logging
tordans Jan 10, 2025
2500693
Processing: Reformatting
tordans Jan 10, 2025
fae66b7
Processing: Add missing `jsonb_diff` function; Rename to "initialize"
tordans Jan 10, 2025
486ad20
Processing: Move `topicList` inside helper function
tordans Jan 10, 2025
a1c6324
Processing: Improve internal api trigger for DEV
tordans Jan 10, 2025
e9108bc
Processing: Improve free data documentation; Refactoring
tordans Jan 10, 2025
f5829f5
Processing: Topics: Refactor to use Guard; Improve logging
tordans Jan 10, 2025
6e3ea82
Processing: Topics: Refactor Comments, Code; Improve Logging
tordans Jan 10, 2025
2f6ba1d
Processing: Types: Formatting and Guard
tordans Jan 10, 2025
f562f90
Processing: Rename roads todo; remove duplicate bikelanes todo
tordans Jan 10, 2025
81d125f
Processing: Todos: Make road/bikelane ids unique
tordans Jan 10, 2025
0f8c215
Mapbox: Update links to studio
tordans Jan 10, 2025
9c0494e
Sources: Add `todos_lines`
tordans Jan 10, 2025
47c4404
Styles: Add style package for radinfra
tordans Jan 10, 2025
4e4e33f
Processing: Todos: Improve id
tordans Jan 10, 2025
0e27362
Script MapboxTilesets: Improve error handling
tordans Jan 10, 2025
5719fa6
Processing: Todos: Don't use `true`<boolean> as values
tordans Jan 10, 2025
e8d6d10
Processing: Try using luarocks `inspect.lua`; Add our own helper as w…
tordans Jan 10, 2025
fde3a82
Export: Fix where missing keys caused a mixup of values
tordans Jan 10, 2025
4603a67
Processing: Todos: Rework to add priority (always "1" for now)
tordans Jan 10, 2025
aeb1c5c
Imprint: remove twitter link, update wording
JohannaPeanut Jan 23, 2025
f7ba018
Link: remove unused twitter icon
JohannaPeanut Jan 23, 2025
49cd64d
Export: Refactor export function
tordans Jan 11, 2025
64650c2
Export: Experiment with export by ogr2gor
tordans Jan 23, 2025
a884365
Processing: Increase waitForFreshData to 5 h
tordans Jan 22, 2025
526f051
Processing: Improve error logging
tordans Jan 22, 2025
a89879b
Processing: Refactor type generation
tordans Jan 22, 2025
17210be
Processing: Add type generation for bikelaneTodos and roadTodos
tordans Jan 22, 2025
cccee14
Style: Fix apiUrl; Change prefix
tordans Jan 10, 2025
5d74295
Map: Extract MapDataCategoryId
tordans Jan 11, 2025
81e6781
Processing: Rework/Add BikelaneTodos for infrastructure
tordans Jan 22, 2025
c495bc6
Processing: Todos: Add `todos` property for frontend
tordans Jan 22, 2025
201534a
Processing: Todos: Improve conditions
tordans Jan 23, 2025
0bd621b
MapRoulette: Refactor API and Inspector
tordans Jan 23, 2025
315e190
Processing: Fix `id` for todo_lines
tordans Jan 23, 2025
98e24d7
Radinfra: Add categories, styles
tordans Jan 23, 2025
aa90a09
MapRoulette: Introduce title in Subcategory and Inspector
tordans Jan 23, 2025
23ee988
Processing: Todos: Fix `todo` reference
tordans Jan 24, 2025
7acd44c
Processing: Todos: Fix unit tests
tordans Jan 24, 2025
60461f3
Export: ogr2gor: Change to use `GEO_DATABASE_URL`
tordans Jan 24, 2025
432269e
Export: Fix invalid export identifier
tordans Jan 24, 2025
e4f8e2c
Trigger build
tordans Jan 24, 2025
b4dcecb
Export: Fix Gdal on server by updating Debian to "bookworm"
tordans Jan 24, 2025
33b1fdd
Local production build: Add app/.env.production
tordans Jan 24, 2025
b97691b
Export: Improve casting conditions
tordans Jan 24, 2025
190de8a
Export: Improve logging
tordans Jan 24, 2025
6de5707
Export: Reduce precision; document missing "remove null" feature
tordans Jan 24, 2025
3cc4bf4
Docker: Add logging to journald to all
tordans Jan 24, 2025
488d46e
Docker: Give local docker container a name
tordans Jan 24, 2025
4ae71ff
Docker: Improve cleanup
tordans Jan 24, 2025
6a4e803
Documentation update
tordans Jan 24, 2025
f428dd9
Kampagnen: Fix react `key`
tordans Jan 24, 2025
5507378
Style: Mapillary: Sort lines and circles based on age and type
tordans Jan 24, 2025
8e9ad93
Inspector: Add missing PBL translation
tordans Jan 24, 2025
544292b
Radinfra: Update styles; Add Mapillary highlight plus layer
tordans Jan 26, 2025
2aa36e8
Fix husky by moving it back into /app
tordans Jan 30, 2025
063e95c
Campaigns: Add Maproulette API Proxy
tordans Jan 31, 2025
aef2a9b
Campaign: Rename test api endpoints
tordans Jan 31, 2025
12f618c
Campaign: Add test api endpoint to test how MR behaves with external …
tordans Jan 31, 2025
21cfa64
Campaigns: Remove campaigns and use priority instead
tordans Jan 31, 2025
72b19e9
Campaigns: Refactor condition
tordans Jan 31, 2025
1354875
Campaigns: Exclude existing campaign from `needsClarification`
tordans Jan 31, 2025
4818073
Campaigns: Update link to "radinfra"
tordans Jan 31, 2025
72bef73
Campaign: Add 'missing_access_tag_240' task description
tordans Jan 31, 2025
61cf9fd
Campaign: Improve 'needsClarification' task description
tordans Jan 31, 2025
359a397
Campaign: Add 'missing_segregated' task description
tordans Jan 31, 2025
9fdb18e
Export: Change attribution to domain
tordans Jan 31, 2025
d164a2d
Move RenderIfNotDoNotNavigate into layout folder
tordans Jan 31, 2025
3d0648f
Scripts: Streamline intro warning comment
tordans Jan 31, 2025
5faeeb5
Scripts: Apply streamlined intro warning comment
tordans Jan 31, 2025
0053933
Instrumentation: Move functions into /instrumentation folder
tordans Jan 31, 2025
63d475c
Campaigns: Introduce `cacheRadinfraDeCampaigns` during instrumentation
tordans Jan 31, 2025
58beca7
Campaigns: Fetch the campaign titles from radinfra-de data
tordans Jan 31, 2025
8833d7e
Campaigns: Rename todos to use snake_case
tordans Jan 31, 2025
6e87391
Campaigns: Allow for additional todoIds; Rename files to signal that …
tordans Jan 31, 2025
5e4f068
Campaigns: Update radinfra campaign data; Sort A-Z by ID to improve d…
tordans Jan 31, 2025
2f60f50
Campaign: Add `currentness_too_old`; Modify `bikelanes._age`
tordans Jan 31, 2025
705d5c1
Map: Add categories to style dropdown
tordans Jan 31, 2025
3acefb6
Packages: Remove popperjs
tordans Jan 31, 2025
a45d9e8
MapRoulette API: Remove region relation id param
tordans Feb 1, 2025
dd0033b
MapRoulette API: Return JSON, not a download
tordans Feb 1, 2025
50930d9
Campaigns: Rework `todo_lines` table
tordans Feb 1, 2025
72b7890
MapRoulette API: Use `todos_lines` table; apply simplification; add `…
tordans Feb 1, 2025
b883e1d
Campaigns: Rework LUA todos to add `todoTableOnly`; Update type gener…
tordans Feb 2, 2025
b08abd5
Campaigns: Guard "currentness_too_old" when running tests
tordans Feb 2, 2025
b260fb6
Campaigns: Add missing_width, missing_surface
tordans Feb 2, 2025
9262514
Campaign: Fix `test_maproulette_updates` after recent refactorings
tordans Feb 5, 2025
face46c
Radinfra styles: Update Campaign Styles
tordans Feb 2, 2025
2d5b592
Radinfra: Update URL config and list of campaigns in Map
tordans Feb 2, 2025
66fedcc
Remove console.log
tordans Feb 2, 2025
dd0aeff
Processing: Remove unused custom Inspect helper
tordans Feb 2, 2025
bcf3309
Processing: Autoformatting
tordans Feb 2, 2025
0c2fb07
Processing: Log date of file that is being processed
tordans Feb 3, 2025
5ff4d62
Tippecanoe: Move code commens
tordans Feb 4, 2025
ea2ba57
Tippecanoe: Use minimum-zoom=7
tordans Feb 4, 2025
6dca01b
Tippecanoe: Apply additional flags for precision
tordans Feb 4, 2025
7f0aaae
Tippecanoe: Add notes for future improvements
tordans Feb 4, 2025
10c1a63
Static Data: Fix typo in folder name
tordans Feb 5, 2025
e5be897
Static Data: Add reminder to `deleteAllStaticDatasets`
tordans Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ DATABASE_PORT=5432
OSM_DOWNLOAD_URL=https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
SKIP_DOWNLOAD=1 # skips the download if a file already exists
SKIP_UNCHANGED=1 # skips processing of unchanged code
SKIP_TAG_FILTER=0 # skips tag filtering
SKIP_WARM_CACHE=1 # skips cache warming
WAIT_FOR_FRESH_DATA=0 # waits till the given file is from today
ID_FILTER='' # if not empty only the objects with these ids are processed. Ids need to be prefixed with the oms_type, see https://docs.osmcode.org/osmium/latest/osmium-getid.html
COMPUTE_DIFFS=1 # whether to create diff tables or not
FREEZE_DATA=0 # whether to surpress updating the tables. Works only in combination with `COMPUTE_DIFFS=1`. `0` creates a new reference point, `1` uses the last reference point to diff against.
FREEZE_DATA=0 # whether to surpress updating the tables. Works only in combination with `COMPUTE_DIFFS=1`. `0` creates a new reference point, `1` uses the last reference point to diff against. With `1` the current run diffs against some older run, with `0` the current run diffs against the last run. See [processing/README](./processing/README.md#reference)

# Token for Synology log. Leave blank to disable logging
SYNOLOGY_LOG_TOKEN=
Expand Down Expand Up @@ -56,6 +55,7 @@ NEXT_PUBLIC_DO_NOT_NAVIGATE=true # Disable the navigation to fix HMR
# PRISMA
DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?schema=prisma
GEO_DATABASE_URL=postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}?pool_timeout=0

# LOGIN (See Bitwarden "Atlas Secrets")
# LOGIN auf master.apis.dev.openstreetmap.org
# Docs https://wiki.openstreetmap.org/wiki/Sandbox_for_editing
Expand Down Expand Up @@ -83,6 +83,10 @@ ATLAS_API_KEY=m… # (See Bitwarden "Atlas Secrets")
# ENV: Production
# ATLAS_API_KEY=N… # (See Bitwarden "Atlas Secrets")

# Maproulette
# https://maproulette.org/user/profile for user `osm-verkehrswende-org`
MAPROULETTE_API_KEY=19361|5a3f1788-e18c-4d64-a343-f00bdf8e2bd7

# REMINDER:
# Update `/app/src/env.d.ts` whenever this file is changed.

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ jobs:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
# Note on the "Cleanup docker"
# There might be a race condition with the other github action as we are building app an processing in parallel
# The 72h grace period should make sure nothing happend during the current build but old things get cleaned up
script: |
cd /srv
echo "Pulling latest 'app' image"
docker compose pull app
echo "Restarting 'app' container"
docker compose up app -d
echo "Pruning images"
docker image prune -fa
echo "Cleanup docker (containers and images) that are older than 72h"
docker container prune -f --filter "until=72h"
docker image prune -fa --filter "until=72h"
8 changes: 6 additions & 2 deletions .github/workflows/deploy-processing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ jobs:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
# Note on the "Cleanup docker"
# There might be a race condition with the other github action as we are building app an processing in parallel
# The 72h grace period should make sure nothing happend during the current build but old things get cleaned up
script: |
cd /srv
echo "Pulling latest 'processing' image"
docker compose pull processing
echo "Restarting 'processing' container"
docker compose up processing -d
echo "Pruning images"
docker image prune -fa
echo "Cleanup docker (containers and images) that are older than 72h"
docker container prune -f --filter "until=72h"
docker image prune -fa --filter "until=72h"
1 change: 0 additions & 1 deletion .github/workflows/restart-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ jobs:
echo "Restarting containers: tiles, db, traefik and proxy"
docker compose pull
docker compose -f docker-compose.yml -f docker-compose.network.yml up tiles db traefik proxy -d
docker image prune -fa
3 changes: 2 additions & 1 deletion .github/workflows/setup-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ jobs:
-e "s|^OSM_CLIENT_ID=.*$|OSM_CLIENT_ID='${{ secrets.OSM_CLIENT_ID }}'|" \
-e "s|^OSM_CLIENT_SECRET=.*$|OSM_CLIENT_SECRET='${{ secrets.OSM_CLIENT_SECRET }}'|" \
-e "s|^NEXT_PUBLIC_OSM_API_URL=.*$|NEXT_PUBLIC_OSM_API_URL='${{ inputs.NEXT_PUBLIC_OSM_API_URL }}'|" \
-e "s|^ATLAS_API_KEY=.*$|ATLAS_API_KEY='${{ secrets.ATLAS_API_KEY }}'|" \
-e "s|^S3_KEY=.*$|S3_KEY='${{ secrets.S3_KEY }}'|" \
-e "s|^S3_SECRET=.*$|S3_SECRET='${{ secrets.S3_SECRET }}'|" \
-e "s|^S3_REGION=.*$|S3_REGION='${{ secrets.S3_REGION }}'|" \
-e "s|^S3_BUCKET=.*$|S3_BUCKET='${{ secrets.S3_BUCKET }}'|" \
-e "s|^ATLAS_API_KEY=.*$|ATLAS_API_KEY='${{ secrets.ATLAS_API_KEY }}'|" \
-e "s|^MAPROULETTE_API_KEY=.*$|MAPROULETTE_API_KEY='${{ secrets.MAPROULETTE_API_KEY }}'|" \
-e "s|^SYNOLOGY_URL=.*$|SYNOLOGY_URL='${{ secrets.SYNOLOGY_URL }}'|" \
-e "s|^SKIP_DOWNLOAD=.*$|SKIP_DOWNLOAD='${{ vars.SKIP_DOWNLOAD }}'|" \
-e "s|^SKIP_UNCHANGED=.*$|SKIP_UNCHANGED='${{ vars.SKIP_UNCHANGED }}'|" \
Expand Down
7 changes: 6 additions & 1 deletion app.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM node:18-bullseye-slim AS base
FROM node:18-bookworm-slim AS base

RUN apt-get update && \
apt-get install -y gdal-bin && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app

Expand All @@ -22,11 +27,11 @@
RUN npx blitz@2.1.0 prisma generate
RUN npx blitz@2.1.0 build

CMD npx blitz@2.1.0 prisma migrate deploy && npx blitz@2.1.0 start -p 4000

Check warning on line 30 in app.Dockerfile

View workflow job for this annotation

GitHub Actions / deploy_app / build_app

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

# From here on we are building the production image
FROM base AS production

RUN npm install --global pm2

CMD npx blitz@2.0.10 prisma migrate deploy && exec pm2-runtime node -- ./node_modules/next/dist/bin/next start -p 4000

Check warning on line 37 in app.Dockerfile

View workflow job for this annotation

GitHub Actions / deploy_app / build_app

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
5 changes: 5 additions & 0 deletions app/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Needed when running `npm run build && npm run start`
# Ignored by .dockerignore for the build with app.Dockerfile
NEXT_PUBLIC_APP_ORIGIN=http://127.0.0.1:4000
DATABASE_HOST=localhost
NEXT_PUBLIC_APP_ENV=staging
11 changes: 6 additions & 5 deletions .husky/pre-push → app/.husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This runs our unit tests for `Processing`

./processing/run-tests.sh

# Linting, Formating and Type-Checks for `App`

cd app
cd ./app
npm run check

# This runs our unit tests for `Processing`

cd ..
./processing/run-tests.sh
23 changes: 10 additions & 13 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ Run `npm run dev` wich will start docker and `../processing` automatically if ne
- ORM: [Prisma](https://blitzjs.com/docs/cli-prisma)
- Styling: [Tailwind CSS](https://tailwindcss.com/), [Tailwind UI](https://tailwindui.com/) and [Headless UI](https://headlessui.com/)

### (Tip) Testing the production bundle
### Running the production bundle locally

In the [`app/`](./app/) directory do the following:

1. Make sure `npm run dev` works as expected. This will make sure all packages are patched.
2. Create a `.env.production.local` with settings like
```
NEXT_PUBLIC_APP_ORIGIN=http://127.0.0.1:3000
NEXT_PUBLIC_APP_ENV='staging' # 'staging', 'production'
```
3. Run `npm run build` and `npm run start` to test the production bundle. There is also a dockerized version of our frontend which one can run with `docker compose --profile frontend up`.

### (Tip) NextJS

- Favicons:
`icon.svg` https://nextjs.org/docs/app/api-reference/file-conventions/metadata/app-icons
Generator for `favicon.ico` https://realfavicongenerator.net/
2. Double check [`.env.production`](/app/.env.production)
3. Run `npm run build` and `npm run start` to test the production bundle.

There is also a dockerized version of our frontend:

```
docker compose --profile frontend build
docker compose --profile frontend up
```

## Helper scripts

Expand Down
10 changes: 0 additions & 10 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"updateStaticDatasets:staging": "bun --env-file=.env --env-file=./scripts/StaticDatasets/.env.staging ./scripts/StaticDatasets/updateStaticDatasets.ts --folder-filter=",
"updateStaticDatasets:production": "bun --env-file=.env --env-file=./scripts/StaticDatasets/.env.production ./scripts/StaticDatasets/updateStaticDatasets.ts --folder-filter=",
"updateWfsSources": "bun --env-file=.env ./scripts/StaticDatasets/updateWfsSources.ts --folder-filter=",
"deleteAllStaticDatasets:dev": "bun --env-file=.env --env-file=./scripts/StaticDatasets/.env.development ./scripts/StaticDatasets/deleteAllStaticDatasets.ts",
"deleteAllStaticDatasets:dev": "echo \"Reminder: We cannot use this on staging, production, see https://github.com/FixMyBerlin/private-issues/issues/2283\" && bun --env-file=.env --env-file=./scripts/StaticDatasets/.env.development ./scripts/StaticDatasets/deleteAllStaticDatasets.ts",
"updateMasks": "npm run updateMasks:createGeojson && npm run updateMasks:createPmtiles && npm run updateMasks:upload && github",
"updateMasks:createGeojson": "bun ./scripts/RegionalMasks/createGeojson.ts && prettier \"scripts/RegionalMasks/geojson/\" --write",
"updateMasks:createPmtiles": "bun ./scripts/RegionalMasks/createPmtiles.ts",
Expand Down Expand Up @@ -70,7 +70,6 @@
"@hookform/resolvers": "3.9.0",
"@json2csv/plainjs": "7.0.6",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@popperjs/core": "^2.11.8",
"@prisma/client": "5.21.1",
"@tanstack/react-query": "5.59.15",
"@turf/turf": "^7.1.0",
Expand Down
24 changes: 20 additions & 4 deletions app/scripts/MapboxStyles/json/metadata_last_process.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"atlas-style-package-1": {
"key": "atlas-style-package-1",
"about": "Metadata on the last processing of the atlas-style-package-1 styles api response",
"processed_at": "24.10.2024, 14:52:54",
"processed_at": "26.1.2025, 06:50:00",
"style_last_published": {
"published_at": "24.10.2024, 14:51:55",
"published_at": "11.1.2025, 07:50:59",
"version": 8
},
"style_id": "cl706a84j003v14o23n2r81w7",
Expand All @@ -18,7 +18,7 @@
"atlas-style-package-2": {
"key": "atlas-style-package-2",
"about": "Metadata on the last processing of the atlas-style-package-2 styles api response",
"processed_at": "24.10.2024, 14:52:54",
"processed_at": "26.1.2025, 06:50:00",
"style_last_published": {
"published_at": "14.8.2024, 09:44:08",
"version": 8
Expand All @@ -34,7 +34,7 @@
"parking": {
"key": "parking",
"about": "Metadata on the last processing of the parking styles api response",
"processed_at": "24.10.2024, 14:52:54",
"processed_at": "26.1.2025, 06:50:00",
"style_last_published": {
"published_at": "11.8.2024, 06:42:30",
"version": 8
Expand All @@ -55,5 +55,21 @@
}
]
}
},
"atlas-style-package-3-radinfra": {
"key": "atlas-style-package-3-radinfra",
"about": "Metadata on the last processing of the atlas-style-package-3-radinfra styles api response",
"processed_at": "26.1.2025, 06:50:00",
"style_last_published": {
"published_at": "26.1.2025, 06:49:54",
"version": 8
},
"style_id": "cm5qlrsda004401sb9c3bbc6w",
"style_owner": "hejco",
"style_name": "radverkehrsatlas-style-package-3-radinfra",
"debug_changed_names": {
"about": "The folder names in Mapbox need to follow a pattern of `radinfra_[DataIdentifier]_[OptionalStyleIdentifier]`, otherwise the script will create unexpected results. During processing, we cleanup the names. If any names show up below, those need to be fixed in Mapbox to prevent errors.",
"changedNamesForDebugging": []
}
}
}
23 changes: 14 additions & 9 deletions app/scripts/MapboxStyles/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ console.log(chalk.inverse.bold('START'), __filename)
// Configuration
const baseMapStyle =
'https://api.maptiler.com/maps/08357855-50d4-44e1-ac9f-ea099d9de4a5/style.json?key=ECOoUBmpqklzSCASXxcu'
const keys = ['atlas-style-package-1', 'atlas-style-package-2', 'parking']
const keys = ['atlas-style-package-1', 'atlas-style-package-2', 'atlas-style-package-3', 'parking']
const apiConfigs = [
// The order in this array specifies which sprite "wins" when sprite filenames are identical (the last entry "wins")
{
Expand All @@ -20,20 +20,25 @@ const apiConfigs = [
apiUrl: `https://api.mapbox.com/styles/v1/osm-verkehrswende/clev6ho1i00hd01o9bfo80n9q?fresh=true&access_token=${process.env.MAPBOX_PARKING_STYLE_ACCESS_TOKEN}`,
mapboxGroupPrefix: 'parking_',
},
{
key: 'atlas-style-package-3-radinfra',
// Style https://studio.mapbox.com/styles/hejco/cm5qlrsda004401sb9c3bbc6w/edit/#13.49/48.95568/9.13281
enabled: process.env.MAPBOX_STYLE_ACCESS_TOKEN,
apiUrl: `https://api.mapbox.com/styles/v1/hejco/cm5qlrsda004401sb9c3bbc6w?fresh=true&access_token=${process.env.MAPBOX_STYLE_ACCESS_TOKEN}`,
mapboxGroupPrefix: 'radinfra_',
},
{
key: 'atlas-style-package-2',
// Style https://studio.mapbox.com/styles/hejco/clfs9mdh9007n01t6lw99gyqr/edit/#13.49/48.95568/9.13281
enabled: process.env.MAPBOX_STYLE_ACCESS_TOKEN,
apiUrl: `https://api.mapbox.com/styles/v1/hejco/clfs9mdh9007n01t6lw99gyqr?fresh=true&access_token=${process.env.MAPBOX_STYLE_ACCESS_TOKEN}`,
// Only groups with `atlas_` prefix are used
mapboxGroupPrefix: 'atlas_',
},
{
key: 'atlas-style-package-1',
// Style https://studio.mapbox.com/styles/hejco/cl706a84j003v14o23n2r81w7/edit/#13.49/48.95568/9.13281
enabled: process.env.MAPBOX_STYLE_ACCESS_TOKEN,
apiUrl: `https://api.mapbox.com/styles/v1/hejco/cl706a84j003v14o23n2r81w7?fresh=true&access_token=${process.env.MAPBOX_STYLE_ACCESS_TOKEN}`,
// Only groups with `atlas_` prefix are used
mapboxGroupPrefix: 'atlas_',
},
].filter((c) => c.enabled)
Expand Down Expand Up @@ -158,12 +163,12 @@ const mergedGroupAndLayers = Object.values(groupsAndLayers)
const styleFolder = `${groupFolder}/groups`
fs.rmSync(styleFolder, { recursive: true, force: true })
for (const group of mergedGroupAndLayers) {
const groupFile = `// Autogenerated by \`scripts/MapboxStyles/process.ts\`
// Do not change this file manually
const groupFile = `// DO NOT EDIT MANUALLY
// This file was automatically generated by \`scripts/MapboxStyles/process.ts\`

import { MapboxStyleLayer } from '../types'
import { MapboxStyleLayer } from '../types'

export const mapboxStyleGroupLayers_${group.folderName}: MapboxStyleLayer[] = ${JSON.stringify(
export const mapboxStyleGroupLayers_${group.folderName}: MapboxStyleLayer[] = ${JSON.stringify(
group.layers,
null,
2,
Expand All @@ -180,8 +185,8 @@ for (const group of mergedGroupAndLayers) {
const _layers = mergedGroupAndLayers.map((g) => g.layers).flat()
const _layerKeys = _layers.map((l) => Object.keys(l)).flat()
const deduplicatedLayerKeys = Array.from(new Set(_layerKeys)).sort((a, b) => a.localeCompare(b))
const typesFileContent = `// Autogenerated by \`scripts/MapboxStyles/process.ts\`
// Do not change this file manually
const typesFileContent = `// DO NOT EDIT MANUALLY
// This file was automatically generated by \`scripts/MapboxStyles/process.ts\`

// This type is used in \`mapboxStyleLayers\` and gives some visibility into what kind of data we fetch from Mapbox.
export type MapboxStyleLayer = {${deduplicatedLayerKeys
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/MapboxStyles/util.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import chalk from 'chalk'

export const fetchStyle = async (key, url, folder) => {
export const fetchStyle = async (key: string, url: string, folder: string) => {
const fetchStyle = await fetch(url)
if (!fetchStyle.ok) {
console.error('Fetch failed', fetchStyle)
console.error('Fetch failed', { fetchStyle, url })
process.exit()
}
const data: any = await fetchStyle.json()
Expand Down
12 changes: 12 additions & 0 deletions app/scripts/MapboxTilesets/datasets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,16 @@ export const tilesetConfigs: Record<
uploadUrl: 'https://studio.mapbox.com/tilesets/hejco.7h5266ql/#14/52.51622/13.37036',
bbox: bboxPartOfNorthGermany,
},
// There is no export function for the statistics table, so we cannot use this script to update the data.
// See `app/src/app/regionen/[regionSlug]/_mapData/mapDataSources/export/exportIdentifier.ts` for more.
// aggregated_lengths: {
// sourceLayer: 'aggregated_lengths',
// uploadUrl: 'https://studio.mapbox.com/tilesets/hejco.TODO/#14/52.51622/13.37036',
// bbox: bboxPartOfNorthGermany,
// },
todos_lines: {
sourceLayer: 'todos_lines',
uploadUrl: 'https://studio.mapbox.com/tilesets/hejco.1yvm8bes/#14/52.51622/13.37036',
bbox: bboxPartOfNorthGermany,
},
}
Loading