Skip to content

Instantly share code, notes, and snippets.

@digitalsadhu
Last active December 15, 2020 07:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalsadhu/1c1798536e9b726c548d to your computer and use it in GitHub Desktop.
Save digitalsadhu/1c1798536e9b726c548d to your computer and use it in GitHub Desktop.
Installing postgis on mac
# installation commands
brew update
brew install postgresql
brew install postgis
# start the server
postgres -D /usr/local/var/postgres
# setup commands
createdb <name>
createuser --interactive <username>
# interactive cmd line tool for querying etc
psql
# once in psql...
# lists all databases
\list
# switch dbs
\connect <dbname>
# lists all tables in the current database
\dt
# database needs to have postgis extension installed
-- Enable PostGIS (includes raster)
CREATE EXTENSION postgis;
-- Enable Topology
CREATE EXTENSION postgis_topology;
-- fuzzy matching needed for Tiger
CREATE EXTENSION fuzzystrmatch;
-- Enable US Tiger Geocoder
CREATE EXTENSION postgis_tiger_geocoder;
# useful info here: http://postgis.net/install/
# importing esri shapefiles
# I used the gui tool pgShapeLoader.app which came with the mac osx postgis installer
# http://postgresapp.com/
# for command line import, try http://suite.opengeo.org/opengeo-docs/dataadmin/pgGettingStarted/shp2pgsql.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment