Last active
December 15, 2020 07:10
-
-
Save digitalsadhu/1c1798536e9b726c548d to your computer and use it in GitHub Desktop.
Installing postgis on mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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