Skip to content

Cleanup: Remove Leaflet, replace with LngLatTuple in [lng, lat] order#72

Merged
Alessandro100 merged 3 commits intomainfrom
copilot/cleanup-remove-leaflet-types
Mar 11, 2026
Merged

Cleanup: Remove Leaflet, replace with LngLatTuple in [lng, lat] order#72
Alessandro100 merged 3 commits intomainfrom
copilot/cleanup-remove-leaflet-types

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

Leaflet was only remaining in the codebase as type imports (LatLngTuple, LatLngExpression). This removes the packages entirely and introduces a proper LngLatTuple type aligned with GeoJSON/MapLibre convention.

Type replacement

Added to src/app/types.ts:

/** [longitude, latitude] — GeoJSON / MapLibre GL convention */
export type LngLatTuple = [number, number];

Replaces LatLngTuple / LatLngExpression from leaflet across 8 files.

Coordinate order fix (bonus)

Leaflet stored coordinates as [lat, lng]; GeoJSON/MapLibre expects [lng, lat]. All bounding-box creation sites now emit [lng, lat] directly:

  • getBoundingBox / selectFeedBoundingBox / selectBoundingBoxFromLatestDataset / computeBoundingBox — swapped to [lng, lat]
  • getBoundsFromCoordinates — destructures ([lng, lat]) instead of ([lat, lng])
  • Map.tsx — removed the [p[1], p[0]] coordinate swap; polygon data is now in the correct format at the source

Package removal

Removed leaflet, @types/leaflet, and react-leaflet from package.json and dropped the jest.mock('react-leaflet', () => ({})) stub from setupTests.ts.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • download.cypress.io
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node index.js --exec install (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node dist/index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Cleanup: Remove Leaflet and replace it's types</issue_title>
<issue_description>With the migration to Nextjs, leaflet has been replaced in favor of maplibre

the only remains of it in our code base is used as types

import { type LatLngExpression } from 'leaflet';

remove this and find an alternative

bonus: reorganize the datastructure of how we store our polygons for less transformations</issue_description>

Comments on the Issue (you are @copilot in this section)

@ianktc Possibly https://maplibre.org/maplibre-gl-js/docs/API/classes/LngLat/ @Alessandro100 It's the same concept, but different data structure. See image Image

The real data structure resembles leafletLngLat, there is a possibility that we could reorganize it to fit the new maplibre one, but ideally not (if existing functionality works, we shouldn't touch it). Requires some research</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mobilitydatabase-web Ready Ready Preview, Comment Mar 11, 2026 0:43am

Request Review

…ate order throughout

Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com>
Copilot AI changed the title [WIP] Cleanup remove Leaflet and replace its types Cleanup: Remove Leaflet, replace with LngLatTuple in [lng, lat] order Mar 11, 2026
@github-actions
Copy link

*Lighthouse ran on https://mobilitydatabase-8ffnh0ow9-mobility-data.vercel.app/ * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 100 🟢 96 🟢 100 🟢 100

*Lighthouse ran on https://mobilitydatabase-8ffnh0ow9-mobility-data.vercel.app/feeds * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 89 🟠 87 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-8ffnh0ow9-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🔴 38 🟢 94 🟢 96 🟢 100

*Lighthouse ran on https://mobilitydatabase-8ffnh0ow9-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟢 100 🟠 83 🟢 100 🟢 100

*Lighthouse ran on https://mobilitydatabase-8ffnh0ow9-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
⚡️ HTML Report Lighthouse report for the changes in this PR:

Performance Accessibility Best Practices SEO
🟠 88 🟢 94 🟢 96 🟢 100

@Alessandro100
Copy link
Contributor

Tested with:

https://mobilitydatabase-web-git-copilot-cleanup-r-ada8aa-mobility-data.vercel.app/feeds/gtfs/mdb-437

could not find a valid gbfs feed on preview env -> tested locally

Screenshot 2026-03-11 at 09 58 15 Screenshot 2026-03-11 at 09 58 12 Screenshot 2026-03-11 at 09 57 58

@Alessandro100 Alessandro100 marked this pull request as ready for review March 11, 2026 14:00
Copy link
Contributor

@Alessandro100 Alessandro100 left a comment

Choose a reason for hiding this comment

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

tested and works well

@Alessandro100 Alessandro100 merged commit 5b0a796 into main Mar 11, 2026
4 checks passed
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.

Cleanup: Remove Leaflet and replace it's types

4 participants