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

PMTiles format support #21

Merged
merged 3 commits into from
Nov 15, 2021
Merged

PMTiles format support #21

merged 3 commits into from
Nov 15, 2021

Conversation

eddy-geek
Copy link
Contributor

PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enables low-cost, zero-maintenance map applications that are "serverless" - free of a custom tile backend or third party provider.

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 own overlay: true field in the future?

@opoto
Copy link
Owner

opoto commented Nov 10, 2021

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.

@opoto
Copy link
Owner

opoto commented Nov 14, 2021

Following 1e0e89e, overlay is now a map attribue

@eddy-geek
Copy link
Contributor Author

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.

@opoto
Copy link
Owner

opoto commented Nov 15, 2021

Thanks! This is a great new feature.
2 questions:

  • 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.
  • 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?

@opoto opoto merged commit aa648af into opoto:master Nov 15, 2021
@opoto
Copy link
Owner

opoto commented Nov 16, 2021

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.

@eddy-geek
Copy link
Contributor Author

eddy-geek commented Nov 16, 2021

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.

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.

None yet

2 participants