Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Squadrats integration #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

rafal0p
Copy link

@rafal0p rafal0p commented Jan 6, 2024

What is Squadrats?

Let me pass the mic to the authors: https://squadrats.com/, the pitch is 30 seconds read.

For me, personally it's a lot of fun 🎉 .

What's in the PR?

POC of displaying these squares on the map, as an overlay layer.

If you'd like to test it and don't have an account just copypaste this to squadrats key in localstorage, it would display a rectangle over Belgium:

{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[[3.960807664215025,51.00447046929696],[3.960807664215025,50.64234162997474],[4.671143042915219,50.64234162997474],[4.671143042915219,51.00447046929696],[3.960807664215025,51.00447046929696]]],"type":"Polygon"}}]}

How it's gonna work?

Squadrats exposes collected squares as a geojson file with a token in the URL (everyone who knows the link can get it, no verification of cookies takes place). POC expects the content to be in local storage, to make it work properly I'll need to add a bit of UI to copypaste the link.

What I expect from you?

General review of the approach.

  • Do you think it should work like that, or rather everything should be added to the app dynamically, and every line of code about this integration should go to something like squadrats.js?
  • Does that have a chance to be included in the main branch, or you don't think such feature is a good idea, and if I'd like to use my only option is a fork?

@vcoppe
Copy link
Contributor

vcoppe commented Jun 30, 2024

There is a plugin to show the tiles over other route planning tools, could you not contact them to see if it's possible to add gpx.studio as well? You can cc [email protected]. I guess it would be more useful because I guess you can see your progress on the map and not just the squares.

@rafal0p
Copy link
Author

rafal0p commented Jun 30, 2024

That was my first idea, great minds think alike ;).

The reply can be summarized as "yeah, we'll consider that if the demand will be high enough, for now we put all our efforts elsewhere. And btw, you can export the data and do whatever with it".

...which I hereby have done :P

And now, since the new version is written in typescript and svelte I have even more appetite to implement it, just to play around with some new toys ;)

@vcoppe
Copy link
Contributor

vcoppe commented Jul 1, 2024

What do they mean by exporting the data? I haven't found any resources for developers on their website.
However, I see that when I load the map on my account, it loads a Mapbox style JSON at https://tiles2.squadrats.com/planet/1717927965/street.json. Could you maybe check if it loads the same on your account or if the 1717927965 is related to a specific user?

@rafal0p
Copy link
Author

rafal0p commented Jul 1, 2024

Well, it's a young enough project that I'm not surprised they lack docs for developers ;)

I peeked into the piece of data that you found, it looks non-user specific. It consists mostly of a list of ~200 layers:
curl https://tiles2.squadrats.com/planet/1717927965/street.json | jq '.layers[].id'

Each of which seems to mostly describe how it's suppose to look like:
curl https://tiles2.squadrats.com/planet/1717927965/street.json | jq '.layers[100] | keys'

[
  "filter",
  "id",
  "minzoom",
  "paint",
  "source",
  "source-layer",
  "type"
]

Also "1717927965" can be interpreted as unix timestamp, and the value ("9 June 2024 10:12:45") could suggest that.


What both I and the spokeperson of Squadrats were referring to, is this button:
image

Which makes a call to:
https://storage.googleapis.com/squadrats-b7bbf.appspot.com/trophies/${apparently_user_id}/1719593761397.geojson

and contains data which was used to raise this draft PR.

I played around with that link a little bit more and unfortunately you can't just make up any timestamp in the last element of the path. Aaaand you need to come up with this user id anyway. I guess the best UX would be to allow users to paste the full link.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants