top logo
 
  • Page 1 of 39 ( 775 posts )
  • >>

Tags

Last update:
Sat May 18 19:10:23 2013

A Django site.

FOSS4G-CEE 2013: Program published!

Join us at FOSS4G Central and Eastern Europe (FOSS4G-CEE) 2013 from 16th - 20th June, National Library of Romania, Bucharest, Romania.


You will meet well known Keynote Speakers (random order): Jeff McKenna, Paul C. Smits, Jáchym Čepický, Schuyler Erle, Maria Antonia Brovelli, Dirk Frigne, Markus Neteler, Alyssa Wright, and Radu Puchiu.

Check the long list of Practical Workshops and Oral Presentations at: http://2013.foss4g-cee.org/program/schedule
Check out for the additional Code Sprint, the Open GeoData Hackathon, and the Open Data Side Event.

How to arrive? See http://2013.foss4g-cee.org/venue/map


Hepler modules for development of QGIS plugins

There are two things I have coded, re-coded and re-re-coded through all my plugins: the management of the settings and the management of combo boxes associated to layers and their fields.

I have decided to write two generic python modules to solve these tasks to avoid reinventing the wheel every time.

The first one is called QGIS setting manager.
This module allows you to:

  • manage different types of settings (bool, string, color, integer, double, stringlist)
  • read and write settings in QGIS application or in the QGIS project
  • automatically set widgets from corresponding setting
  • automatically write settings from widgets of a dialog

This means that the class of a dialog dedicated to editing the plugins settings can be reduced to just a few lines.
You just have to name widgets according to settings and the module automatically detect the widgets, sets/reads the value from the widget and read/write the settings accordingly.

A setting class would look like this

from qgissettingmanager import *

class MySettings(SettingManager):
    def __init__(self):
        SettingManager.__init__(self, myPluginName)
        self.addSetting("myVariable", "bool", "global", True)

reading and write settings are performed by doing

self.settings = MySettings()
self.settings.setValue("myVariable", False)
myVariable = self.settings.value("myVariable")

and a dialog looks like this

class MyDialog(QDialog, Ui_myDialog, SettingDialog):
    def __init__(self):
        QDialog.__init__(self)
        self.setupUi(self)
        self.settings = MySettings()
        SettingDialog.__init__(self, self.settings)

You can find a complete howto here and look at the code on github.

The second module is called QGIS combo manager. This module autmatically manages combo box widgets for layers, fields of vector layers and bands of raster layers.
You can associate a field combo to a layer combo: as soon as the layer has been modified, the fields are updated to the current layer.

Associating a combo box to layers and another one to its fields would look like this:

from qgiscombomanager import *

self.layerComboManager = VectorLayerCombo(self.layerComboWidget)
self.myFieldComboManager = FieldCombo(self.myFieldComboManager, self.layerComboManager)

You can find a complete howto here and look at the code on github.



(Nederlands) Kleurinstellingen WMS- en WMTS-kaartlagen

An advantage of using map services like WMS and WMTS is that your styling has been done by someone else. But this can turn into a disadvantage as well in case the colours of your overlay are similar to the colours in your remote base layer. To show this I created an example using the [...]


How to do some quasi 3d cartographic effects in QGIS

No words for this one, just pictures! Above: What we are trying to achieve… Above: Our symbol layers Above: The roof colour is data defined A shadow Layer And a highlight layer One other hint – don’t forget to enable symbol levels!


QGIS Flickr Group

The excitement about the upcoming 2.0 release is growing and to add some fuel to the fires, Mathieu founded the QGIS Flickr Group. Anyone can join and add their maps done with QGIS master.

I’m looking forward to seeing what you have come up with. Please note that this group is meant for maps only (therefore no screenshots of the application please).



QGIS Map Flickr group

Want to show of some the cool maps you have made using QGIS 1.9/2.0?

Mathieu has now setup a new Flickr group to collect and show of cool maps that have been made using the new features in the upcoming QGIS 2.0.

The group can be found at http://www.flickr.com/groups/qgis/pool

Here is one I uploaded a few days ago

http://farm8.staticflickr.com/7350/8715654343_71f64d4d75_b.jpg

and a cool one from Anita

http://farm8.staticflickr.com/7370/8720379249_fdf4625967_b.jpg

Anyone can join and submit to the group.

There are just a few rules:

  • No Screen shots of the application
  • Only output from the composer or Save Image As..
  • List data sources used
  • List any new QGIS features used e.g blending, label buffers, etc
  • Only post maps you are proud of or you would show your mother

A QGIS Map Book might be on the cards in the future so keep that in mind when uploading a map to the group.

Now go forth and make awesome maps!


België en Duitsland in RD met QGIS

De Basisregistratie Topografie (BRT/Top10NL) houdt ongeveer een kilometer na de landsgrens al op. Velen, bijvoorbeeld brandweermensen, hebben behoefte aan meer kaartbeeld over de landsgrens. Die kaartdata is er, en nog kosteloos ook. De Open Street Map (OSM) van de Europese landen is als Shapefiles te downloaden, o.a. via de Duitse GeoFabrik, http://download.geofabrik.de/europe.html. Ze wordt aangeboden in [...]


Sextante Modeler Evolution 1.0.8 to 1.1

Sextante is quickly becoming the goto geoprocessing toolbox for me. I’ve been working with Sextante 1.0.8 on QGIS 1.8 and lately I’ve started looking into Sextante 1.1 for QGIS 2. This post highlights some of the main differences between the two versions. I’m sure there are many more hidden gems I have not discovered so far.

One thing you will notice if you have used previous versions of Sextante is that the new version comes with a simplified interface which groups tools into three categories: geoalgorithms, models, and scripts. If you prefer the old style grouping by algorithm source such as GDAL, GRASS, etc. you can switch to the Advanced interface.

Let’s start with the bad news: Models created in 1.0.8 are not compatible with 1.1 since many of the algorithms have been rearranged in new categories and Sextante cannot find them by their old names anymore, e.g.

1.0.8 … ALGORITHM:ftools:fixeddistancebuffer
1.1 … ALGORITHM:qgis:fixeddistancebuffer

The great news is that the modeler has been improved greatly. Model representations now show the flow of input and output data through the model steps much more clearly:

Sextante 1.0.8 Modeler

Sextante 1.0.8 modeler

Sextante 1.1 Modeler

Sextante 1.1 modeler

I also found the new modeler much more stable – no crashes so far. *fingerscrossed*

Another nice new feature is Sextante commander which can be started using the shortcut Ctrl+Alt+M. It’s a quick launch solution for all Sextante algorithms:

sextante_commander

At FOSS4G, I’ll be presenting some work I did evaluation OSM using Sextante 1.0.8. I’d love to hear how you are using Sextante.



Print Composer 2.0 – Take #7

Today’s post: More print composer overview magic!

Inverted Map Overviews

Thanks to the “Invert overview” option, we can now chose between highlighting the detail area (left example in the image) or blocking out the surrounding area (right example).

printcomposer_overviews

The “Lock layers for map item” option can come in very handy if you want to reduce the number of layers in the overview map while still keeping all layers of interest in the main map.



QGIS Cloud and Sourcepole are sponsoring Öcher-Safari

QGIS Cloud and Sourcepole are proud to be official sponsors of the team Öcher-Safari, attending the Allgäu-Orient-Rallye. One of the last adventures in the world of cars. Sourcepole serves the team with know how, infrastructure and more. Information about the team and the charity ideas of this event you can find on Öcher-Safari and the official web site of the Allgäu-Orient-Rallye.


Installing QGIS using apt on windows (OSGeo4W)

Here is a handy tip to be able to install and update OSGeo4W packages, things like QGIS, GRASS, etc, using the apt utility from OSGeo4W. apt is a command line utility that you can install using OSGeo4W and then run using the OSGeo4W Shell.

First install apt via OSGeo4W

osgeo.png

Now open the OSGeo4W Shell

shell.png

from here you can run the apt utility.

The basic commands are apt update, apt install {package}, apt upgrade

Installing nightly QGIS

For a quick example we will install qgis-dev.

From the shell we can just run:

apt setup
apt update
apt install qgis-dev

qgis-dev-install.png

apt will install all the needed dependencies

Done!

Script for updating nightly QGIS

So the good thing about using apt is if you wanted to make a quick batch file that you can run to update to the nightly build it's as simple as

@echo off
set OSGEO4W_ROOT=C:\OSGeo4W
set PATH=%OSGEO4W_ROOT%\bin;%PATH%

apt update
apt install qgis-dev
pause

Now you can just run the batch file to update your QGIS to the nightly build.

Extra tip

If you just want to upgrade all the packages you have installed you can do:

apt setup
apt upgrade

Simple


SVG textures + blend modes = Cool QGIS Maps

Did you know you can use textures to fill a polyon in QGIS? No? Well you do now!

The cool thing is you can get results like this with a simple SVG and a texture.

texture.png

So how do you do it? Lets give it a go.

First grab a texture you want from http://texturelib.com/

Install Inkscape, or any other tool that can create svgs with textures.

Drag and drop your texture into Inkscape and embed the texture into the SVG:

textureembed.png

Twaek any settings you need in Inkscape and save it somewhere QGIS can find.

Tip: You can configure extra search paths for svg in Options -> System -> SVG Paths

inkscape.png

Open QGIS and load a polygon layer

Change the symbol type for the style to SVG fill and selet your SVG

texturepicker.png

Hit apply.

Opps that's not right

textureresult1.png

Enter the handy blend modes added by Nyall.

Change the blend mode to Soft Light and move the layer to the top of the drawing list

textureresult2.png

SWEEEET!!!!

Now go and make some pirate maps.


QGIS and WFS service caching

The dutch PDOK-services plugin is a simple plugin to load some national (PDOK) dataservices. One of the available services is a Web Features Service (WFS), while a very handy service, calling the WFS service to load all roads in the Netherlands shows you the following result: As you can see the blue bar are actually [...]


Building QGIS on Ubuntu 13.04

It seems upgrading to Ubuntu 13.04 breaks a few things in the QGIS build process. Here’s some quick workarounds I’ve found to get it building again.

Firstly, Ubuntu defaults to Qt 5, causing the error:

CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1216 (message):

 Found unsuitable Qt version "5.0.1" from /usr/bin/qmake, this code requires
 Qt 4.x

This can be fixed by switching the system default back to Qt 4, so that  qmake refers to the Qt 4 version. The “qt4-default” package handles this switch for you, so just run:

sudo apt-get install qt4-default

Update: A better solution was found by Pierre and Pvanb and is described here. Basically it involves changing the QMAKE_EXECUTABLE option from /usr/bin/qmake to /usr/bin/qmake-qt4.

Next, I was getting the error:

make[2]: *** No rule to make target `/usr/lib/libpython2.7.so', needed by `output/lib/libqgispython.so.1.9.0'. Stop.

I’m not sure if this is the correct solution, but setting up some links and re-running ldconfig gets around this:

sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so.1 /usr/lib/libpython2.7.so.1
sudo ln -sf /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/libpython2.7.so
sudo ldconfig

Update: a better solution is to change the PYTHON_LIBRARY option from /usr/lib/libpython2.7.so to /usr/lib/x86_64-linux-gnu/libpython2.7.so

These two changes were enough to get QGIS building again. If you’ve got a better solution for these errors, let me know…


A neat trick in QGIS 2.0 – images in atlas prints

Here’s a cool trick which you can do in QGIS 2.0. It builds on two new features introduced in version 2.0 – atlas prints and html labels.

Atlas prints (previously available as a plugin, now integrated into QGIS core) were developed by Oslandia, and allow you to create data driven map layouts from a specified coverage layer. You can read more about them here.

Another new feature in QGIS 2.0 is the ability to render composer labels as html (courtesy of Olivier Dalang). This allows all kinds of fantastic effects, such as formatting text in the middle of a label (using <b>, <i>, and <font> tags) or creating labels which contain HTML tables. You can even use CSS stylesheets and rules to format the HTML! I’ve been told JavaScript also works inside the labels, but I’ve yet to try this out.

You can combine these two new features for some great tricks. Let’s say we’d like to create a set of maps of local councils, and we want each map to have a watermarked logo of the council on it. For this example I’ve created a basic basemap of Victorian councils, and I’ve downloaded all the council logos (in a variety of formats) to a local folder. Next, I’ll add an extra column to the council layer containing the name of the logo image:

adding_logo_column

Adding a logo column to the table

Then, we’ll throw together a simple composition containing the map and set it up as an atlas print:

setting_up_atlas

Generating an atlas

Now for the fun bit. I’ll add a label item to the composer, set it to “Render as HTML”, and insert some specially-crafted html:

The magic HTML label...

The magic HTML label…

For copy/paste purposes here’s the label contents again:

<style>
* {margin: 0px; padding: 0px}
</style>
<img src="file:///home/nyall/GIS/council_logos/[% "logo" %]"
style="width: auto; height: 100%; display: block; margin: 0px 0px 0px auto;" />

There’s a couple of things to note here. First, the magic happens in the image’s src attribute (“file:///home/nyall/GIS/council_logos/[% "logo" %]“). When the composer is exported, QGIS will replace the [% "logo" %] part with the contents of the logo field for each row in the councils table. This means the image source will then point to the local copy of the council’s logo, eg “file:///home/nyall/GIS/council_logos/glen_eira.jpg” for the first row.

Secondly, I’ve styled the image with the css:

width: auto; height: 100%; display: block;

This allows the image to resize to 100% of the height of the label while maintaining its correct aspect ratio. I’ve also added the rule

margin: 0px 0px 0px auto;

to force the image to right align within the html label. This ensures that all the watermarked logos will appear in a consistent size and position for each map.

Lastly, I’ll remove the label’s frame and background by unchecking these options, then set its transparency to 80% under the new “Rendering” section:

Yet another new feature in QGIS 2.0...

Yet another new feature in QGIS 2.0…

Ok, we’re all done. Now, when I select Composer -> “Export as Image”, we’ll get a lovely set of council maps complete with watermarked council logo!

A watermarked atlas!

A watermarked atlas!

There we go — all ready for print, with no manipulation in external programs required at all!

Bonus post-credits section

Here’s a kicker — the linked images don’t need to be local. That means you can even piggy-back off an existing web service to generate an image on the fly! Let’s say you were asked to add QR codes to your maps to link directly to the council website. All it takes is adding a new column to the table, then modifying the image src to read:

src="http://qrfree.kaywa.com/?l=1&s=8&d=[% "url" %]"

Now when we export the maps we’ll also get a QR image generated on the fly and inserted into the layout!

Complete with dynamically generated QR code!

Complete with dynamically generated QR code!

Combining HTML labels and atlas prints in this way is extremely powerful. This example is just touching the tip of the iceberg – I’m keen to see what the community can do with this when QGIS 2.0 is released!


Advanced Python Field Calculator

Advanced Python field calculator is one of the numerous tools in Sextante for QGIS. It’s extremely powerful but it doesn’t use the syntax of QGIS’ default field calculator (the one you can access via attribute table). Therefore, here comes a short introduction:

If you want to reproduce this example, I used a dataset of town areas from the new open government data site of Lower Austria.

The upper half of the Advanced Python field calculator is rather self-explanatory but the lower half is where it gets interesting: Code in the global expression section will be executed only once before the calculator starts iterating through all the features of the input layer. Therefore, this is the correct place to import necessary modules or to calculate variables that will be used in subsequent calculations. Code in the formula section will be evaluated for each feature in the input layer. As shown in the following example, this is where we can calculate new values, e.g. the area of the polygons in km²:

sextante_pythonfieldcalc_area

As you can see, the feature geometry can be accessed using $geom.

If you want to access an existing attribute, that’s possible using <attribute_name>.

Anyway, this is the resulting layer’s attribute table including the new areaKM2 field:

sextante_pythonfieldcalc_area_results

Thanks to Victor for pointing me to the documentation of FieldPyculator which Advanced Python field calculator is based on.



Australian QGIS User Forums - Wrap up

I had a feeling this year was going to be a good one for QGIS. The recent success of the first Australian QGIS User Group in Perth, and the most recent one in Melbourne can only reinforce this. Both events had a great turn out of around fifty people.

The Perth event was run as three presentations followed by a discussion session.

  • Mapping Projects with QGIS (Jeremy Taylor - City of Belmont)

  • Custom Plugin Development (Shane French - Department of Environment and Conservation)

  • All the New Cool Stuff in QGIS 2.0 (Nathan Woodrow - Digital Mapping Solutions)

With a bit more time to prepare we added a workshop session to the Melbourne event:

Workshops

  • Styling and managing style libraries (Chris Scott - Digital Mapping Solutions)

  • Working with the composer (Nathan Woodrow - Digital Mapping Solutions)

  • Custom QGIS forms and Python (Nathan Woodrow - Digital Mapping Solutions)

  • General Q&A

Presentations

  • A GIS officers journey into the light (Barrett Higman - Alpine Shire Council)

  • QGIS in Victoria Police (Nyall Dawson - Victoria Police)

  • All the New Cool Stuff in QGIS 2.0 (Nathan Woodrow - Digital Mapping Solutions)

There was a great mix of users, even a few non users keen to check QGIS out for the first time. I was extremely happy with how both days turned out and the feedback so far has been fantastic. A massive thanks must go to DMS who sponsored both events.

users.jpg

I also thought I might give filming and screen recording my workshop a go. Seemed to turn out alright, for a first attempt anyway. A few mistakes here and there but live things never go 100% :)

On a side note it was also a pleasure to be able to talk about my adventures with QGIS at the Melbourne Open GIS meetup. Big thanks to Simon for asking me to talk.


Comparison of SOM Classification and Unsupervised KMeans image classification in Sextante


QGIS Back in the Day

Do you remember this?

QGIS of Yesteryear

If so, you’ve been using QGIS a long time…

  • OGR and PostGIS support
  • No raster support
  • Three widgets on the Symbology tab
  • No symbology in the legend

But you could use it handily on a 640x480 display.


New forms related features coming in QGIS 2.0

View here on youtube: https://www.youtube.com/watch?v=rnqRAOvuJEU

  • Page 1 of 39 ( 775 posts )
  • >>

bottom

Powered by Django!