-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Support PMTiles in Editor #807
Comments
MapLibre supports this feature with an external plugin that relies on the addprotocol method. I think that adding this functionality might confuse users who do not know this, In my opinion, unless PMTiles are integrated as an official source in the MapLibre Style Sepcification this will likely cause confusion, even though it might be highly beneficial for certain users. |
I agree with @bogind, I think it makes more sense to support this as a XYZ URL in Maputnik. It is very difficult to support plugins at the editor level, and it's not a significant workflow difference if you have to substitute one URL. If and when it's integrated, then we can reconsider. |
Now that MapLibre is the rendering engine for Maputnik #812, it would make sense to me that the PMTiles plugin will be added by default to Maputnik, and enable the use of |
I don't think the issue was with the rendering engine, but with the style specification itself. In my opinion (currently as a user, not a contributor), this should not be added, unless with strict instructions and warnings about compatibility. This can cause credibility issues with non-proficient users who would try to use the exported |
To bypass the issue in practice as I can understand the "why" of the policy, host locally Maputnik or serve pmtiles as Solution to use locally pmtiles with Maputnikgit clone https://github.com/maplibre/maputnik.git
cd maputnik
npm i
npm i pmtiles
echo -e "import { Protocol } from 'pmtiles';\n$(cat src/components/MapMaplibreGl.tsx)" >| src/components/MapMaplibreGl.tsx
sed -i 's#const map = new MapLibreGl.Map(mapOpts);#const map = new MapLibreGl.Map(mapOpts);\nlet protocol = new Protocol();\nMapLibreGl.addProtocol("pmtiles",protocol.tile);#g' src/components/MapMaplibreGl.tsx
mv dist maputnik
npm i -g http-server
http-server Then open http://127.0.0.1:8080/maputnik/ and you can try using maputnik with pmtiles as source Alternative if you have a public server where you can install stuff with your pmtilesNo need to change anything on Maputnik public side. Use simply https://maputnik.github.io/editor/ and consume # If another OS, see https://github.com/protomaps/go-pmtiles/releases
wget https://github.com/protomaps/go-pmtiles/releases/download/v1.19.2/go-pmtiles_1.19.2_Linux_x86_64.tar.gz
tar -xvzf go-pmtiles_1.19.2_Linux_x86_64.tar.gz
chmod +x pmtiles
# Sample file. Use you own here
wget https://r2-public.protomaps.com/protomaps-sample-datasets/cb_2018_us_zcta510_500k.pmtiles
# See also https://github.com/protomaps/go-pmtiles?tab=readme-ov-file#serving-zxy-tiles for more
./pmtiles serve --cors=* --port=8080 cb_2018_us_zcta510_500k.pmtiles Change now in the Maplibre JSON style the block starting with |
I believe MBtiles and PMtiles are basically the same, you can't use them as is in maplibre, therefore you either need to serve them, even from local machine using a tile server, or host them somewhere. |
@HarelM Would you mind sharing the instructions for serving PMTiles from CloudFlare? I stumbled on this post while searching for information on designing a custom basemap style with PMTiles as the underlying data source. Sounds like you just provided me the pathway to a solution! |
Pm tiles has excellent instructions: |
Thank you @HarelM! |
In the meantime Protomaps has a hosted version of Maputnik with support for PMTiles. |
According to what I've seen there, you still need to host the PMTiles file locally. |
http://editor.protomaps.com works with remote PMTiles archives, there's no limitation on localhost or local files etc. I have updated the fork with the most recent changes from maputnik/main. |
PMTiles from Protomaps are increasingly popular and a lot of other services are supporting it now. It has some major advantages in comparison to MBTiles. Styling the PMTiles is, however not possible yet, using the data set directly.
MapLibre GL JS supports PMTiles. Therefore a switch to Maplibre GL JS (see #781) in addition with the support of pmtiles URLs link (like this) would be super cool, so we can use PMTiles in Maputnik!
The text was updated successfully, but these errors were encountered: