submarcos / django-vectortiles

Mapbox VectorTiles for django, with PostGIS or Python
https://django-vectortiles.readthedocs.io
MIT License
38 stars 11 forks source link

Add mapbox / openlayer examples #21

Open submarcos opened 3 years ago

mariogiampieri commented 2 years ago

Hi, thank you for this wonderful package! I'm struggling to implement using mapbox, in part due to some confusion around providing proper layer names in the url / view / mapbox source definition. Can you point me toward any implementation using mapbox? thanks!

submarcos commented 2 years ago

Thank you for your interest.

According mapbox documentation https://docs.mapbox.com/mapbox-gl-js/style-spec/root/

You should define a map with source and layer defined.

Source should refer to your exposed url by this app https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#tiled-sources (only use absolute urls, as http://127.0.0.1:8000/your_view/{z}/{x}/{y} for example)

Layer should refer to your used layer name (contained in source vector tiles), with a specific style https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/ and https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layer-properties

I will be happy if you want to contribute to this package documentation