unvt / charites

It is an application to style vector tiles easily
https://unvt.github.io/charites/
MIT License
54 stars 13 forks source link

PMTiles support #152

Closed ubukawa closed 1 year ago

ubukawa commented 1 year ago

Describe the solution you'd like How about adding the PMTiles support using pmtiles 2.7.0?

I tried to add the function, but it did not work well.

https://github.com/unvt/charites/compare/main...ubukawa:add-PMTiles?expand=1

In order to read PMTiles, the "url" of the style would be like this. So, I think we may need to edit some more files... image

Sample style for PMTiles

https://ubukawa.github.io/109/map/style1.json

reference

https://www.npmjs.com/package/pmtiles

https://qiita.com/T-ubu/items/c1f851dfbea4b0e8d268

keichan34 commented 1 year ago

I think all we need to do is update the preview environments to include the PMTiles JavaScript and add the protocol to maplibre/mapbox-gl

let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
ubukawa commented 1 year ago

Thank you @keichan34 !

Yesterday, I have edited "provider/default/app.js" to add protocol, and "provider/default/index.html" to add a reference to pmtiles. But, I could not see preview with PMTiles data. https://github.com/unvt/charites/compare/main...ubukawa:add-PMTiles?expand=1#diff-8a706eb9f83efefc3536454ebbbf855509eab4a43b238068c1f0c56df95bdc74

Anyway, I will try again. Thank you. I thought we might possibly work with the validation of the style.. But, it would be not the cause of the issue. maplibreStyleSpec.validate(style)