teamsempo/SempoBlockchain

Storing lat lng fields as geometry

Closed this issue · 1 comments

Improvement

In the user model (app/server/models.py) it may be better to store lat long as geometry in PostgreSQL using the PostGIS extension (https://postgis.net/).

Advantages

The advantages of using geometry

  • Spatial queries (for example select all users in an area)
  • Spatial indexing (faster spatial queries)

This would especially benefit potential dashboarding.

Steps to implement

  • Install Postgis extension
  • Enable Postgis extension
 CREATE EXTENSION postgis;
 CREATE EXTENSION postgis_topology
  • Install python module for postgis for example: https://github.com/geoalchemy/geoalchemy2
  • Change lat long column to Geometry column
    Column(Geography(geometry_type='POINT', srid=4326))
  • Insert point using WKT

Won't fix