Created
January 19, 2018 19:54
-
-
Save smnorris/fb784de1fd144d3e9c37fa0c7d6c8782 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sudo apt-get update | |
sudo apt-get upgrade | |
# gdal | |
sudo add-apt-repository ppa:ubuntugis/ppa | |
sudo apt-get update | |
sudo apt-get install gdal-bin libgdal-dev | |
# postgres/postgis | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' | |
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-contrib postgresql-10-postgis-2.4 postgresql-server-dev-all | |
# Sub-process /usr/bin/dpkg returned an error code (1) | |
sudo dpkg --configure -a | |
# create user, db | |
createuser -P -s -e gis3 | |
sudo -u postgres createdb postgis | |
sudo adduser gis3 | |
# create pg shortcuts | |
# create .path and add lines below | |
cd | |
nano .path | |
# ------------ | |
# save pg typing | |
#export PGDATA=/etc/postgresql/10/main | |
#export PGHOST=localhost | |
#export PGPORT=5432 | |
#export PGDATABASE=postgis | |
#export PGUSER=gis3 | |
# reference .path in .profile | |
nano .profile | |
# add these lines | |
# -------- | |
# save pg typing | |
# export PGDATA=/etc/postgresql/10/main | |
# export PGHOST=localhost | |
# export PGPORT=5432 | |
# export PGDATABASE=postgis | |
# export PGUSER=gis3 | |
# put these together into a sqlalchemy URL | |
# http://docs.sqlalchemy.org/en/latest/core/engines.html | |
# note that the password is stored here in plain text viewable by anyone... | |
#export DATABASE_URL='postgresql://'$PGUSER'@'$PGHOST':'$PGPORT'/'$PGDATABASE | |
# ------------ | |
# create .pgpass & add pwd | |
nano .pgpass | |
# *:*:*:gis3:gis3 | |
chmod 600 .pgpass | |
# python | |
sudo apt-get install python-pip | |
pip install --upgrade pip | |
pip install --upgrade --user virtualenv | |
# lostgis | |
sudo pip install pgxnclient | |
sudo pgxn install lostgis | |
pgxn load -d postgis lostgis | |
# install psql2csv | |
curl https://raw.githubusercontent.com/fphilipe/psql2csv/master/psql2csv > psql2csv | |
sudo cp psql2csv /usr/local/bin/psql2csv | |
sudo chmod +x /usr/local/bin/psql2csv | |
# create whse_basemapping and add tiles needed for most projects | |
psql -c "CREATE SCHEMA whse_basemapping" | |
pip install --user bcdata | |
pip install --user pgdata | |
bcdata --email [email protected] bcgs-1-20-000-grid | |
ogr2ogr \ | |
--config PG_USE_COPY YES \ | |
-f PostgreSQL \ | |
PG:"host=localhost user=gis3 dbname=postgis password=gis3" \ | |
-nln bcgs_20k_grid \ | |
-t_srs EPSG:3005 \ | |
-lco OVERWRITE=YES \ | |
-lco SCHEMA=whse_basemapping \ | |
-lco GEOMETRY_NAME=geom \ | |
BCGS_20K_GRID.gdb \ | |
WHSE_BASEMAPPING_BCGS_20K_GRID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment