A simple yet highly configurable Mastodon/Twitter bot that posts geotagged aerial imagery of a random location in the world.
A simple yet highly configurable Mastodon/Twitter bot that posts geotagged aerial imagery of a random location in the world.
In a bit more detail, whenever you run ærialbot, it...
As of November 2022, I've migrated all ærialbot instaces I had been running to Mastodon – follow them at @[email protected] if you like.
You can also take a look at their now-silent Twitter equivalents...
...and still-active instances run by others (let me know if you want yours to be included):
I've set up a Twitter list, enabling you to check out (and perhaps follow) all of them.
Also check out @earthacrosstime (newly also posting on @[email protected]), a "sibling" bot that posts timelapse videos showcasing how random locations in the world have changed since 1984.
Posting can be disabled, meaning that this tool can serve as a high-resolution map downloader in a pinch. It newly – as of October 2021 – supports the 45-degree imagery available on Google Maps, such as this view of Barcleona, centered on the Basílica de la Sagrada Família.
Here's why ærialbot is a Good Bot:
config.sample.ini
– you can supply your own shapefile (or instead define a fixed point), control output verbosity, set a different map tile provider (there's a bunch of presets, including oblique views), define the filenames of the result images, scale them to your preferred size, define the text of the tweet/toot, and more!shapefiles/
directory contains a number of shapefiles to get you started, along with a guide on preparing further shapefiles for use with ærialbot.Being a good Python 3 citizen, ærialbot integrates with venv
or similar packages to avoid dependency hell. Run the following commands to get it installed on your system:
$ git clone https://github.com/doersino/aerialbot
$ python3 -m venv aerialbot
$ cd aerialbot
$ source bin/activate
$ pip3 install -r requirements.txt
(To deactivate the virtual environment, run deactivate
.)
One of the dependencies, Shapely, requires the GEOS library for performing operations on two-dimensional vector geometries, which you may need to install first as described here.
Copy config.sample.ini
to config.ini
(via cp config{.sample,}.ini
for some Unix wizard vibes or just with your file manager like us normals), open it and modify it based on the (admittedly wordy) instructions in the comments.
See shapefiles/README.md
for advice regarding finding shapefiles of the region you're interested in and preparing them for use with ærialbot.
Feel free to file an issue if anything's unclear!
Once you've set everything up and configured it to your liking, run:
$ python3 aerialbot.py
That's basically it!
If you want your bot to post at predefined intervals, use cron
, runwhen
or a similar tool. To make cron
work with venv
, you'll need to use bash and execute the activate
script before running ærialbot (in this example, it runs every four hours at 30 minutes past the hour):
30 */4 * * * /usr/bin/env bash -c 'cd /PATH/TO/aerialbot && source bin/activate && python3 aerialbot.py'
Pro tip: If you want to host multiple instances of ærialbot, you don't need multiple copies of the code – multiple config files suffice: simply run python3 aerialbot.py one-of-your-config-files.ini
.
Uber pro tip: Run python3 aerialbot.py --help
to learn about some secret CLI options!
Because it's cute and I like the "æ" ligature.
Because satellite imagery can be extremely beautiful, and I was looking for a way of regularly receiving high-resolution satellite views of arbitrary locations such as the center pivot irrigation farms of the American heartland or squares of the Jefferson grid in my timeline.
Note that I've built this tool (along with its predecessor gomati) during the COVID-19 pandemic – when it was, you know, just kinda nice to see the great outdoors somehow.
(That's only relevant if you configure ærialbot to download tiles from Google Maps, which is the default source – but other tile providers do exist.)
Probably. I haven't checked. But they haven't banned my IP for downloading tens of thousands of map tiles during development and testing, so you're probably good as long as you don't use this tool for downloading a centimeter-scale map of your country. What's more, I can't think of how an ærialbot-based bot would compete with or keep revenue from any of Google's products. (And it's always worth keeping in mind that Google is an incredibly profitable company that earns the bulk of its income via folks like you just going about their days surfing the ad-filled web.)
Possibly. Please feel free to file an issue – I'll be sure to take a look!
These are ideas more than anything else – don't expect them to be implemented any time soon.
aerialbot.py
up into multiple modules, take inspiration from here. This might not be required right now, but would help if any of the ideas listed below are implemented.ReverseGeocoder
interface is introduced, which two classes TwitterReverseGeocoder
(with a constructor taking the Twitter credentials) and OsmReverseGeocoder
implement. The config file would have to be extended with a reverse geocoder selection option, plus a reverse geocode string template and an explanation of the available variables (which may differ depending on the selected geocoder). This reverse geocode string would then be referencable in the tweet/toot templates.GeoShape.random_geopoint
, also implement a Shape.random_edge_geopoint
function for generating points on the edge of polygons (and polylines), and make it available via a config setting. This would 1. help test whether a given shapefile is accurate (and whether its projection is suitable), and 2. enable posting images of coastlines or border regions, which might be interesting. Random point selection on polygon outlines would need to be done by randomly picking a segment of the outline via a distribution based on a prefix sum of the haversine distances along the outlines, then uniformly picking a point along the chosen segment (or linearly interpolating).