Email or username:

Password:

Forgot your password?
Terence Eden

🆕 blog! “Rebuilding FourSquare for ActivityPub using OpenStreetMap”

I used to like the original FourSquare. The "mayor" stuff was a bit silly, and my friends never left that many reviews, but I loved being able to signal to my friends "I am at this cool museum" or "We're at this pub if you want to meet" or "Spendi…

👀 Read more: shkspr.mobi/blog/2024/01/rebui

#ActivityPub #fediverse #FOURSQUARE #geolocation #OpenStreetMap

69 comments
🇮🇨 Marcel Jacobs 🇳🇱

@Edent I liked the mayor stuff. I was mayor of lots of places here in #lapalma 😉

James Smith 💾

@Edent this is a very cool idea, and I'm looking at doing some ActivityPub work soon for @manyfold, ideally as a reusable thing that I could plug into Rails somehow. What stack were you thinking of building in?

Terence Eden

@floppy @manyfold
Currently building on Symfony because that's what I know best.
I have the basics up and running, but the signature stuff is driving me potty!

James Smith 💾

@Edent nice; I know no Symfony, and my PHP is *very* rusty, but I'd be interested in taking a look at it at least!

Lewis Dale

@Edent @Floppy @manyfold @robb wrote a blog post on implementing his own ActivityPub server in PHP (rknight.me/blog/building-an-ac) - it includes a section on validating the signatures, because I think it was a major pain in the arse for him too (source code: github.com/rknightuk/bugle/blo)

Robb Knight

@lewis @Edent @Floppy @manyfold Correct, it was in fact a huge pain to work out.

Terence Eden

@robb @lewis @floppy @manyfold
I have "borrowed" a lot of that code for mine 😄
Rob's work is excellent. It is my debugging skills which are poor

Terence Eden

@robb I don't suppose you came across the error "found an invalid character in header name"?
I'm trying to send an "accept" to a follow request using your code - but something isn't happy.

Robb Knight

@Edent I don’t recall that error, no sorry. This part is a such a pain. If you have your code up somewhere I’d be happy to take a look just as a second pair of eyes.

Terence Eden

@robb ah, I stuffed up the headers. Got them working now.

New error is "Verification failed for ..." Which at least is progress!

Robb Knight

@Edent Excellent! (Was putting the kid to bed and only just started looking, glad you got it sorted)

Kevin Marks

@Edent there's a fair bit of prior art listed at indieweb.org/checkin - micro.blog and Known have check-in posts, and there are a couple of apps to copy Swarm posts back to your own site.

Ian Wagner

@Edent yes!!! I can’t find the thread now but I was discussing this exact idea with… I think it was @tijs and @zverik a few months ago. I have no dev time to devote for it now but happy to chat if you’d like to swap ideas.

In particular, I think one raison d’être for such an app (aside the obvious utility which obviously many of us got from 4sq) is to gamify submitting and verifying POIs in OSM. With a good UX and some careful thought, I’m optimistic it could really improve OSM for POIs.

Kudra :maybe_verified:

@Edent love this idea! I was a big fan of Foursquare back in the day.

Risotto

@Edent the mayor thing was a tactic to help with onboarding when in a small sparse network :)

Ninad Pundalik

@Edent I'm hooked, waiting for the next post! (no pressure on the timing though). I'm new to the OSM space, so Overpass didn't make sense for quite some time, till I searched for it online.

Terence Eden

OK gang! I now have an *extremely* basic ActivityPub server which can send messages to its follower!

Next steps:

* Record who is following it.
* Post to all followers (not just me).
* Stable URl for posts.
* Front end for picking locations nearby.
* About a dozen other things!

DELETED

@Edent This is neat! I was thinking about a video game version of BookWyrm recently to replace backloggery.

James 🌈💜

@Edent Nicely done! Over that first major hurdle.

Alaric Snell-Pym

@Edent is this best done as a whole new server - creating a separate account to your "main" one for others to follow? I mean, I am sure it *has* to be because you can't just ask your existing account to publish arbitrary post metadata your client generates, or can't extend your existing client, but should clients/servers be more extensible to allow such experiments? I mean, it's not too hard to extend email like that.

Terence Eden

@kitten_tech
In an ideal world, my main Mastodon account would let me attach location metadata much like Twitter does.
But, because it doesn't, I'm writing my own server.
It is just me scratching my own itch and proving it can be done.

Alaric Snell-Pym

@Edent yeah! Don't worry, I'm not saying you're doing it wrong, just that this points to a lack of extensibility in the existing things, forcing you to build a load of duplicate infra to support.your use case 😥

Matthew Exon

@kitten_tech @Edent This is a correct me if I'm wrong thing, but... my understanding was that every AP server will publish any content the client sends. In which case, I'd expect to do this on the client, i.e. the phone app. That's the one with the GPS sensor anyway. Then followers using compatible apps can see your checkin properly even if none of the home servers in between understand the data at all.

Of course, a dedicated website is also useful, especially as a demonstrator. It's just, given the above, I'm hanging out for cool, innovative, niche client-side applications to start taking advantage of the network.

@kitten_tech @Edent This is a correct me if I'm wrong thing, but... my understanding was that every AP server will publish any content the client sends. In which case, I'd expect to do this on the client, i.e. the phone app. That's the one with the GPS sensor anyway. Then followers using compatible apps can see your checkin properly even if none of the home servers in between understand the data at all.

Brian Hawthorne

@Edent @kitten_tech Maybe add location data to the glitch-soc fork of Mastodon, so all of us on glitch-soc servers will get (along with all the other wonderful features in glitch-doc)?

Alaric Snell-Pym

@bhawthorne @Edent ideally, add support for "pass on what you're given even if you don't understand it" support so future intrepid explorers can just modify a client, too! ( "currently listening to", "what I'm eating/drinking" and "mood" extensions come immediately to mind). Also, clients should make some effort to display any and all unknown tags they find in posts, please, so I don't need to do anything too hard to find out where @Edent is today 👍

Derick Rethans

@Edent I am just about to attempt to implement this for my blog — I don't suppose this is a library that does this?

Terence Eden

Nice! My toy server can now:

✅ Record who is following it.
✅ Post to multiple inboxes.
✅ Generate a permalink for its posts.

It doesn't do:
❌ Signature verification
❌ Handling replies, likes, or unfollows (it is a read-only account)
❌ Showing number of followers, posts, etc.

Pretty happy with that.
Next step - a UI so I can actually send custom posts.

Terence Eden

Not the prettiest page on the web, but I can now Geolocate my phone and find the 25 nearest named places on #OSM.

Next stage is making a button to send that location to my ActivityPub server to send out a message.

(This is crappy code, poorly architected. Just a Proof of Concept.)

Terence Eden

I've just reposted a public status from my new location check-in service.

It doesn't handle replies or likes, but you can follow it.

Expect buggy and untested weirdness 🙂

Alyn

@Edent
I've tried following from Mastodon and IceShrimp instances just to see if there's a difference.

Terence Eden

@alyn oooh! I can see both requests. Do let me know what you find. Ta!

Denny

@Edent I've hit a 'waiting for approval' page again.

Terence Eden

@denny it takes a few moments for my server to approve. It looks like it has gone through from my side - if you refresh, is your end showing approved?

Terence Eden

It's all working!

You can follow @edent_location for my "FourSquare-style" check-ins to locations.

TODO:

📸 Upload and store photos.
🔣 Set the language text to prevent spurious "Translate" options.
🖼 Make the interface look nice.
🔒 Better security
👨‍💻 Tidy up the source code.

Egon Willighagen

@Edent I loved the integration with my calendar, so that after I can find back where that place was where I was last year

Beko Pharm

@Edent microformats know this as well. I toyed with this for my blog but finding a reliable map provider (without cookies) turned out to be quite difficult.

I even tried setting up my own tile server for osm one day. The result was: Don't.

Evan Prodromou

@Edent so, I strongly recommend looking at the full Activity Vocabulary. There are several activities specifically for check-ins. I'm excited about this project.

Terence Eden

@evan Thanks Evan, I really appreciate that!
I've got the bare-bones working. I can now post a location. Let me know if you want to take a look at the account.

Evan Prodromou

@Edent I'll put it on my list! I've got a deadline for my book on the 31st and I'm trying not to get distracted. I'll check this week. The big thing is: use `Arrive` for check-ins! And include a `summary` for servers that don't know what to do with them.

Bob Wyman

@evan @Edent Unfortunately, the Place object is under-specified. While this doesn't impact most AS/AP users today, humans will soon return to the Moon and when they do, they won't be able to use AS Place objects to check-in or state their current location.

The problem is that AS Place doesn't allow specifying a coordinate system for Lat/Long. Thus, one can't use locations using the Lunar Coordinate System or any non-Earth Planetary Coordinate System.

We should fix this.
lunar.gsfc.nasa.gov/library/45

@evan @Edent Unfortunately, the Place object is under-specified. While this doesn't impact most AS/AP users today, humans will soon return to the Moon and when they do, they won't be able to use AS Place objects to check-in or state their current location.

The problem is that AS Place doesn't allow specifying a coordinate system for Lat/Long. Thus, one can't use locations using the Lunar Coordinate System or any non-Earth Planetary Coordinate System.

Evan Prodromou

@bobwyman @Edent let's make an extension for lunar Place objects!

Jupiter Rowland
@Terence Eden Just FYI: At least Hubzilla has the built-in functionality to add a geographic location to each post, and you can optionally even enter a default location into your channel settings. There's an optional app named OpenStreetMap that can show the post location or any other place in OSM. There's also an optional app named Rendez-vous that can be used to plan meetings using OSM as the map provider.

Both Friendica and (streams) have similar OpenStreetMap add-ons, but they don't have anything like Rendez-vous.

Granted, it all dates back to before Mastodon, so it isn't geared towards working with Mastodon. Also, it isn't built against ActivityPub primarily but against DFRN (Friendica), Zot6 (Mastodon) and Nomad ((streams)). But maybe it's worth checking out.

#Long #LongPost #CWLong #CWLongPost #FediMeta #FediverseMeta #CWFediMeta #CWFediverseMeta #Friendica #Hubzilla #Streams #(streams) #OpenStreetMap
@Terence Eden Just FYI: At least Hubzilla has the built-in functionality to add a geographic location to each post, and you can optionally even enter a default location into your channel settings. There's an optional app named OpenStreetMap that can show the post location or any other place in OSM. There's also an optional app named
Tom Morris

@Edent I've noodled around with trying to write some code to turn all of OSM into a Foursquare-style venues database but haven't had the time.

My rough plan—a script that parses the entire OSM dataset and:

- filters out the features one wants based on a predicate (pubs, restaurants, public buildings, etc.)
- flattens ways/relations into points (calculate centroids)
- emits lat, long, label, OSM type+ID

Stick result in DB (SQLite+SpatiaLite appeals to me), index on coords, query N closest.

@Edent I've noodled around with trying to write some code to turn all of OSM into a Foursquare-style venues database but haven't had the time.

My rough plan—a script that parses the entire OSM dataset and:

- filters out the features one wants based on a predicate (pubs, restaurants, public buildings, etc.)
- flattens ways/relations into points (calculate centroids)
- emits lat, long, label, OSM type+ID

Tom Morris

@Edent Most of it is a data quality problem in deciding on the predicate to filter the data.

Do you wanna check into an untitled tree or water fountain in your local park? (Filter things without a name?)

What about checking into a whole city or country? Or a particular borough? Or an area that doesn't line up with a governmental/administrative area (Soho, say)? That's a thing people did on 4sq to tell friends they are visiting.

How about the M25? (This place is not a place of honour etc.)

Sam Sneddon 🏳️‍⚧️

@tommorris @Edent also answers aren’t necessarily consistent; you might not have enough data to filter it in the way people want. people might want to check in to Route 66, but not the M25.

Tom Morris

@Edent (Incidentally, this isn't a "don't do it", it's more a "I've played around with this in the past and you may will encounter fun weird stuff you didn't expect"—but weird stuff is good, please carry on.)

Andy Piper

@Edent FWIW I've been working on Postmarks a bit, which also used Darius' Express AP server initially, so may be interested in having a prod here. Plus I share the interest in old 4sq, current OSM, etc. Funny, didn't we talk about this idea (on Mastodon), about a week ago...

Andy Piper

@Edent also this would be a great thing to talk about at #Fediforum... @fediforum

Terence Eden

@andypiper @fediforum
I'll see if I'm available and try to work up a talk 🙂

David Flanagan

@Edent the whole idea that Mastodon doesn’t support something and PixelFed does is frustrating.

ActivityPub servers should host all our vocabularies and apps show what they understand, but sadly Mastodon and every other app decided to forgo the Client to Server API and use something bespoke 😞

Ben 🥳

I've been working on my own ActivityPub site (this one, socialsoup).

I want to allow user to add a location to their status / notes. Mastodon allows you to Mention users, and stores this in the tags property, as well as hashtags. Maybe this is a good place to attach a location too?

I'm definitely going to follow along with what you're doing here :)

Go Up