/
🐘

PostgreSQL

On this page

Geometry vs. Geography

Use geography when dealing with regional/global scale data and geometry when dealing with local scale data.

  • Geometry, where it assumes all of your data lives on a Cartesian plane (like a map projection); More functions,High performance, recommended for compact spatial use cases with in country, province etc, not spanning across continent calculations

  • Geography, where it assumes that your data is made up of points on the earth’s surface, as specified by latitudes and longitudes. More precision, Les number of functions, less performing than geometry ,recommended for calculation spanning multiple geographies. We should also specify spatial reference id like 4326.

Reinstall PostgreSQL

sh
brew reinstall postgresql
sh
psql create extension postgis
psql create database sensorthings
psql -c 'create database sensorthings;' -U postgres
psql -c 'create extension postgis;' -U postgres sensorthings
psql -c "ALTER USER postgres PASSWORD '12345678'"
psql -d sensorthings
# psql -c 'drop database sensorthings'
create user sta with encrypted password '12345678'
# list all users
\du
# alter user sta with encrypted password '12345678'
grant all privileges on database sensorthings to sta

Resources

PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch.

logo
Code-related notes and snippets