🆕 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…
@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.
@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...
@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.)
@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.)
@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.
@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.
@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.
@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@Edent An extension for Lunar Place objects would be unnecessarily specific and would leave unaddressed the need for extensions allowing Place objects to describe locations on Mars, Io, Neptune, etc.
Given that Latitude/Longitude/Altitude is relevant to most celestial bodies, it would be more effective to add to Place objects a field for specifying the Coordinate System that should be used in interpreting the Latitude/Longitude, etc.
@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.
@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.
@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.
@Edent Knowing you can't see likes or replies on the location posts, let me report that both my accounts can see photos and parse the alt-text correctly.
It appears neither can handle the location in the way you intend though. I'll use your form of words from the Mastodon Issue to pop one on the #IceShrimp repo if that's OK.
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.
@Edent I had found that link — but was hoping that the PHP world could coalesce around a single library, so that it would be an easy drop in for many many projects (including my own blogs etc).
@Edent I'm going through that, but I am running into some problems. How did you debug this?
For instance, I get a 500 in the UI when I add "derick@social.derickrethans.nl" to the masto search box, but I can see it requesting /@derickr/following and /@derickr/followers in my log.
@Edent Ah, right. I found why the bio didn't work either. I had used the wrong date format (typo: 2024-01-03117:09:00Z instead of 2024-01-31T17:09:00Z)!
Now it has kitten images and a bio and the search works too.
It certainly does work. There was one thing I noticed that seemed b0rked. That or maybe my client couldn't read it?
I see the alt text in the location.edent link, but when I try to click the alt text link in my (stock Mastodon web client) it doesn't show. See video: https://saneux.ei8fdb.org/s/MKZqAwjRbM3P8pE
I expected the alt text to be visible in my client, right? Maybe not?
@Edent@edent_location This is such a cool project! 👏 I am sure the #OpenStreetMap and #Mapstodon folks are interested in your location sharing project and it could spark more ideas for geo-related use-cases built on top of ActivityPub 🎉
@Edent@edent_location Howdy. I'm writing an ActivityPub C2S client web app, so I used your location notes to prototype a tag in my UI. Here's what it currently looks like. (Not sure I like showing the co-ordinates - I may hide them in future. Also, the tag is a clickable link that goes to <https://www.openstreetmap.org/?mlat=>${latitude}&mlon=${longitude}#map=19/${latitude}/${longitude})
@liaizon@Edent@edent_location@pixelfed I have no idea! If they use the same ActivityPub location format then yes, it should work, but I haven't tried. If you can send me a few links to posts that you're interested in, I'll check them out and let you know the results.
(It's very early stages for this client, so don't get your hopes up too much. And despite C2S being a standard, it's kindof incomplete as far as a useful implementation goes so I've had to make a bunch of assumptions.)
Here's how they look. Mostly successful! The location appears as it should, and I didn't have to change/fix any code for it. There's some obvious problem with cropping in the second screenshot - no idea what's going on there, but I'll investigate. As I said, the code is still very incomplete.
@Edent@openbenches my instinct is that bots would definitely benefit from the "authentication" benefits of being on the same domain as they claim to bot for, if that makes sense.
(i.e. if the openbenches bot is on an openbenches.org server, there's not doubt it's the legit bot)
@Edent I missed this post from at the time but @andypiper (as one of the few people I'm still connected with on foursquare/swarm) mentioned it to me at FOSDEM. I always thought it would be nice (and not overly complicated) to have an OSS equivalent so good to see someone's on it :-)
Now I just need to find some time to play with it!
@Edent@edent_location now if you could just add functionality to add/update places in OSM for the inevitable scenario where the list of places you get back is out of date!
It's pretty bare-bones and experimental at the moment - as described earlier in the thread. I haven't seen any activities either, but I suspect if any were sent out that they might not have been signed and possibly rejected - and my logs rotate pretty quickly so I might not have any trace of them either.
I'd also send back one of our own check-in activities, but I don't think the inbox is working yet and @Terence Eden 's Mastodon account won't display them anyway.
No worries. I'm pretty forgiving of works in progress...
@mikedev@silverpill
Yeah, it is a "write only" account. It sends messages which seem to be federated out.
I'm logging likes, boosts, and replies, but not doing anything with them yet.
Thanks 🙂
This touches on one of my pet peeves. The correct type to use for the activity is Arrive; but this isn't supposed to have an object according to the specs - only a Place as a target.
I think this is short-sighted and doesn't work well for the fediverse. So our checkin activities are
type: Arrive
object: Note
target: Place
We will also accept
type: Arrive
target: Place
but in my opinion this is mostly useless. If you attach a photo or describe what you're doing, these would have to be attached to the Place and that just feels wrong. A Place isn't a Note or an Image or part of a conversation. It's just a Place.
@mikedev I can't understand why you consider the need for a Note as an object, the Arrive activity itself is an object that can contain whatever the Note would contain. In my opinion it's fine to treat activities as contentfull objects.
Wait until you need to "Like" an Arrive. Sure it's easy. Just like it. Except everywhere else in your code you're liking an object and now you're liking an activity containing a target. Now assume somebody sends you one of these Like/Arrive/object:null/target:Place activities. Parse it. Go ahead. I'll wait. It's OK if you take some acid. Anybody reading your code a year from now will need to.
The advantage of having a Note object associated is that any fediverse in existence can render it and display it without even caring that it's an Arrive activity. If they do understand Arrive, they can look at the target and add a map. Done. People can Like it and every ActivityPub developer doesn't have to take acid and build a special parser to handle this weird edge case that's forbidden to have an object. Why do you think that only 3 people in the fediverse have even attempted Check-in activities after 6 years?
@mikedev I'm confident that there's not going to be any issue.
None of the objects require special casing when it comes to parsing or applying side effects on them (as adding a Like to it's likes collection) Shrug.
I might eat my words if presented with the real life of such an Activity, but until then I am confident. :D /Flexes bicep
Allow me to re-phrase what I've said, since we have different goals in life. An Arrive activity, as specified in the ActivityStreams vocabulary, is not expected to have an 'object' - only a 'target'. I'm not asking you to provide Arrive activities with an attached Note object. All I'm asking of you is that if you see an Arrive activity and it has a non-null object and you aren't sure what to do with it, is simply to ignore the unexpected object and proceed as if it wasn't there. It has no relevance to you. As opposed to crashing, throwing exceptions, and/or name calling. You should still be able to process and render the Arrive activity just fine - if your software is otherwise equipped to process and render Arrive activities.
@mikedev I agree: the robustness principle should most definitely apply to receiving ActivityPub objects.
However, I don't see any clear counterargument against moving whatever content the note would contain into the Arrive activity itself. I find an Arrive->Brussels with a content of "Finally made it!" perfectly valid. The note would be redundant, because the meaning of the text is intrinsically linked to the activity and would lack context if it would be in a separate note in the object.
@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.
@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?
@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!
@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.
@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.
Add comment