Esri File Based Geodatabases en Oracle connecties openen met QGIS

GDAL and OGR ( libs from Frank van Warmerdam are famous software libraries which make it possible in the Open Source world to read and write a plethora of gis file formats. The nice thing about QGIS is that it using OGR and GDAL. So with every addition or enhancement in those libraries, QGIS itself is also getting better.
One example (while we offcourse ourselves will never use it 😉 ), is when somebody sents you a FGDB (File Geodatabase) from Esri. Since version 1.9, OGR can read and write with this format. Remark from the docs: “File GDB must be ArcGIS version 10, 9.3.1 is not supported.”
When using OGR 1.9 in QGIS, it is possible top epen FGDB fieles. Happily it is not difficult for Windows users to use OGR 1.9. If you use an OSGEO4W install of QGIS (see this post). If you checked ‘gdal filegdb’ QGIS should be able to open fgdb’s. For Linux users it is possible to get OGR 1.9 from repositories like ‘ubuntugis’ or ‘elgis’ see
To try this out we off course have to get a fgdb file… Googling you find them (off course) available at Esri. After a registration (!) you can download an example fgdb of North America.
Unzipping this you will find a directory ‘FileGDB API/samples/data’ in which you find directories with names ending with .gdb. One of those dirs is what Esri calls a FileGDB. There is not so much to see in those dirs. It is full with files having cryptic names like a00000015.gdbtablx a00000015.spx etc etc.
Happily QGIS kan handle this. Via menu or buttons go to ‘Add Vector Layer’ and select ‘Directory’. As ‘source choose ‘ESRI FileGDB’. If you do not have this as an option, you are apparently working with a OGR/GDAL version lower then 1.9 (see below how to find out) which cannot do fgdb. If you can, browse to the directory you .gdb directory we viewed before.

Select ‘topo.gdb’

After selecting this directory, it appears to hold several data sources: states, us_lakes, us_rivers etc. We select several of them.
Bingo. We see them as normal vector layers, and are able to style and edit them.

QGIS kan also open and visualize data from an Oracle Database.
Here the same adagio: only if your installed OGR library is capable of it: QGIS can do it. But if so: just open a connection to a database vector layer:

How kan you find out which ogr library you have installed and used by QGIS ?
Via the Help/About menu there is the tab ‘About’ which exactly shows you which libraries are used by QGIS, and which version of them:

How to find out which formats are compiled into your ogr/gdal libraries?
You have to go to a command line (via osgeo4w.bat in your osgeo4w directory if you are on windows):

c:\osgeo4w>ogrinfo --formats


c:\osgeo4w>gdalinfo --formats

This will give you a long list of formats that can be openedn. To check if fgdb (gdb) and Oracle (oci) are available, search for those strings in the output:

c:\osgeo4w>ogrinfo --formats | grep -i gdb
Supported Formats:
-> "FileGDB" (read/write)
c:\osgeo4w>ogrinfo --formats | grep -i oci
-> "OCI" (read/write)

How to get an org/gdal version which Hoe kom je aan een ogr/gdal die WEL fgdb en/of oracle ondersteund?
As told here above, for Windows users a QGIS install via OSGeo4w QGIS installatie met OSGeo4w is the best way (the standalone/msi installer of QGIS does not have these options).
For Linux user, compiling GDAL yourself is the (only?) solution. Reason for this is dat Oracle, Esri and Erdas do not want the Open Source community to (re)package their binaries. So you have to go all the way, and download the SDK’s and with that compile GDAL yourself.

QGIS installeren via osgeo4w

Most of the Windows users will install QGIS via the so called ‘stand alone installer’ which they download from For most of the users this is the easiest and most well know way to install a desktop program.
But QGIS has another Windows install possibility. And that is a so called osgeo4w installation ( ). osgeo4w stands for ‘Open Source Geo For Windows’, and s a full blown working environment for Windows users with almost all open source geo components and libraries. After installation there is one directory on you harddisk which contains all osgeo4w related programs and libraries. You can for example install QGIS, but als command line programs like ogr2ogr or gdalinfo. Het is even possible to run mapserver from within apache in this way.

Read More

Staafdiagrammen met legenda

This article describes how to create a map with bar charts and a legend.
Required software
Quantum GIS (
LegendSVG (
Inkscape (optional) (
Required files
Map layer with areas
Map layer with data
As an example, a vector map of the Dutch provinces is used. On top of this a layer is placed from a csv file. It contains the x and y coordinates of the centroids and the number of inhabitants by province, divided into three age groups.
This technique is not suitable if a lot of areas are to be displayed. The map would become very cluttered. Another limitation is that bar width is not adjustable.
Make sure the required layers have been opened and are fully visible.

Displaying bar charts

Select the properties of the layer with the data (right mouse button) and go to the tab ‘Overlay’. Put a check mark before ‘Display diagrams’ and select ‘Bar chart’ as chart type. Now, the attributes can be added one at a time. In this case, the population numbers per age group. Select an attribute, click ‘Add’, and repeat this for the other attributes.

Now you must specify the bar height. Usually, the attribute with the highest maximum value at the regional level will be used to determine the maximum bar height. Unfortunately, that will go wrong if this attribute is zero in one or more regions. Click ‘Find maximum value’ to determine the maximum value for the selected attribute and set the maximum bar height (‘Size’). In the current stable version of QGIS (1.7.4) it has no effect to select ‘Map units’ as size unit in stead of millimeters. Click ‘Apply’ to see the effect of the settings on the map. If necessary, move the dialog somewhat to the left, in order to see the map. Write down the settings for maximum value and maximum bar height. You will need this information later, if you create a legend. If the result is what you want, click ‘OK’ to exit the dialog box.
You can also enter the maximum value manually. For the readability of the legend it is better to use a rounded number.
Sometimes you also need to make the points symbols 100 percent transparent (on the ‘Style’ tab). Otherwise, point symbols will appear in areas with very low values ​​for the selected attributes.

Create legend

Currently, QGIS has no option to automatically create a legend for a map with bar, pie or circle charts. For this I wrote the program LegendSVG, to be downloaded on this site. Unzip the file somewhere on your computer and double click LegendSVG.exe.
With this program, a map legend in SVG format can be made. The legend can be added to the map in the Print Composer. LegendSVG uses points a measuring unit. One point is 1/72 inch and one inch is 2.54 cm. Dimensions in millimeters (S) can be converted to points with the formula: 72 x S / 25.4.

First, select the chart type (‘Bar chart’). The bar height and the corresponding maximum value that you wrote down, can be filled in at ‘Object size’ and ‘Maximal value’. At ‘Categories’, set the number of bars to 3. Because the bars have a fixed width of 5 mm in QGIS, you don’t have to change ‘Bar width’. Now you can customize all text that will appear in the legend. For the different ways to set the colors I refer to the help text of the program. Legend height is calculated automatically, based on the data you have entered. This is not (yet) done with legend width. If the settings are complete, click on the ‘Build SVG code’ button. Several lines of code will appear. A SVG file is basically a text file. Now save the results with the ‘Save to file’ button. Choose a filename. The file extension should remain ‘svg’. With the ‘Show measures’ button you can see what the dimensions in millimeters have become. Write these dimensions down, because you will need them later in QGIS.
Before you combine the legend with the map in QGIS, you can inspect the result with Inkscape. With this program you can modify the legend, if you wish. You could also choose to finish the entire map with Inkscape, or some other graphical program. However, this will not explained further.

Map lay-out

Open a new Print Composer (“Print layouter”) from the ‘File’ menu. Make sure the map is displayed and add a title. The legend can now be added with the ‘Add image’ button. You can also use the ‘Layout’ menu. Now click on the spot where the legend should appear. A white rectangle appears. Select this rectangle and in the right panel on the ‘Item’ tab enter the right size (unfortunately, QGIS unfortunately does not do this automatically). Then open the legend file using the button with the three dots next to the ‘Load’ box. If all went well the legend will appear.
Now it may seem as if something went wrong. In the current stable version of QGIS (1.7.4) the appearance of the bars in the Print Composer differs from the appearance on the map canvas. After you save the map with ‘Export as image’ or ‘Export as SVG’, the size of the bar charts on the map will match the size on the legend again.

You can also save your map in PDF format, but currently the menu option ‘Export as PDF’ does not work well with bar charts. You can solve this by printing to a virtual printer such as PDF Creator. Read More

Meerdere objecten / features tegelijk aanpassen / editten

Sometimes you find new QGIS functionality when a user asks you a question. Somebody working with house geometries was looking for a way to copy the same attributes to a set of selected houses. He was looking if certain types of houses in a city were usable for solarpanels on the roof. And often a block of houses share off course the same properties.
After a question on the QGIS-user mailinglist the answer came: “off course this is possible…”. Here a short demonstration of this.
Read More

Een kleurenschema voor de TOP10NL

When opening a geo-file for the first time in QGIS, random colors are assigned to the points, lines, and polygons. QGIS offers excellent features to design and use color style schemes. This article describes how to do this, with the objective as follows:

Figure 1. Adding Styles

I was just seven years old when someone gave me the special topographic edition of the Walcheren map (scale 1:25,000), which completely blew me away. My general love for graphic design expanded with a passion for cartographic styling. So, when Kadaster (the Dutch national mapping agency) finally offered their famous dataset “Top10NL” (meaning: Netherlands vectorized at a nominal scale of 1:10,000) for free (as GML files), I was in a state of total bliss. At last I was able to style the famous topographic Dutch map with my own color styles. Moreover, QGIS directly reads GML files, so I thought this was going to be an easy job.
Read More

Invoerformulieren gebruiken in QGIS

QGIS has something called forms to make it easier to change te attributes of an object. This article is about the use of these forms. As exampel we use a dutch dataset of the houses of the netherlands (BAG) which only contain geometries and not other attributes. These we are going to add ourself.
We start with a shapefile with the house geometries. With the Python Plugin ‘Table Manager’ of Borys Jurgiel it is pretty easy to add columns to the shape file. Just adding a name and a type of th column. It is also possible to change the order of the columns in the shape file.

In this way we created a shape file with attritutes to help us to do our imaginary ‘solar panel’ research. For every house we want to know if the user is interested in solar energy. And if that is the case, also check what other properties the house and it’s roof has.
Read More