GithubHelp home page GithubHelp logo

mattkerlogue / narrowbotr Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 3.67 MB

A bot that publishes locations on the England and Wales canal network to Mastodon and previously Twitter

Home Page: https://botsin.space/@narrowbotr

License: MIT License

R 100.00%
uk-canal-network crt-data flickr-api twitter-api rstats rtweet bot canal flickr tweet

narrowbotr's Introduction

narrowbotR

GitHub Repo Status: work in progress lapsedgeographer blog post

narrowbotR (pronounced "narrow-boater") is a Mastodon bot written in R that publishes information about the UK canal network. This bot is inspired by Matt Dray's londonmapbot which randomly posts a location in the rough vicinity of London every 30 minutes. This bot seeks to do something similar: posting a random location on the UK canal network at a regular interval. It is a work in progress. At present it only publishes information about the English and Welsh canal network.

The bot also used to run on Twitter, but as of 15 April 2023 I have decommissioned the Twitter bot due to changes in Twitter's Terms of Service.

The bot works as follows:

  • The data from Canal and River Trust's open data feeds has been downloaded and aggregated into a single file, only the point-based data at this stage, let's call each item in this data a "feature"
  • A feature at random will be selected from the dataset
  • A search of publicly available photos on Flickr, licensed for sharing, in the vicinity of the feature's position is made
  • The photo metadata is scored and the top-scoring photo selected
  • If there are only a small number of photos returned then an aerial photo of the location sourced from Mapbox will be used
  • A post is constructed to provide the feature's name, the feature's type, an open-street map link to the location, and citation of the author a link to the Flickr page of the photo if a Flickr photo is being used.
  • If the flickr photo has tags then these are re-used to add to the standard hashtags included in the post
  • The tweet is then posted using a custom version of the rtoot::post_toot() function that has been extended to embed location data in the tweet's metadata.
  • The feature dataset is created only occasionally and stored in data/all_points.RDS for efficiency

You can read a more detailed explanation of how the bot works in this blog post.


Dev notes

To do:

  • Create twitter account
  • Get twitter developer credentials
  • Investigate CRT open data
  • Write database build functions
  • Write database maintenance functions
  • Build database of CRT data
  • Investigate Flickr API for geotagged photos
  • Write tweet functions
  • Write GitHub automation
  • Future: investigate data for Scottish/Irish canals

Need to decide on a maintenance schedule for updating the database

For testing purposes use the following lat/long pairs (these are popular features that should have nearby photos):

  • list(long = -2.03219634864333, lat = 51.3520732144106): Lock 29, Devizes Lock (bottom of Caen Hill flight)
  • list(long = -1.18474539433226, lat = 52.2845877855651): Braunston Tunnel West Portal
  • list(long = -3.08780897790795, lat = 52.9704074998854): Pontcysyllte aqueduct

narrowbotr's People

Contributors

actions-user avatar mattkerlogue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kawainime

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.