Skip to content

Commit

Permalink
Merge pull request #420 from opentripplanner/vector-tiles
Browse files Browse the repository at this point in the history
Add MapLibreGL
  • Loading branch information
miles-grant-ibigroup authored Sep 2, 2022
2 parents 28cd4a5 + f8f725f commit 86d7e2c
Show file tree
Hide file tree
Showing 135 changed files with 67,171 additions and 161,429 deletions.
18 changes: 18 additions & 0 deletions .storybook/base-map-wrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import BaseMap, { Styled as BaseMapStyled } from "@opentripplanner/base-map";

// BaseMap props
const CENTER = [45.5215, -122.686202];
const ZOOM = 16;

export const withMap = (center = CENTER, zoom = ZOOM) => (
Story
) => (
<BaseMapStyled.StoryMapContainer>
<BaseMap center={center} zoom={zoom}>
{/* For some reason, <Story /> does not work with snapshots,
so use the function syntax instead. */}
{Story()}
</BaseMap>
</BaseMapStyled.StoryMapContainer>
);
5 changes: 5 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const parameters = {
// Appears to be a story bug
id: "duplicate-id-aria",
reviewOnFail: true
},
{
// Not really applicable to stories and causes problems with the WithMap decorator
id: "landmark-unique",
enabled: false
}
],
},
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ This repo utilizes the [Storyshot](https://storybook.js.org/docs/react/workflows
This project uses semantic-release to create releases to NPM. It is expect that contributors create [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) messages. These are then parsed by semantic-release which will automatically create an appropriate release for each package whenever a branch is merged to master.

Sometimes when creating new releases, it will be necessary to update numerous packages within this repo at once to a newer internal package version. For this purpose there is the `update-internal-dependencies` script. This should be ran manually as needed. By default, `yarn update-internal-dependencies` will update all dependencies with the `@opentripplanner` scope in all packages within this project. To only update specific dependencies, it is possible to run something like `yarn update-internal-dependencies core-utils base-map`. This would update all dependencies on either the `@opentripplanner/base-map` or the `@opentripplanner/core-utils` in all packages in this project.

## Raster Tile Versions

As of Fall 2022, the otp-ui map layers have migrated from [Leaflet](https://leafletjs.com) to [MapLibreGL](https://maplibre.org/projects/maplibre-gl-js/). This migration was a breaking change, so existing uses of otp-ui should be unaffected. If you wish to migrate to the latest version, please see the [Migration Guide](https://github.com/opentripplanner/otp-ui/blob/master/VECTOR-TILES-MIGRATION-GUIDE.md).

We understand not all will want to upgrade to vector tiles right away, and so will be maintaining the _raster tile_ versions of all relevant packages for the foreseeable future.

The following table lists the last major version of each package which uses raster tiles. These major versions will receive fresh minor versions as updates are needed.

| Package | Latest Major Version with Raster Tiles |
| ------------------------- | -------------------------------------- |
| `base-map` | 2 |
| `core-utils` | 7 |
| `endpoints-overlay` | 1 |
| `itinerary-body` | 4 |
| `park-and-ride-overlay` | 1 |
| `route-viewer-overlay` | 1 |
| `stop-viewer-overlay` | 1 |
| `stops-overlay` | 4 |
| `transit-vehicle-overlay` | 2 |
| `transitive-overlay` | 2 |
| `trip-viewer-overlay` | 1 |
| `types` | 3 |
| `vehicle-rental-overlay` | 1 |
| `zoom-based-markers` | 1 |
5 changes: 5 additions & 0 deletions VECTOR-TILES-MIGRATION-GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vector Tiles Migration Guide

Due to otp-ui's `base-map` package, the migration to [MapLibreGL](https://maplibre.org/projects/maplibre-gl-js/) is quite smooth for those implementing an otp-ui map.

Key props in `base-map` have stayed the same. After updating your tile URL to a vector tile json file (any vector tile set compatible with MapBoxGL will work), things should work with minimal changes. MapLibreGL allows for some new settings, and others are deprecated. Some props throughout all layers have changed. All packages are now typescripted, which means that it is easy to see which props have changed.
181 changes: 0 additions & 181 deletions __mocks__/leaflet.js

This file was deleted.

Loading

0 comments on commit 86d7e2c

Please sign in to comment.