julien-nc / gpxpod

Nextcloud app to view gpx track files
GNU Affero General Public License v3.0
40 stars 3 forks source link

How to add custom tileserver? #9

Closed freibadschwimmer closed 1 year ago

freibadschwimmer commented 1 year ago

In earlier versions I could add custom tileservers for all users by adding the tileserver to lib/Controller/tileservers.php

However, I noticed that this does not work anymore. When I try to add, for example,

 Array(
    'name' => 'Peruskartta (FIN)',
    'type' => 'tile',
    'url' => 'https://tiles.kartat.kapsi.fi/peruskartta/{z}/{x}/{y}.jpg',
    'attribution' => 'Map data <a href="https://kartat.kapsi.fi/">Kapsi.fi</a>',
    'minzoom' => '1',
    'maxzoom' => '20'
),

it does not show up in the drop-down menu in gpxpod. In fact, I noticed that even some other maps that are present in the default tileservers.php (e.g. "Hike & bike") don't show up.

I would appreciate if someone could point out how it is possible to add a custom tileserver for all users of one NC instance. Thanks a lot!

tomchiverton commented 1 year ago

This is an option (in old GUI) if you select the cog in side bar.

julien-nc commented 1 year ago

This is not possible to add custom tile servers yet in the new interface. They are defined in a script so you would need to build the app on your side after adding your tile server in src/tileServers.js. I'm very open to PRs implementing something in the new interface settings to add tile servers.

julien-nc commented 1 year ago

This is now implemented. You can add global tile servers in the admin settings and users can add personal tile servers in the setting dialog in the main app interface.

Feel free to reopen if needed.

markuman commented 1 year ago

It's undocumented what the current format is ...
in the past it was https://maps.osuv.de/styles/osm-bright/{z}/{x}/{y}@2x.webp, which currently does nothing.

markuman commented 1 year ago

in the past it was https://maps.osuv.de/styles/osm-bright/{z}/{x}/{y}@2x.webp, which currently does nothing.

well, adding in the old interface works like that. but firefox blames CSP. while the phonetrack app works without any issue.

philiprenich commented 1 month ago

I'm also hitting the CSP issue. @markuman were you able to solve this?

markuman commented 1 month ago

I'm also hitting the CSP issue. @markuman were you able to solve this?

Yes. https://github.com/julien-nc/gpxpod/issues/51 works for me

philiprenich commented 1 month ago

Thanks. In the end my problem was I am using a Glitch site as an intermediary and CORs didn't like the redirect I was using. So for NC/GPXPod I've had to have the Glitch site fetch the tile and then re-stream it to the app. The double download is not very efficient unfortunately. The intermediary Glitch site is so that I can select which scale topo map to request (1:50 or 1:250) based on the zoom. I'll need to revisit the source service to see if they host a tile server that can do this for me.