Skip to content

Commit

Permalink
Add MapTiler library for Leaflet
Browse files Browse the repository at this point in the history
@maptiler/leaflet-maptilersdk

This will allow us to display our OpenStreetMap layer in
vector form rather than with raster tiles. See:

https://www.maptiler.com/news/2019/02/what-are-vector-tiles-and-why-you-should-care/

For more details on using Maptiler, particularly with
Leaflet:

- https://docs.maptiler.com/leaflet/examples/vector-tiles-in-leaflet-js/
- https://docs.maptiler.com/sdk-js/
- https://github.com/maplibre/maplibre-gl-leaflet/
- https://github.com/maptiler/leaflet-maptilersdk
  • Loading branch information
edavey committed Oct 31, 2024
1 parent 2cd00bd commit 94bca08
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/javascript/maps.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import L from "leaflet";
import "@maptiler/leaflet-maptilersdk";

document.addEventListener("turbo:load", function () {
const mapEle = document.querySelector("#map");
Expand Down
1 change: 1 addition & 0 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
policy.img_src :self, :https, :data
policy.object_src :none
policy.script_src :self, :https
policy.worker_src :self, :blob

# allow styling for the Turbo progress bar
policy.style_src("'sha256-WAyOw4V+FqDc35lQPyRADLBWbuNK8ahvYEaQIYF1+Ps='", :self, :https)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@maptiler/leaflet-maptilersdk": "^2.0.0",
"esbuild": "^0.24.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
Loading

0 comments on commit 94bca08

Please sign in to comment.