Build QGIS master with Oracle provider yourself on CentOS7

So you are in a corporate environment using RED-HAT or CentOS, and need QGIS or QGIS-server.

Marcus wrote how you can ‘easily’ install QGIS now on Fedora21 and Centos7

But “I want to run latest development version” you say? Well you can always compile from source :-)

For Debian if you follow the instructions from INSTALL.txt it is ‘easy’.

BUT something is missing? You say, your company has only Oracle dba’s so you are only allowed to work with Oracle instead of your beloved Postgis spatial database...

You need QGIS WITH the native Oracle provider (using OCI). So you see THAT icon:

the providers toolbar with Oracle provider in red

The providers toolbar with Oracle provider in red

Below you can find the steps to build QGIS on CentOS7 from source.

The system I have here is CentOS Linux release 7.1.1503 (Core)

IF on a fresh system without X: after the Core install (no X server) install latest Gnome Desktop:

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

Else: update your system:

yum update

Now make sure you enable the Extra Packages Enterprise Linux (EPEL) repository

# enable epel as root
cd /tmp
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
ls *.rpm
yum install epel-release-7-5.noarch.rpm
yum repolist

Thanks to Matthias and Volker there is a spec-file in Github, these are helpfull to determine all packages needed for our build system:

# from https://github.com/qgis/QGIS/blob/master/rpm/qgis.spec.template
# build tools
yum --enablerepo="epel" install
yum --enablerepo="epel" install gcc gcc-c++ cmake desktop-file-utils expat-devel fcgi-devel git flex bison gdal-devel geos-devel grass-devel gsl-devel

# rest (most from epel)
yum install libspatialite-devel postgresql-devel proj-devel PyQt4-devel PyQwt-devel python2-devel qextserialport-devel, qscintilla-devel qscintilla-python-devel qt4-devel qt-mobility-devel qt4-webkit-devel qwt-devel qca2-devel qca-ossl
# mmm
#No package PyQwt-devel available.
#No package qextserialport-devel, available.

yum install qt-mobility-devel qt4-webkit-devel qwt-devel qextserialport-devel qwtpolar-devel sip-devel spatialindex-devel sqlite-devel xorg-x11-server-Xvfb gpsbabel

My way to compile and run different QGIS version on Debian, is to compile in a ~/dev dir and install in ~/app dir. So:

mkdir -p ~/apps/qgis/master
mkdir -p ~/dev/
cd ~/dev
# clone the sources from Github (will be in ~/dev/QGIS is this way)
git clone https://github.com/qgis/QGIS.git
# create a build dir
mkdir ~/dev/QGIS/build
cd ~/dev/QGIS/build

Normally I use the curses based ‘gui’ ccmake to do the configure. We instruct it with the following values to ‘prefill’ those fields.

Note the .. on the end: we are running this from within the build ~/dev/QGIS/build dir and point to one dir lower:

ccmake -DWITH_QWTPOLAR=OFF -DCMAKE_BUILD_TYPE=Debug  -DCMAKE_INSTALL_PREFIX=~/apps/qgis/master ..

In the ccmake gui use the following keystrokes to configure and generate:

'c' to start configure: scripts will try to find dependencies, and ommisions will be shown
'e' if you are in the warning/error screen go back
'g' to generate the actual files

Most of the times you will need to do several ‘c and fix’ jumps before you can hit ‘g’.

But then:

make
# or even faster (if you have some cores available ...):
make -j8

This will take some time depending on your system, but if all went well you will have an output directory with a bin/qgis in it.

Now to install it in ~/apps/qgis/master do:

make install

Last part of this excercise is to create a little script which points to your freshly baked QGIS and some paths.

Put the following in a file named /usr/local/bin/qgis (as root):

# create a file /usr/local/bin/qgis to point to your install (YOU will be YOU :-) )

export LD_LIBRARY_PATH=/home/YOU/apps/qgis/master/lib/
# passing ALL parameters to qgis bin
# eg to be able to call a certain translation
# qgis --lang nl
/home/YOU/apps/qgis/master/bin/qgis "$@"

If you start QGIS now via qgis you will get some python errors, because some standard Python libs are missing. Install them via:

# now to run you'll need some python libs installed:
yum install qscintilla-python
# proably also:
yum install PyQt4-webkit
# gdal python bindings (will also get numpy and nose)
yum install gdal-python

That’s all to have a running QGIS master on Centos7!

But.. but... you promissed Oracle providers...

OK, first you need to register or go to this link and try to download:

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

You can only download as a registered user, it is free (but maybe your get a phonecall from Oracle....)

From above download the following zips (at this time):

mkdir -p ~/dev/oracle
mv instantclient-basiclite-linux.x64-12.1.0.2.0.zip ~/dev/oracle
mv instantclient-sdk-linux.x64-12.1.0.2.0.zip ~/dev/oracle

Note that you cannot wget them as you need to be authenticated via your browser. So download via your browser and:

# unzip both in ~/dev/oracle so you will have
unzip instantclient-basiclite-linux.x64-12.1.0.2.0.zip
unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip
# so you will have all Oracle stuff in:
/home/YOU/dev/oracle/instantclient_12_1

Now point to the libclntsh.so with:

cd ~/dev/QGIS/build
export LD_LIBRARY_PATH=/home/YOU/dev/oracle/instantclient_12_1/libclntsh.so.12.1

And do a new ccmake pointing to the include files and oracle library:

ccmake -DWITH_QWTPOLAR=OFF -DCMAKE_BUILD_TYPE=Debug  -DCMAKE_INSTALL_PREFIX=~/apps/qgis/master -DWITH_ORACLE=TRUE -DOCI_INCLUDE_DIR=/home/YOU/dev/oracle/instantclient_12_1/sdk/include -DOCI_LIBRARY=/home/YOU/dev/oracle/instantclient_12_1/libclntsh.so.12.1 ..

After this, I had to restart the build several times because it stopped with an unclear error, not sure what the problem was:

make -j8

Because the oracle provider wants to copy some drivers to qt system libs, do:

sudo make install
# OR do this by hand, you need the oracle lib in the right dir so do:
sudo cp /home/YOU/dev/QGIS/build/output/lib/qgis/plugins/sqldrivers/libqsqlocispatial.so /usr/lib64/qt4/plugins/sqldrivers/libqsqlocispatial.so

Then make sure that your ‘start script’ at /usr/local/bin/qgis contains the pointers to the Oracle libs too:

export LD_LIBRARY_PATH=/home/YOU/apps/qgis/master/lib/:/home/YOU/dev/oracle/instantclient_12_1
# passing ALL parameters to qgis bin
# eg to be able to call a certain translation
# qgis --lang nl
/home/YOU/apps/qgis/master/bin/qgis "$@"

And GO and connect to that Oracle database.

BUT please note: Postgis is nicer ;-)

QGIS Feature Frenzy on OSGEONL

Richard Duivenvoorde did a (dutch) QGIS Feature Frenzy on the OSGeo.nl meeting during the GeoBuzz in Den Bosch on Tuesday 25th December 2014.

Heard some interesting QGIS use cases there: QGIS/Postgis use for BGT, QGIS GMaps/Roam for Tree-asset Management etc etc

Presentation

You can download the original LibreOffice notes and slides here or only as pdf . Maybe it is usefull for somebody, feel free to re-use.

Picture from Raymond

Doing my first Feature Frenzy

Erwin Dijkhoff did live ‘sketch notes’ during the talks, see OSGeo nl Twitter

Thanks Erwin!

Sketch note from Erwin Dijkhoff

QGIS Feature Frenzy Sketch Note from Erwin Dijkhoff

Visit South Africa, almost The Big 5

Visit South Africa (SA)

One of the nice things about bigger Open Source projects like QGIS, is that the community is pretty international. So when Tim-QGIS-Sutton me invited for a visit to South Africa with my family,... we visited them and enjoyed SA :-)

Starting of as a holiday, I ended it with two weeks of work in the Swellendam office of Kartoza Tim’s current company.

Richard working in Kartoza offices behind 'standing desk'

Richard behind a ‘standing desk’ in Kartoza offices. Wondering what the blue bubble is? Wait for 5 seconds... Trying to fight stiff muscles and rsi related problems.

In this post: about the Big Five, QGIS/Docker work and a wired beads Tux.

Read more...

Tinkering with Mozilla Location Services

First there was OpenStreetmap, a crowd sourced map. Now, Mozilla started Mozilla Location Service:

“The Mozilla Location Service is a research project to investigate crowdsourced mapping of wireless networks (WiFi access points, cell towers, etc.) around the world.”

mozstumbler icon

Mozilla want to create a database with the positions and id’s of cell towers and wifi access points. The nice thing with such a db is that knowing the id’s of some nearby wifi access points or cell towers you can determine your location on earth pretty good, WITHOUT a gps.

Read more...

Use your GPS dongle with QGIS

So I had this GPS dongle laying on my table from the time I used TomTom on a Palm Treo (that is way before Android was alive) ...

my GPS bleutooth / USB dongle

It would be nice to make use of that GPS in combination with QGIS...

Read more...

New Business cards!

As a fresh company you need a logo, some vision and those dull business cards off course.

Just for those interested:

new business card

The business cards. There are two version: one with a map of Haarlem on the backside, and one with a Wold map, just because old maps are so beautiful :-)

In 1642 the city council commissioned the surveyors Hendrik Duijndam and Peter Wils to design a new expansion on the north side of the city. So the Haarlem map is a copper engraving from Joan Blaue in Amsterdam 1649 based on that survey. The world map is a pretty famouse one from Willem Bleau (around the same time as the Haarlem map).

Read more...

QGIS in a class room

This month Zuidt helped out the geography teacher of the Mendel College to setup a set of computers with QGIS and data.

We blogged about this here: http://www.qgis.nl/2014/04/22/qgis-in-de-klas-onder-windows/?lang=en

I hope this is usefull for other teachers willing to use QGIS to teach GIS.

Contact Richard Duivenvoorde if you want to know more about this kind of setups.

some kids in the class room doing QGIS

Zuidt

This is a first post. This english blog will contain information about projects or research projects from Zuidt.

logo