- Install the prerequisite packages:
sudo apt-get install packaging-dev postgresql postgresql-server-dev-9.1 libxml2-dev libgeos-dev libproj-dev libgdal-dev - Download the sources (e.g. for PostGIS 2.1.0):
wget http://download.osgeo.org/postgis/source/postgis-2.1.0.tar.gz - Extract the sources and go into extraction folder:
tar xvzf postgis-2.1.0.tar.gz; cd postgis-2.1.0 - Configure the sources
./configure - Compile PostGIS
make - Install the compiled PostGIS extension
sudo make install - Use PostGIS within PostgreSQL:
CREATE EXTENSION postgis;
Posts mit dem Label PostgreSQL werden angezeigt. Alle Posts anzeigen
Posts mit dem Label PostgreSQL werden angezeigt. Alle Posts anzeigen
Dienstag, 17. September 2013
Build and install latest PostGIS in Ubuntu Linux
If you need to stick with the latest PostGIS version for your PostgreSQL-database, you either have to find a suitable PPA or simply build the extension yourself, because Ubuntu's PostGIS version is out-of-date. Instead of using 3rd party PPAs, I recommend to build it yourself the following way:
Freitag, 6. September 2013
Process PostgreSQL data in R with Ubuntu Linux 12.04
Here is the ultimate overview for all who like to work with R in Ubuntu and who want to process data from PostgreSQL. As a requirement, I assume that you already setup your PostgreSQL database.
- Step: Install dependencies (PostgreSQL, JDBC-Connector for PostgreSQL and R)
sudo apt-get install postgresql libpostgresql-jdbc-java r-base-core r-cran-rjava r-cran-dbi
- Step: Open Terminal & run R with
R
- Step: Install JDBC-Package (RJDBC) for R
install.packages(c("RJDBC"))
- Step: Connect to your database from within R
# Include JDBC package
library(RJDBC)
# Initialize JDBC PostgresSQL driver
drv <- JDBC("org.postgresql.Driver", "/usr/share/java/postgresql-jdbc4-9.1.jar", identifier.quote="`")
# Establish connection to database
conn <- dbConnect(drv, "jdbc:postgresql://localhost/database", "user", "pw")# Run your SQL select query
data <- dbGetQuery(conn, "select * from iris where Species='setosa'") - That's it :)
Donnerstag, 2. Mai 2013
R mit PostgreSQL unter Ubuntu 12.04
Hier die ultimative Übersicht für alle die gerne mit R unter Ubuntu arbeiten und Daten aus PostgreSQL verwenden möchte. Ich geh davon aus, dass die PostgreSQL-Datenbank jeder allein einrichten kann.
- Schritt: Abhängigkeiten (PostgreSQL, JDBC-Connector für PostgreSQL und R) installieren
sudo apt-get install postgresql libpostgresql-jdbc-java r-base-core r-cran-rjava r-cran-dbi
- Schritt: Terminal öffnen & R starten mit
R
- Schritt: JDBC-Paket (RJDBC) für R installieren
install.packages(c("RJDBC"))
- Schritt: Verbindung zur Datenbank aus R herstellen
# JDBC-Paket einbinden
library(RJDBC)
# JDBC-PostgresSQL-Treiber initialisieren
drv <- JDBC("org.postgresql.Driver", "/usr/share/java/postgresql-jdbc4-9.1.jar", identifier.quote="`")
# Verbindung zur Datenbank herstellen
conn <- dbConnect(drv, "jdbc:postgresql://localhost/datenbank", "user", "pw")# SQL-Query ausführen
data <- dbGetQuery(conn, "select * from iris where Species='setosa'") - Fertig :)
Abonnieren
Posts (Atom)
