12. April 2016
PostgreSQL/PostGIS
ph Tutorial!
$ su - postgres $ createdb <dbname> $ psql =# \c <dbname> =# CREATE EXTENSION postgis; =# SELECT postgis_full_version(); =# \q $ for i in *.shp; do shp2pgsql -I -s 4269 $i ${i%.shp} > ${i%.shp}.sql; done # evtl. -W "latin1" $ for i in *.sql; do psql -d <dbname> -f $i; done $ dropdb <dbname>
Go to QGIS, connect to created postgis database.
Delete Cache
# sync; /etc/init.d/postgresql stop; echo 1 > /proc/sys/vm/drop_caches; /etc/init.d/postgresql start
Tutorials
- PostgreSQL
- PostGIS
- Spatial constraints
- Squirrel example – https://davidcel.is/posts/distance-constraints-with-postgresql-and-postgis/
Importing UdeC data
- Admin site is http://docdiicc1.inf.udec.cl/phppgadmin/
- Choose PostgreSQL db, "Export", select download, not "Show"! → dump.sql file!
$ su - postgres $ createdb semqopti $ psql semqopti < dump.sql $ psql =# ALTER USER postgres PASSWORD 'password';
Installation
Installation OLD
apt-get install postgis pgadmin3
Trying to follow
Doing
postgres@localhost $ psql \password Enter password: ... ...
and
$ cd /usr/share/postgresql/9.4/contrib/postgis-2.1 $ psql -d mygis -f postgis.sql $ psql -d mygis -f spatial_ref_sys.sql