In a previous post I introduced the idea of location-based messaging apps. This post is about the tools that can be used to make this work. The main software ingredient for such apps to work is a “spatial database”, which allows location queries to be made of the stored data.
The standard solution for location queries is called PostGIS, which is an open source extension for the database software PostgreSQL. PostgreSQL itself is a standard open source SQL database engine and a very popular one, too. It is extensible in various ways, such as through PostGIS.
A spatial database would be used to query which regions a given user location is contained in, to display and authorize the appropriate chat rooms. This would have to be done efficiently in the case of many users and many simultaneous chat rooms. Hence the need for a specialized database software. PostGIS more than satisfies such requirements, but can be complex to use.
The next requirement is to be able to display navigable world maps, to show users where they are located and which regions messaging is limited to. A good ingredient here is MapServer, an open source component for publishing maps. This has to work together with the GIS database. A simpler alternative is to use a maps API, where the actual work is offloaded to the API provider, such as the Google Maps Platform.
Indeed there is a lot of GIS software, both free and commercial, so whoever wants to implement a location-based messaging service has many components to choose from.
I’ll summarize this short post by walking through how such an app would handle location information. With the user’s agreement the app first retrieves the current device location from the OS. This is passed on to the GIS server to select a list of chat rooms the user is permitted to enter. The shapes of these regions can be as simple as a circle or as complex as a city shape.
The user can ask the app to display the relevant boundaries on a live map, which is done with the help of a map server or maps API. When defining new message rooms, the map display allows users to pick out a valid region in space.
Here I have merely scratched the surface of what would be needed for such an app, and which components are available. But you can see that the right tools are available to implement this idea.