ML algorithms work only with numerical values. So there is a need to model a problem and its data completely in numbers. For example, to run a clustering algorithm on a road network, representing the network / graph as an adjacency matrix is one way to model it.

Figure 1: An simple road network represented as a Graph, where points of interest are nodes and roads connecting them are edges is shown on the left. The corresponding adjacency matrix is shown on the right

Once transformed…

  1. Install Homebrew
  2. brew install postgres
  3. initdb /usr/local/var/postgres
  4. To start server at startup
  5. mkdir -p ~/Library/LaunchAgents
  6. ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
  7. launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
  8. /usr/local/Cellar/postgresql/<version>/bin/createuser -s postgres

Now, it is set up, login using psql -U postgres -h localhost or use PgAdmin for GUI.

By default user postgres will not have any login password.

Originally published at

  1. Install Homebrew
  2. brew install postgis
  3. If it fails due to permission issue:
  • sudo chown -R “$USER”:admin /usr/local to affect every sub directory of local or you can only mention the directory pointed by Homebrew

4. Login: psql -U postgres -h localhost -d gis

  • Here gis is the database to which I want to add Postgis capabilities

5. `CREATE EXTENSION postgis;`

6. Login to pgAdmin GUI software to check the functions and views added to this DB! These are all geospatial functions.


Originally published at

Nitin Pasumarthy

Applied Deep Learning Engineer | LinkedIn

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store