Closed eddy-geek closed 2 years ago
Looks interesting! Thanks for this contribution. The map editor (map.html/js) should be updated to support this new map type. Could you look at it? I agree that "overlay" could be a map attribute instead of a map type.
Following 1e0e89e, overlay is now a map attribue
One issue with this simple integration is that a single HEAD request is made at each page load, because of wtracks.js#L2042 calling into pmtiles.js#L48.
Apparently this is not done if the map is not displayed, so I hid the maps by default.
The map editor (map.html/js) should be updated to support this new map type. Could you look at it?
Done. My current hosting for the maps is quite slow (not supporting http/2), but that'll have to do. Ready for review.
Thanks! This is a great new feature. 2 questions:
One issue with this simple integration is that a single HEAD request is made at each page load, because of wtracks.js#L2042 calling into pmtiles.js#L48.
Apparently this is not done if the map is not displayed, so I hid the maps by default.
Correct, when map is "hidden" then the tile provider is not created.
Are you owning the s3 buckets hosting the sample files? They will not be deleted soon? We should only include these maps in the defaults if their availability is stable enough.
Yes I am owning the hosting, and plan on maintaining it (which may include moving to a faster provider if I can keep costs in check. in that case I would PR before :)) FYI I also got the author's permission for the Bugianen map.
I noticed that pmtiles created with https://protomaps.com/docs/getting-started are not compatible with this PR (they use pbf format instead of jpg). Any chance to support this format too?
Good point. I am indeed not using Vector tiles, but is is supported by the lib, through integration with maplibre-gl, done in pmtiles.js addProtocol.
A sample is here:
<script src="https://unpkg.com/maplibre-gl@1.14.1-rc.2/dist/maplibre-gl.js" crossorigin="anonymous"></script>
<script>
pmtiles.addProtocol(maplibregl)
var map = new maplibregl.Map({ ... })
Integration with leaflet seems available, so we'd need to tie all this together. I'll check with upstream if they can help with an example for the maplibre-gl-leaflet + pmtiles part.
By the way, what is your stance on when to load such dependencies from the external world eg unpkg vs copying in .js/
? You seem to do a bit of both currently.
As such, I believe it fits well with WTracks serverless frontend :-) I may also work on COGeo support in the future, but PMTiles is much lighter.
One issue with this simple integration is that a single HEAD request is made at each page load, because of wtracks.js#L2042 calling into pmtiles.js#L48.
A current limitation is that PMTiles (or WMTS) can't be added as overlays. Do you see an issue with separating
type: "overlay"
into it ownoverlay: true
field in the future?