gpxpod icon indicating copy to clipboard operation
gpxpod copied to clipboard

Selfhosted Tile Server

Open markuman opened this issue 1 year ago • 2 comments

I've completed a very very simple tile server for selfhosting that works also with GpxPod.
The planet.mbtiles file is ~85GB. So no API Key is necessary anymore.
Maybe someone is interested: https://github.com/markuman/sms

mkdir osm
wget -O osm/planet.mbtiles https://hidrive.ionos.com/api/sharelink/download?id=SYEgScrRe
podman run -ti --rm -p 9000:9000 --name sms -v $(pwd)/osm/:/data/ registry.gitlab.com/markuman/sms:latest
firefox http://localhost:9000

nextcloud GpxPod

  1. Deploy the container/service behind a webproxy (caddy, nginx, traefik,...you name it.) to get a valid SSL certificate.
  2. Goto GpxPod Settings -> Tile Servers
select * from oc_gpxpod_tileservers;
 id | user_id | type |           name            |                                                        url                                                         | min_zoom | max_zoom | attribution 
----+---------+------+---------------------------+--------------------------------------------------------------------------------------------------------------------+----------+----------+-------------
  5 | markuman       |    1 | maps.osuv.de              | https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected]       |          |          |  
  6 | markuman       |    1 | maptiler-basic-gl-style   | https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected]   |          |          |  
  7 | markuman       |    1 | maptiler-terrain-gl-style | https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected] |          |          |  
 12 | markuman       |    1 | positron-gl-style         | https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected]         |          |          |  
 13 | markuman       |    1 | liberty                   | https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected]               |          |          |  
(5 rows)

grafik

markuman avatar Aug 20 '24 13:08 markuman

Wow awesome! Thanks for mentioning this here.

Keep in mind this can only work if all the data endpoints (in style.json) are on the same domain as the style.json address. GpxPod authorizes the domain of the vector tile server in the page CSP.

julien-nc avatar Aug 20 '24 14:08 julien-nc

Keep in mind this can only work if all the data endpoints (in style.json) are on the same domain as the style.json address. GpxPod authorizes the domain of the vector tile server in the page CSP.

Yes, they are. This is the outpuf of https://maps.osuv.de/v1/styles/[email protected]/[email protected]&[email protected] for example.
And all paths are relativ https://github.com/markuman/sms/blob/latest/simple_mbtiles_server/vendor/index.html#L18
So it should work on any domain.

I host home, that's the reason why there is a basic auth infront of my maps service - when accessing it from the internet.
Inside my local network, there is no basic auth.

in caddy

        @not-local not remote_ip 192.168.178.0/24
        basic_auth @not-local {

but this is out of scope. I just want to clearify why my tile server isn't public available.

And I paid the ionos hidrive to distribute the large mbtiles file for others.
I hope the hurdle has never been smaller to host the map of the entire world from zoom level 0 to 20 :smile:

markuman avatar Aug 20 '24 18:08 markuman