top logo
  • <<
  • Page 2 of 21 ( 420 posts )
  • >>
  • qgis


Last update:
Mon Apr 14 15:27:27 2014

A Django site.

Waiting for QGIS 2.2 – Composer Improvements (part 3)

Following on from parts 1 and 2, here’s some more composer changes which are coming in QGIS 2.2

  • Rotation support for all composer item types. Now anything you draw in a composer can be rotated, including scale bars, legends, attribute tables and html frames! Rotation of text labels has also been improved by making the border and background of labels respect the rotation of the label.
Every composer item can now be rotated...

Every composer item can now be rotated…

  • Resizing of rotated items has been improved. Now it’s possible to easily resize rotated items while keeping their correct shape. (There’s still one missing ingredient for complete support here – shear/perspective transforms. Unfortunately this will probably have to wait till 2.4).
Better resizing of rotated items

Better resizing of rotated items

  • Rulers can be shown or hidden in compositions
  • The ruler appearance has been tweaked, adding smaller divisions and better text placement
The ruler appearance has been tweaked

New tweaked appearance for rulers

  • A zoom to actual size button and short cut (Ctrl + 1) have been added
Zoom to 100%

New Zom to 100% button

  • Lastly, the status bar has a new zoom combo box, which shows the current zoom level and allows for quick zoom to several predefined levels. You can also enter an exact zoom level in the box for precise control.
New zoom levels combo box in the status bar

New zoom levels combo box in the status bar

As you can see, the print composer in QGIS 2.2 just keeps getting better! There’s a few other really exciting new additions which have landed recently too, but they deserve their own blog posts. Stay tuned…

Waiting for QGIS 2.2 – Gradient Fills

One of the big features I worked on for QGIS 2.2 is gradient fill symbols for polygons. In my view QGIS’ symbol support is one of its biggest strengths — the versatility of its symbol layers coupled with the powerful data defined properties support allows for so many effects which just aren’t possible in other GIS packages. Gradient fill support is a nice addition to these features and should help make QGIS even more attractive to cartographers. In this post I’m going to give a quick run through of how gradient fills work in QGIS, and some of the options available for tweaking them.

Gradient fills are enabled through the Style tab in the properties for a vector layer. The default fill for a polygon in QGIS is “Simple fill”, so to switch a layer to a gradient fill you first need to select the “Simple fill” layer, then change the “Symbol layer type” dropdown  to “Gradient fill”:

Gradient Fill type

As you can see, there’s a lot of options in QGIS which can be tweaked for gradient fills. I’ll run through each of them now and explain a little bit about how each one can be used.

Colour modes

QGIS supports two different types of colour modes for gradient fills. The first is a simple “Two color” gradient, where the colour smoothly blends from the first colour to the second. The second mode, “Color ramp” allows you to use any of the standard or user-defined QGIS colour ramps, which can consist of multiple colour stops:

Colour options in gradient fills

Colour options in gradient fills

So, when would you use these options? Well, any time you need more than two colours or need to tweak the position of any of the colours in the gradient you’ll have to use a colour ramp.  If instead you’re just wanting a quick-and-easy gradient then the two colour option might be more suitable.

One last important distinction is that the colours in a two colour gradient can be set using a data defined expression:

Data defined gradient colours

Data defined gradient colours. Please try to use them more tastefully then this!

Gradient types

The next option for gradient fills is rather self-explanatory: gradient types. QGIS supports linear, radial and conical gradients:

Gradient types

Coordinate modes

The coordinate mode option is a little trickier to explain. The default setting, “Object“, will cause the gradient to be drawn entirely within each separate feature. You can see in the example below that every lake feature is coloured with a gradient which starts with light blue in the top left and darkens to a deeper blue in the bottom right. This gradient fill is repeated for all the lake features:

Gradient object coordinate mode

The “Object” coordinate mode for gradient fills

In contrast, the “Viewport” coordinate mode causes the gradient to be drawn across the entire current view of the map. So only the lakes in the top left of the map are drawn with the light blue colour, and the lakes in the bottom right with the deeper blue:


The “Viewport” coordinate mode for gradient fills

The choice of coordinate mode will depend entirely on your cartographic desires for your map!

Reference points

QGIS gradient fills allow the setting of two “reference points“. These points control where the gradient fill begins and ends. It’s easiest to visualise how these work by imagining a square defined by the points (0, 0) in the top left and (1, 1) in the bottom right. The two reference points fall somewhere within this square. So, the default reference points of (0.5, 0) and (0.5, 1.0) represent points mid way along the top edge and and the bottom edge, respectively.

Now imagine that this square forms the bounding box for the feature being drawn (or the current map window, if in “viewport” coordinate mode). The default reference points mean that the gradient will be drawn from the middle of the top edge to middle of the bottom edge of the feature. Reference points of (0, 0) and (1, 1) would mean the gradient is drawn from the top-left to the bottom-right. Similarly, reference points of (0.5, 0.5) to (1.0, 1.0) would draw a gradient from the middle of the feature to the bottom right (good for radial gradients).

Example gradient reference points

There’s also the option to set either of the reference points as the feature centroid, which again can come in handy for radial or conical gradient types.

Gradient spread

If you’ve got your head around the reference points concept, then the next setting for gradient fills affects how the gradients spread. This takes effect whenever a gradient starts or ends before the bounds of the feature. The default setting of “pad” means that the gradient will simple “pad” out any extra space with the start or end gradient colour:


“Pad” spread – notice how the darker blue is stretched across the right side of each feature

Repeat” mode will tile the gradient across the feature:


“Repeat” spread

Finally, “reflect” mode will draw a reflected version of the gradient to fill up any extra space:

“Reflect” spread


Last of all, there’s a simple “angle” parameter, which allows you to rotate the entire gradient fill. This option is included mostly for use with data defined symbols, since a similar effect can be achieved by changing the gradient reference points. Amongst other effects, this is useful for achieving a “sun glint” on water, where each gradient is drawn in a random direction (more on this in a later blog post):

Data defined gradient angles

Random data defined gradient angles

This leads me into my final note… all of these properties can be data defined! So you could have a column in your data controlling whether each feature is drawn with a radial or linear gradient, or whether the gradient in a given feature should be drawn at a specific angle, or that the gradient in a feature should start at the centroid and end at the top right of the feature!

I’m excited to see what the QGIS user community is able to create using this new gradient fill feature when 2.2 is released. If you’ve already had a chance to play with the dev version of 2.2 and have something to show off, make sure you submit your map to the Flickr QGIS Map Showcase!

Formação em SIG Open Source com QGIS (Quantum GIS) em Moura, 17-18-19 Março 2014


Address finders in QGIS: OSM place search vs osmSearch

OSM place search and osmSearch are two plugins for QGIS which use the Nominatim service to find addresses and places. They are both still marked as “experimental” plugins, so users are expected to expect the unexpected.

Once installed, both plugins look very similar: There is an input text field and a results list.


A simple search with street name and house number returns the expected results. Interacting with the result shows some differences:

  • OSM place search will highlight the location when you mouse-over the result in the list. On double-click, it will zoom to the result.
  • osmSearch will highlight the result and move the map center to the result if you double-click but won’t zoom.

Both plugins can deal with umlauts (ä,ö,ü) but only osmSearch works with háčeks.


A nice feature of osmSearch is that it remembers your previous searches and offers an auto-complete function.

OSM place search on the other hand offers a reverse “Where am I” function (the arrow pointing to the left” which tries to find a name for the current map center location. Additionally, there are functions to add the current object as a new layer or mask layer.

Both plugins have strong and weak points. Combined, they would make a really strong tool but then nothing prevents us from having them both and choosing the best one for the task at hand.

Profile Tool tutorial

Profile Tool is a plugin for QGIS which makes it possible to generate (elevation) profiles for line features. The plugin is available through the default QGIS plugin repository. While testing the plugin, I found some aspects of using the tool might require additional instructions.

After installing and enabling the plugin, you will find the “Terrain profile” button in the plugin toolbar:


The basic use case is as follows:

  1. Load the elevation raster and select this raster layer in the layer list.
  2. Press the “Terrain profile” button. This opens the plugin panel which consists of a graph area on the left and a raster layer list on the right. The raster layer you had selected will be added to the raster layer list.
  3. If you have “Selection: Temporary polyline” enabled, you can now draw a line in the map area. Double-click left to end drawing the line. (If you are paying close attention, you might have noticed the instructions in the status bar.)
  4. After you have finished drawing the line, the graph area will update and display the profile.


If you want to add another raster layer to the plugin, you need to first select the raster layer in the QGIS layer list and then press the “Add Layer” button in the Profile Tool panel.

To generate the profile for an existing line feature, you need to change the selection mode from “Temporary polyline” to “Selected polyline”. Then you need to select the vector layer which contains the line feature you want to use in the QGIS layer list. Finally, you can click on the line feature in the map area to select it. (Note that this selection is independent of any selections you might have going on using the default QGIS feature selection tools.)

If you change from the Profile Tool to any other tool such as “Pan Map” or “Identify”, you have to click the “Terrain profile” button again to re-enable drawing/selection a line for the Profile Tool.

Due to a bug, it is currently not possible to export the profile graph. An alternative is to open the “Table” tab of the Profile Tool panel which provides access to the profile data and copy the data into your preferred graphing application such as Calc or Excel.

If you want to see the Profile Tool in action, I recommend watching the introduction video by Lene Fischer (University of Copenhagen).

Vienna elevation model

Since I finally managed to download the elevation model of the city of Vienna, I thought I’d share some eye candy with you: The map uses layer blending to combine hillshade and elevation raster, and the elevation raster’s color ramp is a modified “garish14″ from QGIS’ cpt-city color ramp collection.

wien_elevation by underdarkGIS
wien_elevation, a photo by underdarkGIS on Flickr.


Here is how you get access to the “garish14″ color ramp:

Start by selecting the

Start by selecting the “new color ramp” option in the raster’s style window.

Chose the

Chose the “cpt-city” color ramp type.

In the

In the “cpt-city color ramp” window, you will find lots of different premade color ramps. “garish14″ is part of the “Topography” collection.

OSM quality assessment with QGIS: network length

In my previous post, I presented a Processing model to determine positional accuracy of street networks. Today, I’ll cover another very popular tool to assess OSM quality in a region: network length comparison. Here’s the corresponding slide from my FOSS4G presentation which shows an example of this approach applied to OSM and OS data in the UK:


One building block of this tool is the Total graph length model which calculates the length of a network within specified regions. Like the model for positional accuracy, this model includes reprojection steps to ensure all layers are in the same CRS before the actual geoprocessing starts:


The final Compare total graph length model combines two instances of “Total graph length” whose results are then joined to eventually calculate the length difference (lenDIFF).


As usual, you can find the models on Github. If you have any questions, don’t hesitate to ask in the comments and if you find any issues please report them on Github.

OSM quality assessment with QGIS: positional accuracy

Over the last years, research on OpenStreetMap data quality has become increasingly popular. At this year’s FOSS4G, I had the honor to present some work we did at the AIT to assess OSM quality in Vienna, Austria. In the meantime, our paper “Towards an Open Source Analysis Toolbox for Street Network Comparison” has been published for early access. Thanks to the conference organizers who made this possible! I’ve implemented comparison tools found in related OSM literature as well as new tools for oneway street and turn restriction comparison using Sextante scripts and models for QGIS 1.8. All code is available on Github to enable collaboration. If you are interested in OSM data quality research, I’d like to invite you to give the tools a try.

Since most users probably don’t have access to QGIS 1.8 anymore, I’ll be updating the tools to QGIS 2.0 Processing. I’m starting today with the positional accuracy comparison tool. It is based on a method described by Goodchild & Hunter (1997). Here’s the corresponding slide from my FOSS4G presentation:


The basic idea is to evaluate the positional accuracy of a street graph by comparing it with a reference graph. To do that, we check how much of the graph lies within a certain tolerance (buffer) of the reference graph.

The processing model uses the following input: the two street graphs which should be compared, the size of the buffer (tolerance for positional accuracy), a polygon layer with analysis regions, and the field containing the region id. This is how the model looks in Processing modeler:


First, all layers are reprojected into a common CRS. This will have to be adjusted if the tool is used in other geographic regions. Then the reference graph is buffered and – since I found that dissolving buffers directly in the buffer tool can become very slow with big datasets – the faster difference tool is used to dissolve the buffers before we calculate the graph length inside the buffer (inbufLEN) as well as the total graph length in the analysis region (totalLEN). Finally, the two results are joined based on the region id field and the percentage of graph length within the buffered reference graph (inbufPERC) is calculated. A high percentage shows that both graphs agree very well geometrically.

The following image shows the tool applied to a sample of OpenStreetMap (red) and official data published by the city of Vienna (purple) at Wien Handelskai. OSM was used as a reference graph and the buffer size was set to 10 meters.


In general, both graphs agree quite well. The percentage of the official graph within 10 meters of the OSM graph is 93% in the 20th district. In the above image, we can see that links available in OSM are not contained in the official graph (mostly pedestrian/bike links) and there seem to be some connectivity issues as well in the upper right corner of the image.

In my opinion, Processing models are a great solution to document geoprocessing work flows and share them with others. If you want to collaborate on building more models for OSM-related analysis, just leave a comment bellow.

“Learning QGIS 2.0″ giveaway contest

I’m very pleased to announce that Packt Publishing is organizing a giveaway contest for Learning QGIS 2.0. All you need to do is comment below the post and win a free copy of Learning QGIS 2.0. Read on for more details.


Amongst other topics, Learning QGIS 2.0 covers:

  • Loading and visualizing vector and raster data
  • Creating and editing spatial data and performing spatial analysis
  • Designing great maps and printing them

How to Enter?

Simply post your expectations for this book in comments section below and you could be one of the lucky participants to win a copy.

DeadLine: The contest will close in 7 days on December, 12th 2013. Winners will be contacted by email, so be sure to use your real email address when you comment!

Please note: Winners residing in the USA and Europe will receive print copies. Others will be provided with eBook copies.

Help for Processing scripts and models

Processing has received a series of updates since the release of QGIS 2.0. (I’m currently running 2.0-20131120) One great addition I want to highlight today is the improved script editor and the help file editor.

Script editor

The improved script editor features a toolbar with commonly used tools such as undo and redo, cut, copy and paste, save and save as …, as well as very useful run algorithm and edit script help buttons. It also shows the script line numbers which makes it easier to work with while debugging code.


The model editor has a similar toolbar now which allows to export the model representation as an image, run the model or edit the model help.

Help editor

When you press the edit script help button, you get access to the new help editor. It’s easy to use: On the top, it displays the current content of the help file. On the bottom-left, it lists the different sections of the help file which can be filled with information. In the input parameters and outputs section, the help editor automatically lists the all parameters specified in the script code. Finally, in the bottom-right, you can enter the description. The resulting help file is saved in the same location as the original script under the name <scriptname>


QGIS Distance Calculator

I want to find a location that is close to existing industrial areas (red polygons) and away from Sites of Special Scientific Interest (green polygons)

I will do this by using the Proximity (Raster Distance) analysis tool to create distance thematics, then using the Raster calculator to average the distance from each criterion.

Original layers

Original layers

Convert to Raster

The process only works with input files that are in raster format. As our source is in vector format (it’s a polygon .shp file), we need to convert it to a raster file.

It is good practice to add an attribute column, set its value to 1 so the resulting raster has a value of 1 for all the polygons. This can be done using the Field Calculator in the Attribute table.

QGIS Rasterize tool

QGIS Rasterize tool

Change display properties

The raster initially appears as a grey box. Don’t worry, this is normal. I am going to adjust its display properties so I can see the information.

  1. Right click on the layer
  2. Select Properties
  3. Select Stretch to MinMax under Contrast Enhancement
  4. Select the style tab
  5. Tick Invert Colour map. This makes the areas with a value of 1 black and the areas with a value of 0 white
QGIS Layers dialog

QGIS Layers dialog

The colours look quite stark, so I’m going to apply a transparency:-

  1. Select the Transparency tab
  2. In the Transparent Pixel List box, enter 1 under Gray and 50 under % Transparent
QGIS Layers dialog

QGIS Layers dialog

Its appearance is now less over-powering and I can see other layers too:-

QGIS Distance Calculator4

Calculate Proximity/Distance

Now to create a thematic based on the proximity (or distance) between each pixel and the nearest point of a SSSI site:-

  1. Open the Proximity calculator by selecting Raster menu, Analysis, Proximity (Raster Distance)
  2. Select the input raster and output raster (I found it works best if the output file is in .tif format)
Proximity (Raster Distance) calculator dialog

Proximity (Raster Distance) calculator dialog

  • I want to measure the distance to SSSI pixels with a value of 1 (that is what I set to be the value used for areas with SSSI designation)
  • Distance units are Geo (geographical) rather than pixels

The output is initially a grey square. I have made the following adjustments:-

  • Colour map – Puseudo colour
  • Global Transparency – 50%

It is worth exploring the options to invert the colour map and Contrast Enhancement

The SSSI sites are visible as the green polygons, the thematic is red for areas closest to sites and blue for areas furthest away:-

QGIS Distance Calculator Results1

Repeat the process for all the necessary layers:

Proximity Distance Calculator Results

Proximity Distance Calculator Results

Raster Calculator

The raster calculator is a powerful tool that performs mathematical operations on each cell in a raster. Examples of this can be to calculate elevation, distance or density.

In this case, I am going to use it to identify the areas that are greater than 1km from a SSSI site by applying queries to identify matching pixel values.

  1. Open the raster calculator
  2. Enter the following expression SSSI_Distance@1 > 1000

The map units are in metres, so 1,000m = 1km

The resulting raster appears as a grey box. As usual, adjust its display properties (e.g. Contrast Enhancement, Invert Map and Transparency). The areas that are further than 1km from a SSSI site are now highlighted in grey, with the sites visible in green:-

QGIS Distance Calculator5

Interview on GIS Lounge

It has been a real pleasure to chat with Caitlin Dempsey at GIS Lounge about open source GIS and how I got hooked on QGIS.

In related news: It’s great to see the many great and creative contributions to the QGIS Map Showcase on Flickr! If you have some maps you are proud of, please share them with the community. If you would like to see your image reused on the QGIS website or in other QGIS marketing material, please choose an appropriate license for your image.

I’ve also started to work on a new Processing script that identifies similar line features. It currently uses a length comparison and the Hausdorff distance between two line features to calculate the similarity value, but more on that in a future post!

Waiting for QGIS 2.2 – Composer Improvements (part 2)

Following on from Part 1, here’s some more recent usability improvements which have been made to QGIS’ map composer:

  • Multiple items can now be selected by drawing a box around them. Holding Shift while drawing a box adds to the current selection, holding Ctrl will subtract from the current selection. In addition, holding Alt while drawing the selection box changes from an “intersects” style selection mode to a “within” selection mode. This was my major frustration with the composer in earlier versions of QGIS, and combined with the earlier fixes for multi-item drag and resize it substantially improves the design workflow.
Selecting multiple items with a mouse drag

Selecting multiple items with a mouse drag

  • Grid lines are always drawn on top of compositions
  • There’s new menu options for showing the grid and snapping to grid, and for showing/snapping/smart guides. All these have convenient keyboard shortcuts so you can quickly switch on or off display of the guides and grid or temporarily switch on or off snapping while you work. There’s also a new menu item for clearing all guides from a composition.
Grid and guide controls in the view menu

Grid and guide controls in the view menu

  • The composer window now has a status bar which shows the exact cursor position and details about resizing/moving items
The new composer status bar

The new composer status bar

  • A new mouse-based zoom tool has been added to the composer, which allows you to click and drag to specify an area to zoom to. You can also switch to this new tool at any time by holding Ctrl and space. Holding Shift while using the zoom tool switches to zooming out.

That’s it for now, but there’s loads more to come for 2.2!

50th ICA-OSGeo Lab established at Fondazione Edmund Mach (FEM)

We are pleased to announce that the 50th ICA-OSGeo Lab has been established at the GIS and Remote Sensing Unit (Piattaforma GIS & Remote Sensing, PGIS), Research and Innovation Centre (CRI), Fondazione Edmund Mach (FEM), Italy. CRI is a multifaceted research organization established in 2008 under the umbrella of FEM, a private research foundation funded by the government of Autonomous Province of Trento. CRI focuses on studies and innovations in the fields of agriculture, nutrition, and environment, with the aim to generate new sharing knowledge and to contribute to economic growth, social development and the overall improvement of quality of life.

The mission of the PGIS unit is to develop and provide multi-scale approaches for the description of 2-, 3- and 4-dimensional biological systems and processes. Core activities of the unit include acquisition, processing and validation of geo-physical, ecological and spatial datasets collected within various research projects and monitoring activities, along with advanced scientific analysis and data management. These studies involve multi-decadal change analysis of various ecological and physical parameters from continental to landscape level using satellite imagery and other climatic layers. The lab focuses on the geostatistical analysis of such information layers, the creation and processing of indicators, and the production of ecological, landscape genetics, eco-epidemiological and physiological models. The team pursues actively the development of innovative methods and their implementation in a GIS framework including the time series analysis of proximal and remote sensing data.

The GIS and Remote Sensing Unit (PGIS) members strongly support the peer reviewed approach of Free and Open Source software development which is perfectly in line with academic research. PGIS contributes extensively to the open source software development in geospatial (main contributors to GRASS GIS), often collaborating with various other developers and researchers around the globe. In the new ICA-OSGeo lab at FEM international PhD students, university students and trainees are present.

PGIS is focused on knowledge dissemination of open source tools through a series of courses designed for specific user requirement (schools, universities, research institutes), blogs, workshops and conferences. Their recent publication in Trends in Ecology and Evolution underlines the need on using Free and Open Source Software (FOSS) for completely open science. Dr. Markus Neteler, who is leading the group since its formation, has two decades of experience in developing and promoting open source GIS software. Being founding member of the Open Source Geospatial Foundation (, USA), he served on its board of directors from 2006-2011. Luca Delucchi, focal point and responsible person for the new ICA-OSGeo Lab is member of the board of directors of the Associazione Italiana per l’Informazione Geografica Libera (, the Italian Local Chapter of OSGeo). He contributes to several Free and Open Source software and open data projects as developer and trainer.

Details about the GIS and Remote Sensing Unit at

Open Source Geospatial Foundation (OSGeo) is a not-for-profit organisation founded in 2006 whose mission is to support and promote the collaborative development of open source geospatial technologies and data.

International Cartographic Association (ICA) is the world authoritative body for cartography and GIScience. See also the new ICA-OSGeo Labs website.

A routing script for the Processing toolbox

Did you know that there is a network analysis library in QGIS core? It’s well hidden so far, but at least it’s documented in the PyQGIS Cookbook. The code samples from the cookbook can be used in the QGIS Python console and you can play around to get a grip of what the different steps are doing.

As a first exercise, I’ve decided to write a Processing script which will use the network analysis library to create a network-based route layer from a point layer input. You can find the result on Github.

You can get a Spatialite file with testdata from Github as well. It contains a network and a routepoints1 layer:


The interface of the points_to_route tool is very simple. All it needs as an input is information about which layer should be used as a network and which layer contains the route points:


The input points are considered to be ordered. The tool always routes between consecutive points.

The result is a line layer with one line feature for each point pair:


The network analysis library is a really great new feature and I hope we will see a lot of tools built on top of it.

Howto create an IMRO legend in QGIS

If you have to use IMRO data, you want to use the same legend as the one used on Unfortunatly there is no standard IMRO legend file for QGIS. Luckily B3Partners uploaded an SLD file onto GitHub which you can use to create the legend in QGIS. To use the SLD for the legend […]

Waiting for QGIS 2.2 – Composer Improvements (part 1)

In the spirit of depesz’s “Waiting for Postgresql 9.#” series (and BostonGIS’ follow up Waiting for PostGIS 2.#), here’s the first in a new series of “Waiting for QGIS 2.2″ posts…

As I mentioned in my last post, one of my major goals for QGIS 2.2 is to make the print composer behave more like a professional DTP package. A big part of this is making sure QGIS respects all the expected standard behaviour for graphic design programs. While the print composer made huge advances toward this goal in version 2.0, there’s still further we can go.

So, let’s start with a list of all the new usability features the print composer has already gained for QGIS 2.2:

  • Selections of multiple items can all be moved and resized together (previously only one item in the selection would be altered)
  • Mouse handles are always drawn on the top of the composition – in earlier versions mouse handles could be hidden by items sitting higher in the composition
  • Holding shift while resizing items locks their aspect ratio
  • Holding control while resizing items causes them to resize from their centre
  • Holding shift while moving items locks the movement to the horizontal or vertical
  • Holding control while moving items temporarily disables any grid or guide-based snapping
  • Items can be removed from a selection by shift-clicking them
  • Control-clicking an item causes the next item below it to be selected – this allows you to select items which are hidden behind other items
  • Holding shift while moving items using the cursor keys results in a large item movement
  • There’s a new “Edit” menu in the composer, with options like
    • Select All/Select None and Invert Selection
    • Select Next Item Above and Select Next Item Below
    • Lock Selected Items and Unlock All
The new composer

The new composer “Edit” menu

Additionally, there’s a bunch of pull requests which haven’t yet been merged to master, but are ready to go, including:

  • Adding a dedicated “pan” tool for dragging around compositions
  • Compositions can be panned at any time by holding the space key or middle mouse button
  • Compositions can be zoomed by using the mouse wheel
Composer pan tool

Composer pan tool

Some of these are simple little changes which don’t sound like much, but it’s not until you’re forced to work without something like shift-resizing to lock the aspect ratio that you realise how often you use it and rely on it!

Combining Raster Calculator with elevations

I want to identify which areas of Chetney Marshes would be flooded by a 2m rise in sea level.  I used LIDAR data in contour format as the elevation data:-

Chetney Marshes map

Chetney Marshes map

Create TIN

I am using the TIN method to create an elevation model as the area is relatively small and the data is supplied as contours. TIN’s are more accurate, especially if the source data isn’t in grid format. However they are slower to process, especially over very large areas.

Select Plugins, Interpolation to open the Interpolation dialogue:-

Raster Calc2

I made the following changes to the display properties:-

  • Colour map – Pusedocolour
  • Transparency – I set global transparency to 50%
Chetney Marsh after colour adjustment

Chetney Marsh after colour adjustment

Raster Calculator

I now have an elevation model of the area. I now use the Raster Calculator to identify each pixel with an elevation of less than 2m. The elevation is stored in the pixel value. The raster calculator will identify each pixel with band value of less than 2.

The expression is elevation < 2

Select Raster, Raster Calculator to open the Raster Calculator:-

Raster Calc4

To change the Display Properties for a layer, Right click on the Layer in the layers panel (Table of Contents) and select Properties. I made the following changes to the display properties so the areas that are less than 2m, and susceptible to flooding appear highlighted in blue:-

  • Style tab: Color map – Colormap
  • Transparency: Global transparency 50%
  • Colormap tab: I added 2 entries:-
    • 0.00 white
    • 1.00 blue
Chetney Marsh showing raster calculation results

Chetney Marsh showing raster calculation results


Compiling QGIS 2.0.1 for Fedora 19 in a few steps

Thanks to Volker Fröhlich’s efforts, a source code RPM package (SRPM) of QGIS 2.0.1 is now available for Fedora. If you are not yet F20 user (like me), you can just take the F20 package and compile it for F19 (or even F18) since there will be no backport of QGIS 2 to F19 (it comes with QGIS 1.8). But: we do want QGIS 2 on Fedora19!

Solution: compile it yourself.

1. 1. Preparations

The best way is  to use “mock” which is used to recompile SRPMS in a separate local environment (“chroot”) without cluttering the system with extra packages needed for the compilation (run as “root”):

yum install mock

2. 2. Get the source code

Next download the SRPM package from the Koji  server:
QGIS: (–> src – download) or check here for more recent versions.

3. 3. Compile it locally as RPM package

The general compilation command (“mock”) would be:

mock -r my_fedora_version_config --rebuild my_source_rpm.src.rpm

So, check for Fedora version config name which is suitable for your system (“my_fedora_version_config“)

ls /etc/mock/

In my case of a 64bit machine, it is “fedora-19-x86_64″. Hence we can compile QGIS 2.0.1 directly from the SRPM file:

mock -r fedora-19-x86_64 --rebuild qgis-2.0.1-2.fc20.src.rpm

Note: the compilation takes 40min on my tiny core i3 laptop (ASUS X202). Use the time to donate some coins to the QGIS project :-)

4. 4. Install and enjoy

Once the compilation job is done, i.e. the binary RPM files are available for installation. To install the freshly compiled QGIS 2.0.1 RPMs, run:

cd /var/lib/mock/fedora-19-x86_64/result/

# an existing QGIS1.8 installation will be replaced: 
yum localinstall qgis-2.0.1-2.fc19.x86_64.rpm \
qgis-grass-2.0.1-2.fc19.x86_64.rpm qgis-python-2.0.1-2.fc19.x86_64.rpm

# consider to cleanup (or keep it for the next update, it is about 1.5GB):
rm -rf /var/lib/mock/fedora-19-x86_64/
# leave the "root" shell

Now we can happily use QGIS 2.0.1 on Fedora 19!



Fun with data-defined labels

Yesterday, I received an interesting QGIS question:

is there a way to make road label font size depending on road lenght (with osm layer)?
Indeed, it could be interresting to see all roads, even the smallest, on a city map rendering.

Thanks to the data-defined labeling capabilities of the new QGIS version, we can!

Just click the slightly weird symbol right of the label text size and select Edit …

Since OSM data is in WGS84 by default, street length will be measured in degrees and therefore the values will be small. To get to a reasonable font size, I selected $length * 1000.

The second part of the question can be addressed using a setting in the Rendering section which is – very descriptively – called “Show all labels for this layer (including colliding labels)”.


While I doubt that this simple method alone will create a great road map, I think it’s still an interesting exercise with sometimes surprising results.

  • <<
  • Page 2 of 21 ( 420 posts )
  • >>
  • qgis


Powered by Django!