{{tag>computer uni 2016}} /*[{{/2016/thispage/title.jpg?192x192&noshowtitle&noshowname }}]*/
12. April 2016
~~META:date created = 2016-04-12~~ ~~META:date modified = 2016-04-12~~ = PostgreSQL/PostGIS == ph Tutorial! $ su - postgres $ createdb $ psql =# \c =# 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 -f $i; done $ dropdb 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 * http://www.tutorialspoint.com/postgresql/ * PostGIS * http://workshops.boundlessgeo.com/postgis-intro/index.html * http://revenant.ca/www/postgis/workshop/index.html * 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'; * see http://stackoverflow.com/questions/7695962/postgresql-password-authentication-failed-for-user-postgres == Installation See http://workshops.boundlessgeo.com/postgis-intro/index.html == Installation OLD * {{{apt-get install postgis pgadmin3}}} Trying to follow * http://revenant.ca/www/postgis/workshop/creatingdb.html Doing postgres@localhost $ psql \password Enter password: ... ... * http://stackoverflow.com/questions/2942485/psql-fatal-ident-authentication-failed-for-user-postgres 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 * See http://www.asconix.com/howtos/debian/postgresql-postgis-debian-howto