gpxstudio / gpxstudio.github.io

The online GPX file editor
https://gpx.studio
MIT License
611 stars 107 forks source link

Add `.pbf` support for custom layers #255

Open rafal0p opened 11 months ago

rafal0p commented 11 months ago

Custom layers is an awesome feature, but currently it supports only sources that are returning {z}/{y}/{x}.png. There are some servers that return {z}/{y}/{x}.pbf.

It seems that .pbf is just a wrapper over .osm that serializes it as protobuf as described here.

Do I understand correctly that what needs to be done is:

  1. deserialize pbf to osm
  2. render osm as png

How hard it could be? Is any of these features supported by leaflet? If not - are you fine with bringing in yet another dependency?

vcoppe commented 2 months ago

Thank you for your suggestion, I have re-implemented the website from scratch and you can now add custom vector layers. For now this is done by giving the URL of the Mapbox style JSON, let me know if you had something else in mind. You can check out the future website here: https://gpx.studio/gpx.studio/ and provide feedback on this new repository: https://github.com/gpxstudio/gpx.studio.

rafal0p commented 2 months ago

Maybe I should start with why I thought about such feature.

gpxstudio is the best route planner I've used. And I tried like... all of them. What I lack is integration with Squadrats. I put a draft PR of some approach here, but my initial idea, as described above, was different.

Peeking in "Network" tab while browsing map on Squadrats proves that there are a lot of queries to somedomain.com/somepath/{z}/{y}/{x}.pbf. My hunch is - they are returning these precious, precious squares.

I just tried to create a Custom Layer out of such link in new version, but it doesn't work. Authentication is fine, since some of these calls, made from https://gpx.studio/gpx.studio do return HTTP 200. So the work is to be done someplace else.

Any tips on how to approach debugging it?