Skip to content

Commit

Permalink
PR #280 voor issue #278 docu BAG Extract from denboogert/patch-1
Browse files Browse the repository at this point in the history
Update bagextract.rst
  • Loading branch information
justb4 authored Apr 5, 2020
2 parents 3b8bf9b + 6613645 commit b0ca674
Showing 1 changed file with 67 additions and 89 deletions.
156 changes: 67 additions & 89 deletions doc/source/bagextract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,108 +66,86 @@ Afhankelijkheden
Installatie (Linux)
-------------------

- Ubuntu: beste is om eerst UbuntuGIS PPA aan je package repo toe te voegen, voor laatste versie Geo-tools als GDAL en PostGIS. ::
Instructies hieronder zijn voor Ubuntu 18.04. Bij andere distributies zal het enigszins afwijken.

apt-get install python-software-properties
add-apt-repository ppa:ubuntugis/ubuntugis-unstable
apt-get update

- Ubuntu: PostgreSQL+PostGIS . PostgreSQL is een OS relationele database (RDBMS). PostGIS is een extentie die van PostgreSQL een ruimtelijke (spatial) database maakt. Installatie PostgreSQL 9.1 + PostGIS 2.1 ::

$ apt-get install postgis postgresql-9.1 postgresql-contrib

# Server Instrumentation, met admin pack.
$ sudo -u postgres psql
psql (9.1.10)
Type "help" for help.

postgres=# CREATE EXTENSION adminpack;
CREATE EXTENSION

# Installatie controleren met ::

$ psql -h localhost -U postgres template1

$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.1 main 5432 online postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log

# Enablen locale connecties in ``/etc/postgresql/9.1/main/pg_hba.conf``.

# Database administrative login by Unix domain socket
local all postgres md5

# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5


# PostGIS en template opzetten. Ook dit nodig om Postgis extension aan te maken.
$ apt-get -s install postgresql-9.1-postgis-2.1

# Anders krijg je op ``CREATE EXTENSION postgis`` dit ::
- Bronbestanden downloaden op de achtergrond (duurt wat langer) ::
$ wget http://geodata.nationaalgeoregister.nl/inspireadressen/extract/inspireadressen.zip &
- Bag-extract downloaden (pas eventueel versie aan) en uitpakken ::
$ wget https://github.com/nlextract/NLExtract/releases/download/1.4.1/nlextract-1.4.1.tar.gz
$ tar xzvf nlextract-1.4.1.tar.gz

# ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory
- PostgreSQL + PostGIS. PostgreSQL is een OS relationele database (RDBMS). PostGIS is een extentie die van PostgreSQL een ruimtelijke (spatial) database maakt. ::
$ sudo apt-get install postgresql postgresql-contrib postgis

# Template DB``postgis2`` opzetten. ::
- PostgreSQL locale verbindingen toestaan (wijzig inhoud van `pg_hba.conf` in onderstaande) ::
$ sudo nano /etc/postgresql/10/main/pg_hba.conf
# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local all postgres peer

# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication all peer
#host replication all 127.0.0.1/32 md5
#host replication all ::1/128 md5

- PostgreSQL opnieuw opstarten ::

$ sudo systemctl restart postgresql
- Database `bag` aanmaken met benodigde extensies (tekencodering UTF8 is belangrijk en default) ::

$ su postgres
createdb postgis2
psql -h localhost postgis2
postgis2=# CREATE EXTENSION postgis;
# CREATE EXTENSION
postgis2=# CREATE EXTENSION postgis_topology;
# CREATE EXTENSION

# Nieuwe database "bag" aanmaken met template "postgis2"
# NB belangrijk is dat de bag DB de character-set UTF8 (-E UTF8) heeft!
createdb --owner postgres -T postgis2 -E UTF8 bag

- optioneel: Python package afhankelijkheden installeren bijv
::

apt-get of yum install python-setuptools (voor easy_install commando)
apt-get of yum install python-devel (tbv psycopg2 bibliotheek)
apt-get of yum install postgresql-devel (tbv psycopg2 bibliotheek)

- Onder Ubuntu zijn dat de volgende packages
::

sudo apt-get install python-setuptools
sudo apt-get install python-dev
sudo apt-get install libpq-dev

- razendsnelle native XML parsing met libxml2/libxslt libraries samen met Python lxml:
kan meer dan een factor twee in snelheid schelen...
Zie http://lxml.de/installation.html
::
createdb bag
psql bag
# CREATE EXTENSION postgis;
# CREATE EXTENSION postgis_topology;
\q
exit
- Python installeren ::
sudo apt-get install python-setuptools
sudo apt-get install python-dev
sudo apt-get install libpq-dev

apt-get of yum install libxml2
apt-get of yum install libxslt1.1
apt-get of yum install python-lxml
- Lxml installeren ::

- GDAL (www.gdal.org) met Python bindings voor OGR geometrie-parsing en geometrie-validatie (NLX v1.1.0 en hoger)
::
sudo apt-get install libxml2
sudo apt-get install libxslt1.1
sudo apt-get python-lxml

apt-get of yum install gdal-bin
apt-get of yum install python-gdal
- GDAL (www.gdal.org) met Python bindings voor OGR geometrie-parsing en geometrie-validatie ::
sudo apt-get install gdal-bin
sudo apt-get install python-gdal

- de PostgreSQL python bibliotheek psycopg2
::
- Python package voor PostgreSQL `psycopg2` ::

sudo easy_install psycopg2
sudo apt-get install python-psycopg2

- Python package "argparse"
::
- Python package `argparse` ::

sudo easy_install argparse
sudo apt-get install python-argparse

- NB als je een proxy gebruikt via http_proxy doe dan easy_install -E (exporteer huidige environment)

Installatie (Windows)
---------------------
Expand Down

0 comments on commit b0ca674

Please sign in to comment.