bayesimpact / encompass

Bayes Impact's Encompass Tool for Visualizing and Analyzing Geographic Access
https://encompass.bayes.org
Apache License 2.0
26 stars 7 forks source link

PostGIS: Use geometry datatype instead of geography #134

Open ericboucher opened 6 years ago

ericboucher commented 6 years ago

Using geometry data with the appropriate map projection will lead to faster geospatial queries in Postgres. One such query is currently ~50% of the time for the haversine-based adequacy calculation.

We should

  1. Identify a good projection to use and its corresponding SRID
  2. Update the existing data in PostGIS to use geometry instead of geography columns
  3. Update methods to load tables using the new types

Note that the second step above might cause temporary downtime for the app, since the database is a shared resource.

tetraptych commented 6 years ago

Once we're using an API to compute driving distances / times, less time will be spent on calculations made within the database (compared to the total calculation time). Accordingly, the performance gains from resolving this issue may not be as dramatic as tweaks made to API usage.