Tuesday 30 June 2015

How to correctly install QGIS with plugins and GRASS-integration from source?



I'm running a Sabayon GNU/Linux (based on Gentoo) at my home desktop system and I want to install Quantum-GIS.


I'm currently using the qgis-1.7.0-package from the repositories. But this is somehow very minimal. It does not support downloading plugins (Plugins > Fetch Python Plugins disabled: I think this is to avoid security risks.) and it doesn't seem to be connected with GRASS in any way (at least in any visible way).


The official download guide is not very helpful as it only describes ways to install qgis in major linux distributions (Ubuntu, Debian, etc...). Anyways, this guide suggests to look out for packages like python-qgis or qgis-plugin-grass. This seems to be what I am looking for, but it is not included in Sabayon/Gentoo-repositories. (This seems to be a major issue with any non-Ubuntu/non-Debian Linux-distribution.)


My question is, how to install Quantum-GIS with full python-plugin-support und full GRASS-plugin-integration from source, where to get required source code for everything and how to compile it correctly?


The result should look like something I've found in this comment pointing to this video tutorial.


Update 01/01/2013: Question now focuses on compiling all packages on my own. I found out repositories are not very helpful with this issue [1,2,3,4,5].



Answer



How to compile latest QuantumGIS on a non-Debian/Ubuntu Linux-system with Python-plugin-support and GRASS-integration? I finally did it!


Download and prepare dependencies. Most of them I could find in repositories, sometimes package names vary. Dependencies from INSTALL read-me file:




  • CMake >= 2.6.2

  • Flex

  • Bison >= 2.4

  • Qt >= 4.4.0

  • Proj >= 4.4.x

  • GEOS >= 3.0

  • Sqlite3 >= 3.0.0

  • GDAL/OGR >= 1.4.x

  • Qwt >= 5.0

  • GRASS >= 6.0.0


  • Python >= 2.5

  • SIP >= 4.8, PyQt >= must match Qt version, Qscintilla2


In Sabayon 10, I installed the following packages from repositories:


# equo install cmake gcc geos gdal openstreetmap-icons doxygen graphviz fcgi gsl openscenegraph qwt-5.2.1 pyqwt proj pkg-config txt2tags postgresql-base gnome-pty-helper qscintilla lapack-atlas blas-atlas wxpython shapelib gpsbabel qwtpolar

I did not manage to integrate the prebuild GRASS-6.4.1 from repositories, some libraries were missing. In addition libspatialindex and libspatialite are not available in the repositories. I had to download all three packages and install them manually:




  • I downloaded libspatialindex version 1.8.0 from here, compiled and installed it:



    # cmake . && make && make install




  • I downloaded libspatialite version 4.0.0 from here, compiled and installed it:


    # ./configure --disable-freexl --disable-geosadvanced && make && make install




  • I downloaded GRASS GIS version 6.4.3-rc2 from here, compiled and installed it:


    # ./configure --enable-64bit --enable-shared --with-cxx --with-postgres --with-sqlite --with-gdal --with-python --with-wxwidgets --with-geos --with-x --enable-largefile && make && make install





Get latest source code of Quantum GIS from the official qgis site: qgis-1.8.0.tar.bz. I used the latest snapshot from github as I prefer most recent versions (currently it's the 1.9.0-master-branch).



  • unpack the source code

  • create a build directory inside the source code direcoty: $ mkdir build && cd build


  • Now, you tell cmake where your GRASS libs are, as explained here [via]. Note, the two dots at the end are required. Play with ls to find the libs:


    # cmake -DGRASS_PREFIX=/usr/local/grass-6.4.3RC2 -DGRASS_INCLUDE_DIR=/usr/local/grass-6.4.3RC2/include ..





  • If no errors occur, compile and install QuantumGIS:


    # make && make install




  • One last minor fix, due to this bug:


    # cd /etc/ld.so.conf.d/


    # echo '/usr/local/lib/qgis/' > qgis.conf


    # ldconfig





That's it! :)


QGIS-1.9.0-Master with Python plugins and GRASS integration.


More resources:



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...