Dev DigitalOcean Hackathon: Geobot, a Geography Python Twitter Bot - Submission Form
Tags: dohackathon
Published: 2021-01-11 01:04:47

## What I built
Geobot, a Geography Python Server and Twitter Bot.

### Category Submission: 
Program for the People

### App Link
Main server: [https://geobot-hcm6d.ondigitalocean.app/](https://geobot-hcm6d.ondigitalocean.app/)
The Twitter handle is: [@geobotshow](https://twitter.com/geobotshow/)

### Screenshots

![The TwitterBot showing a location](https://dev-to-uploads.s3.amazonaws.com/i/i4ohiux5ay19azxsb233.png)
The TwitterBot showing a location.

![The API showing a bounding-box location](https://dev-to-uploads.s3.amazonaws.com/i/vy4horop0c3h4czzpvkq.png)
The API showing a bounding-box location.

![The API showing a location with some POI](https://dev-to-uploads.s3.amazonaws.com/i/lcmpckgtd4524n3j9uj4.png)
The API showing a location near a point, with some Points of Interest (POI): fountains and drinkable water.

![The TwitterBot showing an earthquake](https://dev-to-uploads.s3.amazonaws.com/i/te1jkxb7z5ft7ayl49nu.png)
The TwitterBot showing an earthquake.

### Description
The project aims to provide a platform for  geographic data images and enhancements such a search of Points of Interest (POI). The server relies on a custom library that is quite extensible.

Besides the server, as a showcase, there's a TwitterBot that can show the user's location upon request, and has a service to shows location and info on recent earthquakes (data from USGS)

### Link to Source Code
[Geo-Server: https://github.com/davidedelpapa/geobot](https://github.com/davidedelpapa/geobot)
[TwitterBot: https://github.com/davidedelpapa/geobotshow](https://github.com/davidedelpapa/geobotshow)

### Permissive License
MIT for both

## Background
I was always interested in geography and visualization. The point is that a map is the most packed and effective data visualization created by man, and yet everyone can read it quite profitably. 

The recent years' satellite development has shown that we can combine maps with satellite images, that is, using actual images of some places, instead of mere representations (classic maps), and still map on them also some representations (points of interest, roads, color the map according to some pattern...). This demonstrates how far can the boundaries of visualization being pushed, and still obtain easily understandable results.

Besides these considerations, many think the market for end consumers geography applications is getting reaper by the day. The ecosystem to use as source is ripe enough (with free and opensource geographic datasets and imagery). Yet, there's quite a lack on the other side of the spectrum, the end customers applications: it seems as we did not yet understand how to profit of the immense power of geographic data.

This app shows an example of how to build a simple, yet extensible geographic system. In fact the server can be extended to add more endpoints, in order to exploit the power of the library, and also the twitterbot can take advantage of other aspects of the API.

Moreover, the twitterbot can be swapped for, or paired with, many other communication bots, all referring to the same GeoServer, such as a TelegrmBot, or any other bot that can be built on top of social networks or communication systems.

### How I built it 
The app actually uses two components. This means that there is not only a container for the main app (the server), but also one for a worker (the twitterbot).

Sadly, there are not many information on how to pair a service with a worker, so I had to find ways by exploring by myself. 

At the beginning I explored ways to use directly the Python components inside a Docker image.
In fact, preparation for the Hackathon, I made some tests and a tutorial on how to deploy, through Docker images, any non supported Language. See [here my article on deploying a Rust server](https://dev.to/davidedelpapa/digital-ocean-app-platform-hackathon-using-not-natively-supported-platforms-rust-rocket-55og). At the beginning in fact I was leaning on building the server in Rust, and the bot in Python.

However, after some trial and error I made it to work as intended, with two components.

The procedure though is not yet perfect; for example I could manage to put a Deploy to Do button to work correctly only with one component at a time. I did not find a way to reproduce my two components setting so far.

I also abandoned the idea of developing the server in Rust, mainly because it is still a niche language, not profitable by many people. I wanted this to be a project that many people can pick up, thinker with, extend, adapt... Of course I did not abandon completely the idea of rewriting a server in Rust, but I'm waiting also to see if it will be supported by the DigitalOcean App Platform natively.

### Additional Resources/Info

Data Providers:

- [Mapbox](https://www.mapbox.com/): The tiles images
- [OpenStreetMap](https://wiki.openstreetmap.org/): PoI location
- [USGS](https://www.usgs.gov/): Earthquakes position and information

Useful information and algorithms:

- [Slippy Map Introduction](https://wiki.openstreetmap.org/wiki/Slippy_Map): What is a slippy map? Useful for total beginners
- [Tiles to LongLat and viceversa](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames): an article by OpenStreetMap with many languages implementation of the basic algorithms
- [Aviation Formulary](http://www.edwilliams.org/avform.htm): It has got many formulas, many approximation algorithms... It is a mine for geo-math