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

Support OpenStreetMap vector tiles with Maplibre-gl-js #1038

Merged
merged 18 commits into from
Oct 6, 2023

Conversation

benstonezhang
Copy link
Contributor

@benstonezhang benstonezhang commented Apr 22, 2023

Allow to self-host vector tiles server based on openmaptiles, martin, nginx with cache and maplibre-gl-js.

@tacruc
Copy link
Collaborator

tacruc commented Apr 24, 2023

Hi @benstonezhang
Thanks for your contribution 🎉, could you provide me some url to test your PR?
If you don't want to do it publicly you can send me an email or reach me via matrix.

Or send some docs on how to instal the service to test the pr.

@benstonezhang
Copy link
Contributor Author

Sorry, I deploy this on my NAS in home and my ISP provide only private ipv4 address(100.64.0.0/16), so can not access from public internet. I can send you some screenshot if need. I may need to buy a SSD to host data of the postgresql database -- the mechanical hard disk is too slow for postgis select operation. :-(

@tacruc
Copy link
Collaborator

tacruc commented Apr 24, 2023

Can you post some documentation which services are required to deploy this?

@benstonezhang
Copy link
Contributor Author

benstonezhang commented Apr 25, 2023

Service deploy:

  1. follow openmaptiles README to Prepare the Database
  2. follow openmaptiles README to Prepare the Layers. I don't want to generate any mbtiles file here, so only run make import-sql build-style
  3. run make download-fonts, then copy the fonts to your selected folder under nginx document root
  4. create an instance of martin server docker, you may want to customize your martin config file by follow martin README Configuration File
  5. update nginx config for tiles url
  6. setup nginx cache
  7. copy generated style.json, sprite.json, sprite.png, [email protected] and [email protected] to selected folder under nginx document root
  8. update style.json "sources.openmaptiles.url" to nginx martin url, like "https://your_server/martin_tiles/getmvt"
  9. update style.json "glyphs" to "https://your_server/your_fonts_dir/{fontstack}/{range}.pbf"
  10. update style.json "sprite" to "https://your_server/your_sprite_dir/sprite"

Done

Copy link
Collaborator

@tacruc tacruc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benstonezhang,
sorry for the late reply. I only found time today to setup a tileserver. (Which is still not fully running. But after a while I found a demo url to test your PR:
https://demotiles.maplibre.org/style.json

Blame is on me, but it would have saved some time in the review.

So there is two things which I think need to be done:

  • Rebase the branch onto the current master
  • Adapt the CSP as otherwise the tiles won't load
    Therefore edit the PageController.php in line 124 add 'maplibreStreetStyleURL'

@benstonezhang
Copy link
Contributor Author

Hi @tacruc, thanks for your review and comments. I'm in a tour and will work to update the PR several days later.

@benstonezhang
Copy link
Contributor Author

Hi @tacruc, PR updated. Please check. Thanks.

Copy link
Collaborator

@tacruc tacruc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@tacruc tacruc merged commit 9fcb9e6 into nextcloud:master Oct 6, 2023
9 checks passed
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.

2 participants