Planet QGIS

May 10, 2012

Tim Sutton (Linfiniti)

Installing PostGIS 2.0 on ubuntu

PostGIS 2.0 is out and the awesomness continues! You can install PostGIS 2.0 on Ubuntu using packages which is exactly what I am going to show you here. Read on for details on how to get up and running and do your first simple raster analysis! Note: You should make good backups first!   Before we... Read more »

by Tim Sutton at May 10, 2012 10:24 PM

Underdark

Glowing Hot Maps – QGIS Meets Gimp

Waiting time is over, Gimp 2.8 is finally here. That is reason enough to take it for a quick test run!

How about a new look for the QGIS user map?

This “glowing hot” map was made using the Gimp filter of the same name:

For the user point layer, I selected a simple point style with high transparency and separately exported land and user points from print composer.

user points as exported from QGIS

In Gimp, I applied the “glowing hot” filter to the user points and combined the layers. The trick here is to first use “Color to alpha” on the user point layer and turn black to transparent. This way, the “glowing hot” filter will only be applied to the remaining points.

Gimp 2.8 RC1 is close enough to the previous version to get comfortable fast. I like the single-window mode even if it’s hard to tell which part of the GUI has the focus sometimes.

Open source GIS and image editing for a perfect work flow.


by underdark at May 10, 2012 08:57 PM

May 09, 2012

Underdark

Batch Shapefile Clipping

This is just a quick “note to self” on some interesting information I picked up from the QGIS mailing list today. Kudos to David J. Bakeman for sharing this:

If both the input and the output arguments to ogr2ogr are directories then it will clip all of the shapes in the source directory and write them to the output directory.

So: ogr2ogr -clipsrc mask.shp output source

Shapefiles are the default so you don’t even need the -f “ESRI Shapefile”.


by underdark at May 09, 2012 06:36 AM

May 05, 2012

Underdark

Loading Zipped Files Directly into QGIS

Today’s hot topic on the mailing list was a recently added feature which enables QGIS to load data directly from ZIP archives.

To get the contents of a ZIP archive display in the browser dock, it is necessary to activate this feature in the Options dialog. The setting is called “Scan for contents of compressed files (.zip) in browser dock” and is located right at the bottom of the first tab. Both “basic scan” and “full scan” settings seem to work fine:

Settings – Options

In the file browser panel, archives are now listed like any other folder and their content can be added to the map through both double click and drag and drop.

This can help save tons of disk space: The NaturalEarthData.zip in this example is 280 MB big while the unzipped folders take more than 700 MB.


by underdark at May 05, 2012 07:03 PM

May 03, 2012

Tim Sutton (Linfiniti)

Quick Tip: Build the latest QGIS nightly build as a standalone installer for Windows

I’m running a training course next week and will be basing it on the nightly build of QGIS, so I wanted to quickly build an installer for use on the course. I simply ran these commands (starting in a checkout of the Quantum GIS source code). sudo apt-get install nsis cd ms-windows/osgeo4w ./creatensis.pl qgis-dev cd... Read more »

by Tim Sutton at May 03, 2012 10:50 PM

April 30, 2012

Tim Sutton (Linfiniti)

Report back from the QGIS hackfest in Lyon, April 2012

Its been two weeks now since I returned from the QGIS Hackfest in Lyond, France, but I haven’t had the time to write up my experiences yet….until now. Read on for more! It was the first time that the hackfest (which is a twice yearly event) has been held in France. Lyon is a lovely... Read more »

by Tim Sutton at April 30, 2012 12:36 PM

April 16, 2012

SpatialGalaxy

What's New in QGIS Plugins

Here’s a summary of recent additions and updates to plugins in the QGIS repository.

  • FlowMapper (0.1.1) - Generates flow lines between discreet nodes for depicting spatial interaction data (e.g. migration).
  • Query By Example (0.2) - Select features by location.
  • Item Browser (1.6.0) - Browse a multiple selection with auto-zooming to feature and an option to open feature form.
  • Custom Launcher (1.1.0) - Customize your own actions to launch your preferred apps or commands within QGIS.
  • Profile Tool (3.3.1) - Plots terrain profile
  • qSearch (1.3.0) - Produces a friendly interface to perform and save searches in a layer.
  • Quick Finder (1.0.0) - Dockable dialog to find a feature by its ID in a layer.
  • SEXTANTE (1.0.3) - SEXTANTE for QGIS
  • Link It (1.1.1) - Link It is a QGIS plugin to link a feature to another. By clicking on map, the plugin will then automatically save the feature’s ID in the appropriate field defined by the user. This plugin requires ItemBrowser.
  • QuickMultiAttributeEdit (0.8) - QuickMultiAttributeEdit plugin provides a very quick and handy way to update a feature for the selected attributes into the current/active layer.

Installing Plugins

To install any of these plugins:

  1. Open the Python plugin installer: Plugins->Fetch Python Plugins
  2. Check to see if you have the new Official repository in your list of plugins by clicking on Repositories tab. The URL is http://plugins.QGIS.org/plugins/plugins.xml.
  3. If the new repository isn’t in the list, add it by clicking the Add button. Give it a name and insert the URL http://plugins.QGIS.org/plugins/plugins.xml
  4. Some plugins may be flagged experimental. Make sure you have allowed experimental plugins on the Options tab of the plugin installer
  5. Click on the Plugins tab
  6. Select the desired plugin from the list and click Install

April 16, 2012 08:12 PM

April 09, 2012

Tim Sutton (Linfiniti)

A new sphinx theme

During the Zurich QGIS hackfest we had some extended discussions about migrating our documentation away from LaTeX to sphinx because the latter offers a more approachable syntax for casual documentation writers and has good support for internationalisation via gettext. This week I am going to our first 2012 QGIS hackfest (to be held in Lyon,... Read more »

by Tim Sutton at April 09, 2012 10:01 PM

April 06, 2012

Underdark

QGIS Server on Windows7 Step-by-step

After my successful experiment with QGIS Server on Ubuntu, I took a shot at Windows7. These are my notes on installing QGIS Server following the instructions on the wiki.

Installation

Using OSGeo4W installer it is easy to install QGIS Server: Just mark qgis-server for installation from “Web” category (in the “Advanced” installation).

All other necessary packages will be selected automatically.

As mentioned on the wiki, the next step is to tell Apache which port number to use. Apache (2.2.14-4 from OSGeo4W) does not have any default IP/port set and it fails to start. To fix this, we need to edit the file

c:/osgeo4w/apache/conf/httpd.conf

and change

Listen @apache_port_number@

to our needs, e.g. to listen on port 80

Listen 80

The last thing I had to do to get QGIS Server working was to copy two files
libeay32.dll and ssleay32.dll
from C:\OSGeo4W\apache\bin
to C:\OSGeo4W\apps\qgis\bin.

The GetCapabilities request should work now

http://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

Adding a QGIS project file

To add a project file to the server, we stay in C:\OSGeo4W\apps\qgis\bin. If we put a project file in this directory, it will be served by default (without having to pass the optional map parameter).

For this test, I added my vienna.qgs project file. This is how my QGIS bin folder looks like (notice the .dll files we copied from Apache/bin and the project file):

Next, we have to restart Apache to force QGIS Server to load the project file. The OSGeo4W installation provides a handy “Apache-Monitor” GUI to restart Apache. If it fails, try to reboot ;)

The project layers are now available through WMS and can be loaded into your client.

QGIS "Add WMS Layer" dialog with my newly created WMS

Conclusion

That wasn’t bad. The wiki page was very helpful and I didn’t encounter any real problems. Editing a config file and copying a few .dlls is easy enough.

Since linking files is not one of Windows’ strengths, I’d expect a server with multiple projects to get quite messy. But it certainly works for home use and experiments.


by underdark at April 06, 2012 05:11 PM

SpatialGalaxy

QGIS Plugin of the Week: qNote

This week we look at a newly arrived plugin named qNote. This plugin allows you to create a note and store it in a QGIS project file. When the project is loaded, the note is restored and can be viewed in the qNote panel.

This little plugin provides a way to attach metadata to a project. Things you might want to include in a note are:

  • Content of the project
  • Purpose
  • Area of interest
  • Where the data came from
  • Who created the project

This information can be helpful when sharing a project or when you forget what you did six months after the fact.

Here is a screenshot showing qNote in action:

qNote Plugin

Installing the Plugin

To install the plugin:

  1. Open the Python plugin installer: Plugins->Fetch Python Plugins
  2. Check to see if you have the new Official repository in your list of plugins by clicking on Repositories tab. The URL is http://plugins.qgis.org/plugins/plugins.xml.
  3. If you have it, skip to step 6. If the new repository isn’t in the list, add it by clicking the Add button. Give it a name and insert the URL http://plugins.qgis.org/plugins/plugins.xml
  4. qNote is currently flagged experimental. Make sure you have allowed experimental plugins on the Options tab of the plugin installer
  5. Click on the Plugins tab
  6. Enter qNote in the Filter box
  7. Select the qNote plugin and click Install

You can control the visiblity of the qNote panel from the View->Panels menu.

The README for the plugin can be viewed on the qNote GitHub page.

April 06, 2012 04:59 PM

April 05, 2012

SpatialGalaxy

Getting Support for QGIS

The QGIS project has a number of support channels. Like many open source projects, these are loosely coupled. Recently the forum was made read-only and this has prompted a number of questions and concerns about how to receive support. This post outlines the ways in which you can get your questions answered.

Home Page

The QGIS home page has links to all the documentation and community resources. The navigation panel on the left has links to both the Community resources and the manual.

To quickly see links to all the resources, click the Need Help? button on the home page. You’ll find links to:

  • User Manual
  • Wiki
  • Mailing Lists
  • StackExchange

StackExchange

GIS StackExchange allows you to ask questions and get answers from a wide range of users and experts in the GIS realm. If you have a question specific to QGIS, tag it with the qgis keyword, otherwise use an appropriate tag.

Since StackExchange is question-based, you should not ask multiple questions in a single posting.

Also, make sure you flag the question as answered once you receive a satisfactory response.

Mailing Lists

The QGIS project maintains a number of mailing lists. For most people, the two of interest are qgis-user and qgis-developer:

  • qgis-user: Use this list for discussion of QGIS in general, as well as specific questions regarding its installation and use.

  • qgis-developer: Used for discussion of development issues, plans, and features. If you plan to contribute code or patches to the project or write your own Python plugins, you’ll find this list useful.

If you just want to browse or search the mailing lists without subscribing, they are available on Nabble.

IRC

IRC (Internet Relay Chat) is a method of communication used widely by open source communities. On any given day you will find both developers, contributors, and users monitoring the #qgis channel on irc.freenode.net.

To use IRC, you’ll need a client application for your computer, tablet, or smartphone.

Here are a couple of guidelines for using the #qgis channel:

  1. If you have a question, don’t ask if you can ask, just state your question
  2. If no one responds, it’s not because they hate you or think you are a dullard, but are busy or don’t know the answer to your question

The QGIS IRC community is very friendly and helpful. Give it a try.

Search the Internet

All of the web resources for the QGIS project are indexed by search engines. Searching for your specific question can often lead you to the answer you are looking for, whether it be in a blog, on a mailing list, or the QGIS web site itself.

In addition to your favorite search engine, try DuckDuckGo for more targeted search results.

Shameless Plug

If you need a good introduction to open source GIS applications, tools, and scripting, take a look at my book.

April 05, 2012 03:02 PM

March 31, 2012

GFOSS

GRASS GIS Community Sprint 2012 - 23-28 May 2012, Prague, Czech Republic

The next "GRASS GIS Community Sprint" will take place from May 23 to May 28, 2012 in Prague, Czech Republic directly following the Geoinformatics FCE CTU 2012 conference.

This GRASS Community Sprint is a great occasion for you to support the development by actively contributing to the source code, manuals or likewise. It is a get together for GRASS project members and supporters to make decisions and tackle larger problems. For this meeting, we welcome people committed to improving the GRASS GIS project. This includes developers, documenters, bug reporters, translators and others.

Timing and Duration:

May 23, 2012 (day of arrival) - May 28, 2012 (day of departure)

Venue:

Department of Mapping and Cartography Faculty of Civil Engineering, Czech Technical University in Prague

For more detailed information, please visit
http://grass.osgeo.org/wiki/GRASS_Community_Sprint_Prague_2012

by markusN (noreply@blogger.com) at March 31, 2012 08:37 PM

SpatialGalaxy

QGIS Forum Is Closed---What Do You Think?

The forum (http://forum.qgis.org) has been closed for new registrations and marked read-only. Users have been encouraged to use http://gis.stackexchange.com instead.

If you have an thoughts on the closure, good, bad, or otherwise, please comment.

March 31, 2012 04:35 PM

March 30, 2012

Underdark

QGIS Server on Ubuntu Step-by-step

This post summarizes my notes about installing QGIS Server on Ubuntu, adding a QGIS project file to the server and using the WMS in an OpenLayers application.

Installation

First, it’s useful to figure out the Ubuntu version:

lsb_release -a

Since my server runs “lucid”, I add the following package sources to /etc/apt/sources.list (as described in the QGIS installation documentation)

deb http://qgis.org/debian lucid main
deb-src http://qgis.org/debian lucid main

Before we can install anything, we need to add the key and update the package list

gpg --keyserver keyserver.ubuntu.com --recv 1F9ADD375CA44993
gpg --export --armor 1F9ADD375CA44993 | sudo apt-key add -
sudo apt-get update

Now we can install QGIS Server and the necessary Apache package

sudo apt-get install qgis-mapserver libapache2-mod-fcgid

It never hurts to restart Apache :)

sudo /etc/init.d/apache2 restart

Let’s test the installation before we proceed. The GetCapabilities request should already work

http://10.101.21.28/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

Adding a QGIS project file

It’s time to add a QGIS project to our server. To do that, we move to the QGIS Server folder

cd /usr/lib/cgi-bin

where you should find qgis_mapserv.fcgi and wms_metadata.xml.
I’ve decided to have one folder for each project file. My first project is “vienna”.

sudo mkdir vienna
cd vienna

qgis_mapserv.fcgi and wms_metadata.xml can now be linked into this new folder

sudo ln -s ../qgis_mapserv.fcgi .
sudo ln -s ../wms_metadata.xml .

The only thing that’s missing anymore is a QGIS project file. It can be copied or linked into the folder. After restarting Apache, we should be good to go.

Let’s test the setup using “Add WMS Layer” in QGIS by adding the service URL such as

http://10.101.21.28/cgi-bin/vienna/qgis_mapserv.fcgi

and ticking “Ignore GetMap URI …” and “Ignore GetFeature URI …”.

After clicking “Connect”, all layers from the project file we added should get listed and we can select and load them.

QGIS Server can serve as many project files as you want. There a different ways to organize your server but I would simply add a new folder (like the “vienna” folder in this example) and link in the executable and project file.

Using QGIS Server WMS in OpenLayers

Of course QGIS Server doesn’t just talk to QGIS Desktop but to any other WMS client that conforms to the standard. One classic use case is to add the WMS layers to an OpenLayers application. This is rather simple but I’ll add it here for the sake of completeness:

I used to have a Geoserver WMS base layer in my application. The only lines of code that needed to be changed to migrate to QGIS Server were the service URL and the layer names.

    wms = new OpenLayers.Layer.WMS(
        'roads', "http://10.101.21.28/cgi-bin/vienna/qgis_mapserv.fcgi",
        {
            layers: 'roads', 
            format: 'image/png';
            bgcolor: '#fafafa'
        }, 
        {
            buffer: 1, 
            isBaseLayer: true, 
            graphicZIndex: 0, 
        }
    );

Standardized services are great!


by underdark at March 30, 2012 09:31 AM

March 29, 2012

Tim Sutton (Linfiniti)

Specifying options in the QGIS GDAL Tools

You probably looked at the GDAL Tools (under the raster menu in QGIS) and  blissfully ignored that ‘Creation Options’ panel that appears near the bottom of some dialogs. This is definately a power user feature, but a very handy one. In this quick article I will show you how to compress the rasters you create... Read more »

by Tim Sutton at March 29, 2012 12:12 PM

March 25, 2012

Tim Sutton (Linfiniti)

A python layer action to open a wikipedia page in QGIS

One of the really cool features in QGIS that doesn’t get much press is the ability to run actions based on a feature selection. Under 1.7.4 this works by using the identify tool and then choosing an action from the action list in the identified feature(s) attributes. A new improvement in QGIS master (and should... Read more »

by Tim Sutton at March 25, 2012 09:09 PM

March 24, 2012

Tim Sutton (Linfiniti)

Another bash one-liner – load all natural earth layers into postgis in one go

Having a good world dataset is kind of essential for most GIS users to have as a standard reference dataset, give context to maps and so on. Anita Graser’s recent blog post about the Natural Earth Data project added another nice dataset to my world dataset collection. The Natural Earth Data set (I got the... Read more »

by Tim Sutton at March 24, 2012 08:51 PM

March 23, 2012

Underdark

Adding Raster Layer Support to Time Manager

So far, Time Manager has been limited to vector layers. Support for raster layers has been on the wish list for quite a while. I’ve been considering different approaches and for now I have settled with one that keeps the way how raster layers work as close to the workings of vector layers as possible:

All layers have to be loaded before they can be added to Time Manager. The layers are added one-by-one and start and end time values are defined. (This differs from vector layers where start/end attribute are defined instead.) All raster layers that are not within the current time frame are set to 100 % transparency.

I’m not certain yet whether this is a good approach though. I’ll probably keep trying different approaches for a while.

This is a screen cast of the current status:

The plugin source is available on Github, as usual. It’s still going to take a while until there will be a plugin package including this feature.

I’m looking forward to reading your comments here or on Youtube. Do you think this approach is usable?


by underdark at March 23, 2012 11:06 PM

March 21, 2012

Underdark

Migrating a QGIS Project to New Symbology and Labeling

This is a follow-up to my recent “Natural Earth Quick Start Kit” post in which I presented the great quick start kit provided by the Natural Earth team. The QGIS project file they provide was written in QGIS 1.4 with both old symbology and old labeling:

Original Natural Earth Quickstart map centered on the Mediterranean

Since then a lot has changed. QGIS has a new powerful labeling engine which avoids label collisions and more advanced layer symbology. If that’s not reason enough to switch, it is also worth noting that both old systems will most certainly be removed for QGIS 2.0 release. Luckily, switching is pretty easy:

Switching to new symbology

In QGIS 1.7.4, switching to new symbology is very straight forward: Click the “new symbology” button in the upper right corner of the style tab and confirm the popup message. That’s it.

Switching to new labeling

Changing from old to new labeling is less automated. It will help if you take notes about font, size and colors as well as scale ranges before deactivating labeling in layer properties. Enable new labeling from the labeling toolbar and fill in the settings you have written down.

One of the known issues with new labeling is that it is currently not possible to rotate the labels without also specifying the label position. In most projects, this won’t be an issue though.

Updating the Natural Earth project

Besides switching to the new infrastructure, I’ve applied some minor changes to increase readability:

  • Buffers for city labels help where labels overlap with equally black country borders.
  • Buffers for capital symbols (stars) make them stand out over border lines.
  • Suppressed labeling for marine polygons smaller than 10mm avoids clutter.
  • Thinner river line styles with rounded corners make the map look cleaner.
  • A little halo around the land masses looks friendly.

The same map with new labeling and new symbology

I’ve uploaded the new project file version to QGIS Ressources on Github if you want to give it a try.


by underdark at March 21, 2012 04:41 PM

March 20, 2012

Tim Sutton (Linfiniti)

Retrospectively creating a branch in GIT

I often do this – I work away on my master branch and suddenly realise ‘damn I should have branched before I started this’. Usually this happens because what I think will be a trivial change snowballs into something much more sweeping. I thought I would record here how to deal with situations like this... Read more »

by Tim Sutton at March 20, 2012 12:50 PM