Related Plugins and Tags

QGIS Planet

Opening MS SQL Server 2008 Spatial tables in QGIS – Correctly

Turns out the last blog post I did on this subject contained a few errors, mainly that QGIS wouldn’t render the layer when you opened it.

The answer is so obvious it’s almost embarrassing :)

In order to open and display a SQL Server 2008 layer in QGIS correctly, via OGR, you must have a geometry_columns table in your database with the name, geometry type and srid of the layer. That’s it! Oh look, it was even right in front of me in the OGR code for the mssqlspatial driver.

int OGRMSSQLSpatialTableLayer::FetchSRSId()
{
    CPLODBCStatement oStatement = CPLODBCStatement( poDS->GetSession() );
    oStatement.Appendf( "select srid from geometry_columns "
                    "where f_table_schema = '%s' and f_table_name = '%s'",
                    pszSchemaName, pszTableName );

    if( oStatement.ExecuteSQL() && oStatement.Fetch() )
    {
        if ( oStatement.GetColData( 0 ) )
            nSRSId = atoi( oStatement.GetColData( 0 ) );
    }

    return nSRSId;
}

So the process to open a MS SQL 2008 spatial layer in OGR is as follows.

There are two main tables which tell OGR how to read a layers projection:

  • geometry_columns
  • spatial_ref_sys

geometry_columns contains the table name and the key for the table spatial_ref_sys which contains the projection string. The projection string is the info that QGIS needs in order to correctly render a layer.

The easiest way to get the correct tables is to let OGR handle it for you via ogr2ogr, then just adding any other tables you may have already in your database to the geometry_columns table.

So to get ogr2ogr to create the right tables for you it’s as simple as running the following command from inside the OSGeo4W shell, changing the connection string part of course:

ogr2ogr -overwrite -f MSSQLSpatial "MSSQL:server=.\MSSQLSERVER2008;database=geodb;trusted_connection=yes" "rivers.tab"

(sample taken from http://www.gdal.org/ogr/drv_mssqlspatial.html)

Uploading even just one table this way will create both tables and fill in the needed info.
The geometry_columns table:

f_table_catalog f_table_schema f_table_name f_geometry_column
geodb dbo rivers ogr_geometry
coord_dimension srid geometry_type
2 32768 POLYGON

The spatial_ref_sys table:

srid auth_name auth_srid srtext proj4text
32768 NULL NULL PROJCS[“UTM_Zone_56_Southern_Hemisph…. +proj=utm +zone=56 +south +ellps=GRS80 +units=m +no_defs

So if you have already existing tables in your MS SQL 2008 database that were loaded, via say MapInfo’s EasyLoader, you would just upload one table via ogr2ogr to create the two tables needed by QGIS(using OGR) and then add the other tables to the geometry_columns table. If they are all in the same projection than you are in luck as you will only need to upload one in order to get the right strings in the spatial_ref_sys table, if not just upload a small sample for each projection.

Then you can open the table in QGIS using:

uri = "MSSQL:server={serverName};database={databaseName};tables={tableName};trusted_connection=yes"
qgis.utils.iface.addVectorLayer(uri,'{yourLayerNameHere}','ogr')

Tip: In order to test you have correctly set the table in geometry_columns you can run another ogr tool ogrinfo:

ogrinfo -al "MSSQL:server=localhost;database={your database};tables={your table}" -fid 1

If you see a value in Layer SRS WKT: then chances are it’s set right and QGIS should be able to render it, however if you see: Layer SRS WKT:(unknown) Than chances are QGIS will not render it correctly.

Hopefully this help people use MS SQL 2008 Spatial with QGIS, a important step I think in the world of using QGIS on Windows (especially when you don’t have the freedom to run PostGIS:) ).

I might even do a video tutorial when I get some free time after my exams and my wedding.


Filed under: Open Source, qgis Tagged: gis, map-rendering, mapping, MS SQL Server 2008, MS SQL Spatial, ogr, Open Source, OSS, qgis, Quantum GIS

One of my favorite features of QGIS – Rule based styling.

One of my favorite features of QGIS is the rule based rendering.

QGIS rule based rendering dialog

QGIS rule based rendering dialog

If you’re using MapInfo think of thematics + queries but on steroids. Rule based rendering allows you to you set, well, rules on what gets rendered and how.  The rules are based on a simple SQL style query language that’s built into QGIS.

Take for example the above screen shot.   The screen shot is from a current project I am doing in QGIS to clean up our current stormwater/drainage layer.  The layer is a in a bit of a mess at the moment so I needed a way to visualize what I have cleaned up and what I haven’t, so enter QGIS rule based styling.

For example: A pipe that has an upstream and downstream invert and is part of the trunk (main) network is then considered valid (for this situation anyway), so I created the following rule:

network_type = 'Trunk' AND Description != 'Drainage Imaginary Pipe' AND (US_Invert > 0 AND DS_Invert > 0)

We also have little connecting pipes that I don’t want to include in valid trunk  as they are only used to connect pits to pipes and are just cosmetic, I have excluded them by adding “Description !=’Drainage Imaginary Pipe’” to the above filter.

Next I wanted to show invalid trunk network pipes (ones without an up or downstream invert), so we just invert the last condition and swap the last AND for a OR:

network_type = 'Trunk' AND Description != 'Drainage Imaginary Pipe' AND (NOT US_Invert > 0 OR NOT DS_Invert > 0)

I also need to show but no highlight the non trunk pipes and the connecting pipes, so I made the next two rules and set their styles to a light gray:

NOT network_type = 'Trunk' AND NOT Description = 'Drainage Imaginary Pipe'
Description = 'Drainage Imaginary Pipe'

Finally I want to show pipe direction on all pipes but not the connecting pipes, again as they are just cosmetic:

Description != 'Drainage Imaginary Pipe'

You will also note in the screenshot above that I have a max zoom scales set on the last three rules, this is because when I zoom out all that info becomes overwhelming at that scale and distracts from showing the invalid parts of the main trunk line.

So after all that, the results:

Screenshot of rules applied

Map rendered using rules

and if I zoom out pass 5,000:

Screenshot of rules applied, zoomed past 5,000

Map rendered when zoomed out pass 5,000

I think you can see how this rule based rendering could be very powerful, in fact I have about four different rule sets I use with the drainage layer to show different things to different people.

The rules I have shown above are pretty simple, you can go pretty crazy and use them to render OpenStreetMap data: http://www.youtube.com/watch?v=NBBYtH2svw0

The worst part about the rule based rendering is that I have gotten so used to their power that I feel crippled when I go back to MapInfo and try to do styling :)

Happy mapping.

What is your favorite QGIS feature?


Filed under: Open Source, qgis Tagged: gis, map-rendering, mapping, Open Source, OSS, qgis, Quantum GIS, styling, thematics

Delete all branches on a github repo

I forked the QGIS repo on GitHub a little while ago although one thing that bothered me was that it gave me copies of all the branches that the main QGIS git repo had.  This is understandable as it’s the way it works however I don’t really need all these branches in my forked copy of the repo as I don’t care about them.   I only care the ones I am working on, and I don’t want to see a big list of branches in my git fork that have nothing to do with me.

So the next question was how do I delete all the branches on the remote repo at GitHub. Well you would normally do:

git push origin :branch_name

although doing that by hand for each branch is, well, a pain in the butt! After a chat with a guy (strk) on the #qgis IRC channel who is more skilled at bash then me (I’m still a Linux noob) he came up with this:

git branch -r | grep origin/ | grep -v master | grep -v HEAD| cut -d/ -f2 | while read line; do git push origin :$line; done;

Very handy.


Filed under: Open Source, qgis Tagged: git, Open Source, OSS, qgis, Quantum GIS

The things I would like to see in QGIS. What are yours?

So if you have not already guessed from my increasing post about QGIS. I really like it as a GIS system but with all systems it comes with its shortcomings. (Nothing that can’t be fixed of course)

Here is my little wishlist of a few things I would love to see in QGIS.

Multipule map canvases. (ArcGIS, MapInfo)

I was thinking more like ArcGIS data frames vs something like what MapInfo has (multiple windows).  I think the multi window system can add confusion for people new to GIS, plus I hate having to window manage.

SQL like interface. (MapInfo)

This is something that I really like from MapInfo.  It adds a lot of power to the application being able to spatially join two tables that don’t share a command link column and get back a new layer.  Adding this to QGIS could be a pretty big task, although a very rewarding one IMO.  

Now there is some credit in saying “well you can just import your data into PostGIS and use that”, however that is not always a option and I think having a layer above that can query any open layer would be very very powerful.

These are just two of the main things that I would like to see, I’ll update the post if I can think of anymore.

Of course being open source I can write the features myself but C++ is still a bit over my head at the moment.

I would love to see what other peoples thoughts, or mini wishlists, are.  So if you are willing, drop a comment and let me know.


Filed under: MapInfo, Open Source, qgis Tagged: Feature Requests, gis, mapinfo, Open Source, OSS, qgis, Quantum GIS

Opening MS SQL Server 2008 Spatial tables in QGIS

EDIT:  If you are having trouble opening MS SQL 2008 in QGIS I will have a blog post coming explaining how to correct it. Or you can read the comments between TheGeoist and I below which will have the answer.

Just a quick tip.

Thanks to GDAL/OGR 1.8 QGIS can now open MS SQL Server 2008 spatial tables via the OGR MSSQLSpatial driver.

First you must be running a version of QGIS that is using GDAL/OGR 1.8.  Opening the QGIS about page will tell you if it is supported.

Need version 1.8 or higher

As I am writing this on my Ubuntu install I only have version 1.6.3 but the latest dev version of QGIS (upcoming 1.7 release) for Windows in the OSGeo4W installer is complied with version 1.8.

Now open the python console in QGIS and type the following:

uri = "MSSQL:server={serverName};database={databaseName};tables={tableName};trusted_connection=yes"
qgis.utils.iface.addVectorLayer(uri,'{yourLayerNameHere}','ogr')

Replacing {serverName} with your server name, if installed on your local machine you can use localhost; {databaseName} with the name of the database with the tables;{tableName} with the table to open; {yourLayerNameHere} with the name you would like the layer to have in the map legend.

After that you should see your MS SQL Spatial table displayed in QGIS, with editing support.

At the moment there is no nice interface in QGIS to open MS SQL tables like there is for PostGIS, although that might be a good plugin project for someone to work on.


Filed under: Open Source, qgis Tagged: gis, mapping, MS SQL Server 2008, MS SQL Spatial, Open Source, OSS, python, qgis, Quantum GIS

Getting ECW and MrSID support working in QGIS dev OSGeo4W install

Note:  This post is about getting ecw and mrsid support working in the trunk (qgis-dev) version of QGIS which is installed with the OSGeo4W installer.  Non-dev versions seem to work fine following this method: http://www.qgis.org/wiki/OSGeo4wSetup#Installing_support_for_raster__.2A.ECW_.28ERMapper.29_and_.2A.sid_.28MrSid.29_formats

Getting ECW and MrSID support into QGIS can be a real pain in the butt when you first try; but once you know how it’s easy.

If you try to open a ecw file in QGIS you will get this nice little error message:

What?  I thought QGIS supported ECW files!

Turns out it does, but the team are not able to ship the required libs with the program due to licensing restrictions by ERDAS.   Luckily adding support is not “too” hard.

  1. First head over to http://www.erdas.com/products/ERDASECWJPEG2000SDK/Downloads.aspx
  2. Click Download Now for the ERDAS ECW/JP2 SDK Desktop Read-Only, Version 4.1 libs,
  3. Fill out a bit of registration details and click though all the pages (this is the most painful process I have ever had to go though to get some libs for a program, ERDAS should be ashamed that it is such an effort.)
  4. Once you have download ECWJP2SDKSetup_RO_20100920.exe; install it.
  5. Copy all the files from C:\Program Files\ERDAS\ERDAS ECW JPEG2000 Read SDK\bin\vc90\win32 into the bin folder of your OSGeo4W install (default is C:\OSGeo4W\bin)
    You can open the OSgeo4W shell and run: copy “C:\Program Files\ERDAS\ERDAS ECW JPEG2000 Read SDK\bin\vc90\win32\*.dll” %OSGEO4W_ROOT%\bin to do the same thing.
  6. Launch osgeo4w-setup.exe, the installer that you used to install qgis-dev,  and select  gdal-ecw, gdal17-ecw and gdal-mrsid, gdal17-sid under the libs section. Let it install the needed libs and any dependencies.
  7. Open %OSGEO4W_ROOT%\bin and search for qgis-dev.bat; open it with a text editor and add the following line:
    set GDAL_DRIVER_PATH=”%OSGEO4W_ROOT%”\bin\gdalplugins\1.8
    I always insert it just after  SET OSGEO4W_ROOT=
  8. Launch qgis-dev.bat
  9. Open a ecw

ECW file opened in QGIS

I have tested this on a couple of machines now but as always

with no guarantee that it will work on yours :)  (Although it should)


Filed under: Open Source, qgis Tagged: ecw, gis, mapping, mrsid, Open Source, qgis, Quantum GIS, raster

Generating contour lines in QGIS

One of the cool things I love about QGIS is finding stuff that you didn’t know it could do, well not just itself but plugins that you didn’t know about.

Today my discovery was in how to generate contour lines from a point layer.

  1. First install the contour plugin for qgis via the plugin installer.  Just search for “contour”
  2. Once installed open a vector point layer in QGIS.  Make sure the point layer has a field that you can use for elevation.

    One I prepared earlier

  3. Then select from the menu: Plugins->Contour->Contour
  4. Fill in the information

    Details form (The above setting will generate 0.5m contours)

  5. Press OK
  6. Results

    Results from plugin

  7. Profit??

The resulting contours will have a field that contains the label and z value for each contour line, you can then just label or color them how you wish.

Note:  There is a bug with QGIS memory layers where the fields don’t  show up in dropdown or attribute browsers, a simple fix is just to make the layer editable and then non editable then the fields will be there.

The contour layer is a QGIS memory layer so remember to save it to disk eg a shapefile before you close you will loose your new fancy contour layer.

Happy mapping :)


Filed under: MapInfo, Open Source, qgis Tagged: gis, mapping, Open Source, python, qgis, shapely

Getting total length of selected lines in QGIS via python

The other day I was trying to get the total length of the some selected lines in QGIS. In MapInfo I would just do

Select Sum(ObjectLen(obj,”m”)) from Selection

however QGIS doesn’t have the ability (yet..) to run SQL queries like this, but you can do it via python.

The following is a little python snippet that will get the total length of the selected objects. (You will need to have shapely installed to use)

from shapely.wkb import loads
def getLength():
    layer = qgis.utils.iface.mapCanvas().currentLayer()
    total = 0
    for feature in layer.selectedFeatures():
        geom = feature.geometry()
        wkb = geom.asWkb()
        line = loads(wkb)
        total = total + line.length
    return total

print getLength()

EDIT:Or as Peter asked in the comments, yes you can just call length on the geometry:

def getLength():
    layer = qgis.utils.iface.mapCanvas().currentLayer()
    total = 0
    for feature in layer.selectedFeatures():
        geom = feature.geometry()
        total = total + geom.length()
    return total

print getLength()

Just copy and past that into your QGIS python console and call getLength() when ever you need the total length.

Note: I have found the QgsGeometry .legnth() function to be unstable in the past and it has crashed my QGIS instance. Just test it first, if not you can always use the shapely method.


Filed under: Open Source, qgis Tagged: gis, mapping, Open Source, python, qgis, Quantum GIS, shapely

Picture: MapInfo to QGIS Styling

Just a quick one.

This afternoon I was having a go at getting our work MapInfo layers to look the same in QGIS as they do in MapInfo.  I wanted to do this; 1) So I can print maps from both systems for people and they are a consistent style 2) Would rather use QGIS for every day map work.  3) To see what they compare like.    I think it came out pretty good, apart from few symbols that I didn’t get time to finish.

MapInfo vs QGIS

Note that MapInfo has anti-aliasing and transparency  turned off, as it makes MapInfo very slow and render any output as bitmaps rather than vectors (poor).  Where as QGIS is using both, as it doesn’t suffer from the same problems.

EDIT: To be fair here is both with the best settings turned on.  They are pretty much the same, which is a good thing.



Filed under: MapInfo, Open Source, qgis Tagged: mapinfo, mapping, Open Source, qgis, Quantum GIS

QGIS and GRASS in Local Government Bushfire Hazard Mapping – A Case Study

QGIS and GRASS in Local Government Bushfire Hazard MappingIntroduction

The Southern Downs Regional Council (SDRC) is a small-to-medium sized local government in south east Queensland, Australia. The council region, mainly the southern part, suffers from major bushfires.  Bushfire is a real and present concern for the residents and landowners in the Southern Downs Region, and has resulted in the loss of life and property.

This project will allow the council and the people of the region to be more aware of the risk and to allow for better decision making in the future.

The Project
As bushfire is not only a problem for SDRC but also for the whole of Queensland, the state government requires that each local government identifies the bushfire hazard in their area via the State Planning Policy 1/03 Mitigating the Adverse Impacts of Flood, Bushfire and Landslide [1].  This kind of job would normally be done using consultants but was instead done by the council itself using a combination of QGIS and GRASS.

The GIS side of the project project was broken down into 6 main steps

  1. Slope assessment and mapping
  2. Aspect assessment and mapping
  3. Vegetation assessment and mapping
  4. Combining scores to identify the severity of bushfire hazard
  5. Field verification and qualitative assessment
  6. Final Maps

The use of QGIS and GRASS
QGIS, using the GRASS plugin, was selected as it provided the tools needed to complete the job and the interaction between QGIS and GRASS made it easy to process the raster maps and present them in a meaningful way to users.  SDRC uses MapInfo for its main GIS system, however MapInfo’s addons were not as powerful as GRASS GIS for raster processing.

The QGIS GRASS plugin was used to import 5 meter contours of the whole region into GRASS which were then converted into a contour raster map using r.surf.contour.  A slope and aspect map were then generated using r.slope.aspect from the raster contour map.  Categories groups were assigned to different slope and aspect ranges and given a risk sore.  Vegetation areas were also given different risk scores.  All the resulting raster maps were then combined using mapcalc and given a final risk hazard score.  The risk scores are then divided into three main categories: high; medium; and low.  

The final part of the process was field verification via the rural fire service. After the review process, QGIS was used to print the final maps for presentation.

As all GRASS commands can be run from the command line, all the commands that were needed to generate the bushfire hazard maps were recorded, for documentation purposes and for if the maps needed to be regenerated some time in the future.

Conclusion.
Overall QGIS, together with the GRASS plugin, provided a great experience and a great final outcome for the council doing their own bushfire hazard mapping.  The GRASS plugin provides a very easy to use interface to GRASS through QGIS.  As QGIS is able to open the GRASS raster format natively, integration is very seamless and maps can be made with ease.

The project won an encouragement award at the Queensland Planning Institute of Australia state planning awards in 2010 [2]

References
[1] http://www.emergency.qld.gov.au/publications/spp/
[2]http://digital.crowtherblayne.com.au/default.aspx?xml=crowther_pia.xml


Filed under: Open Source, qgis Tagged: bushfire, case study, GRASS GIS, Open Source, qgis, Quantum GIS

Generating a Gource source commit history visualization for QGIS (Quantum GIS)

A couple of days I found a pretty cool open source project for visualizing the history of version controlled code.  The project is called Gource and can be found here: http://code.google.com/p/gource/ On the videos wiki page there are a few videos of other projects that have used gource to generate cool videos of their commit history so I thought I should make one for QGIS.

After downloading and building the latest source for Gource and fetching the current trunk of QGIS following these instructions: http://spatialgalaxy.net/2010/12/27/contributing-to-qgis-using-git/ I ran the following in my terminal on my Ubuntu machine, with my current directory being the download git repo from the above instructions:

  gource --title "Quantum GIS" --logo images\icons\qgis-icon.png \
  --hide filenames --date-format "%d, %B %Y" --seconds-per-day 0.15 \
  --highlight-all-users --auto-skip-seconds 0.5 --file-idle-time 0 --max-files 999999999 \
  --multi-sampling --stop-at-end --elasticity 0.1 -b 000000 \
  --disable-progress --user-friction .2 --output-ppm-stream - | \
  ffmpeg -an -threads 4 -y -b 3000K -vb 8000000 -r 60 -f image2pipe \
  -vcodec ppm -i - -vcodec libx264 -vpre libx264-medium qgis.mp4

Don’t worry I know it looks crazy but it’s really not that bad.  I’ll break it down.

  • –title “Quantum GIS” Well, yeah, adds a title to the project.
  • –logo images/icons/qgis-icon.png Adds a icon watermark
  • –hide filenames This hides the filenames of the files being committed . I hide these because it makes it pretty hard to see.
  • –date-format “%d, %B %Y” Formats the date at the top of the video.
  • –seconds-per-day 0.15 How many seconds represent a day. The lower this is the fast a day goes by, meaning me commits in less time.
  • –highlight-all-users Highlights all the users all the time.
  • –auto-skip-seconds 0.5 If there are no commits for this time it will skip to the next commit.
  • –file-idle-time 0 How long before the file disappears from the video, 0 means never good for seeing the full file tree.
  • –stop-at-end Stops the video at the end of all the commits.
  • -b 000000 The background colour, in this case black.
  • –output-ppm-stream – Tells gource to output the result ppm stream to STDOUT, which is then piped ( | ) into the ffmpeg

That is a quick overview of some of the gource arguments, running grouce -H in your terminal will print out the full list.  I’m not going to go into the ffmpeg arguments because frankly I don’t understand them very well and video isn’t really my thing.  I’m sure there are ffmpeg experts that would be able to do it better then what I have.

After running the above commands in my terminal window and letting it do its thing, I had a resulting mp4 file which I then uploaded to YouTube.

Below is the video that I uploaded to YouTube, which took about 5 hours due to my very very slow (read 138kb/s) upload speed.  The video is about 8 years of QGIS development in just over 9 minutes.

As it’s a bit hard to see in the video due to the quality, each cluster of files is a directory and the branches show the folder hierarchy.

Direct link to video: http://www.youtube.com/watch?v=-NILKRiMtcU

Happy new year and happy coding :)


Filed under: Open Source, qgis Tagged: git, Gource, mapping, Open Source, qgis, Quantum GIS

Open Source QGIS – Use, Contribute, Be part of it.

Since using and writing code for the open source GIS project QGIS I have come to see that the thing that really keeps open source projects alive is the community and documentation.  Without the community the project fails, and without documentation it makes it very hard for new users to find their feet and in the end loosing potential users and contributors.   Now what does have to do with QGIS?  Well, while the documentation is pretty good already there are always areas that could be improved, and new features are always slower to get help written as getting stable code is higher priority.

First. Why help in open source projects?

  1. Become part of the project rather then just a user.
  2. Help move the project forward faster.
  3. It helps tune your programming and non-programming skills.
  4. Get the girls!?

OK maybe not the last one, but the rest are valid.

If your not a developer, or even if you are, then this is where you come in.  If you are using QGIS and upon clicking a help button are presented with a help menu that doesn’t exist (just a blank white help page) or even is missing help on a certain feature, maybe consider updating the help file with some info on said feature in order to help people in the future.   It doesn’t have to be anything fancy, every little bit helps.

Editing the help files.

The help files are probably the easiest things to edit as you don’t need to be able to compile the source, or know anything about programming, to contribute.  First you will need to install QGIS. I would recommend using the  OSGeo4W installer as it will get you everything you need in one easy installer.  Once you have installed QGIS, navigate to the following folder [depending where you installed it]: “C:\OSGeo4W\apps\qgis\resources\context_help” you will see something like the following:



Help files for QGIS

Don’t be fooled by the file extensions, or lack thereof, they are just html files.  The funny stuff at the end is just the code for the language ie en_US is US English as QGIS supports different languages these codes are needed so the help knows which one to show to the user.

So that’s really it, you don’t need to do anything apart from edit some HTML files.

Submitting Changes

This is the hardest part of the process. Currently there are two ways I can think of to commit your changes to the main QGIS project. (1) Download the full source from QGIS SVN server, create a diff patch for the changed file and submit it as a ticket to the QGIS bug list. (2) Send the new document  to me and I will do the first step for you, and submit it the team.  Also given that the first step involves knowing and understanding subversion, and accessing the source control [not a hard task just a topic for a different post/video] step 2 is easier for the non-developer.

Example

I thought it would be good to give a quick example of editing a help document.

After finding the dialog with the help file needing work, let’s go with the style manager dialog which happens to have no help written yet:

Oh! No help for the style manager dialog.

We then need to navigate to the context help folder in C:\OSGeo4W\apps\qgis\resources\context_help and find the file that is linked to that dialogs help button [they tend to have the same name as the dialog]. So in this case it’s called:  QgsStyleV2ManagerDialog-en_US.  As I don’t know any other languages I will be working on the English one.

Opening the file in your favorite html editor [Notepad++] up gives us the following:

<h3>Style Manager</h3>

Well that explains why there isn’t any help.  The file is empty apart from the header.  So lets add something.

<h3>Style Manager</h3>
<br>The style manager allows for easy creation and management of QGIS styles that can be used when styling layers.</br>

Now save the file and reopen the help dialog in QGIS, no need to restart QGIS.  And there we go:

Style manager help all done....ok well maybe not.

It’s a simple as that.  I would advise reading though some of the already written help files to get a feel for style, and type of language used but apart from that feel free to send me any changes and I will submit them as a ticket once I have few collected.

Happy Mapping

P.S If are a non developer, or developer, and are interested in using Subversion to create patches for QGIS documentation I am more then happy to lend a hand if needed.

Handy Links


Filed under: Open Source, qgis

MapInfo and QGIS – An overview

Disclaimer: Like all my blog posts, this post is a reflection of my opinions and my opinions only. They do not reflect the opinions of my employer.

Recently I have got more into the open source movement, with my coding and my choice of software.  I tend to try to pick open source software for a couple of reasons, one of the main things is being free but apart from that I try to pick software that I can use to improve my development skills.  Being able to view the code is a big plus for me, being able to change and improve the software myself is an even bigger plus.

My most recent pick has been rediscovering QGIS (Quantum GIS), a free and open source GIS system written [mostly] in C++ using the Qt framework, and extensible by both Python and C++. I first discovered QGIS a couple of years ago, I was impressed but not impressed enough to really get into it. Maybe it was that I was so used to MapInfo I didn’t give it a proper look; or I didn’t really have the data in the right format, as I mainly used MapInfo, and if it couldn’t open and edit MapInfo TAB files I didn’t want to use it; or just lack of time; or whatever the reason. I used it for a day thought “Yep cool” and went back to using MapInfo.

Recently, however, they released QGIS 1.5 [and now QGIS 1.6] which changed the way I looked at the software.

The first thing I noticed was it was a lot faster in regards to map rendering then it used to be, not as fast as MapInfo but still very usable and efforts are being made to improve it even more so.

Styling of the layers has also improved a lot since I first tried it, it now has stack styling for points, lines and regions. Stack styles is something that was introduced in MapInfo 10.5, but unlike MapInfo, QGIS allows you to create a stacked style for each feature class rather than a style override like in MapInfo.  So you have a lot more control with styling in QGIS then you do in MapInfo.

QGIS styling dialogs for lines

and styles applied:

Ok not that pretty but it's a demo image.

Styling in QGIS is also only based on the underlying data of the object, think thematic maps in MapInfo.  I kind of like this, rather than just being able to just style an object you need to think about the data that is stored with an object.  This also stops the style and data getting out of sync.  At times I have seen maps made in MapInfo with no information on the object but  just styled to show different classes.

QGIS supports a large number of formats. It can open and write tab files but just not at the same time, no big deal as you can always use shape or a postgis database then just convert back if needed.

QGIS also has an interesting plugin system, while being able to use C++ and Python, the main app has a plugin installer [a plugin itself] which lets you install plugins from “hosted repositories”.  This makes finding new tools with work with very easy.

Plugin installer. Very very handy.

Composers are basically MapInfo layout windows, they allow you to add maps, legends, text labels, dynamic scale bar. attribute tables.  Composers can be exported to svg, pdf or printed just like layouts and you can have as many composers as you need.

A composer window for QGIS

Labeling options in QGIS are pretty much the same as MapInfo, if not more. You have the ability to use columns from a table that defines information about labels eg colour, X and Y etc if needed.

But one big feature that I really like about QGIS is the info tool. Unlike MapInfos info tool, you can define per table how and what information is displayed for each column and there is no stupid Ctrl+C copy bug.  It’s a bit hard to explain so a picture saves a thousand words:

Defining each how each column should be displayed.

and editing or adding a new feature:

When editing or adding features this dialog is shown.

For me as a developer the one thing that I find great with QGIS is it has a very kind and active developer community, though both IRC and email, and the code is relatively well organized .   I was able to pull down the source code for the latest trunk and have a build running in Ubuntu in under a hour [this mainly being due to my lack of Linux experience].   Being able to see something you don’t like, change it and submit it back to the project is a very good feeling.

Some downsides:

While QGIS is very good, and is always improving, it doesn’t always win over MapInfo in everything.  One major thing that MapInfo has going is its SQL, being able to run the same SQL syntax over any kind of table in MapInfo is a great feature.   QGIS, in this regard, tends to leave those things up to the underlying provider.  You are able to run simple [or complex] queries on an open table but being able to do something like “Select Col1, Col2, Col3 From Table Where Col1 = “SomeCondition” Group By Col2″  isn’t really there, although if you are running PostGIS it is quite easy.

Query

QGIS Query builder.

The next big thing MapInfo has, is MAPBASIC.  While QGIS has a built-in Python shell and has a relatively good API, MAPBASIC is very easy language to get up to speed with especially for beginners.

MapInfo also has multiple map windows, this is something that isn’t currently implemented in QGIS.  However I did bring it up on the #qgis IRC channel and the developers seemed happy with the idea but just needed time and someone to implement it.

Summary:

I could talk all day about all the cool things that QGIS can do but to save boring you I’ll leave it at this for now, more posts to come in the future I’m sure.

At the moment for my current day-to-day map work, I have gone from using MapInfo to using QGIS almost full time.  Like mentioned above, there are still some things that MapInfo does well and I tend to use MapInfo for those kind of jobs.  Also as my employer uses MapInfo and runs pretty much a full MapInfo system, I still use it for maintaining things like Exponare.  Using and developing for QGIS also means I have fallen behind on my MapInfo .Net tools, I still have a couple on the go and plan to get them out just before Christmas [or maybe a little bit after]

So my overall impressions with QGIS, if you couldn’t tell already, are: very very impressed with a very strong feeling it’s only going to get better.

So if you’re interested in trying something new, give QGIS a go.

Some handy links:


Filed under: Open Source, qgis Tagged: mapinfo, Open Source, qgis

Back to Top

Sustaining Members