- 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;
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 :)
Abonnieren
Posts (Atom)