Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Posts Tagged ‘QGIS’

Geocoding in QGIS, the easy way.

Posted by smathermather on October 1, 2013

Search the Google for geocoding in QGIS and you find a few nice articles, mostly pointing to third party web sites that will geocode for you, e.g. this post from 2009.  It’s a good post, but there’s an easier way now.

Well, let’s see if a little SEO will help solve this fgeocodeor people– a great tool for geocoding in QGIS is MMQGIS.  Add it as an extension, choose “GeoCode from Google”, and load up your CSV of addresses.  You may have to sit and wait a while, but rest assured, the result will be worth the wait.  So, load up the extensions manager and search for MMGIS.  Install.  Enjoy.

Now, off to find census data during the sequester… .

 

Posted in Geocode, QGIS | Tagged: , | 8 Comments »

QGIS Compositing, credits where due

Posted by smathermather on April 15, 2013

Credit where credit’s due on the great QGIS Compositing (as well as some stellar forthcoming raster tools):

http://nyalldawson.net/2013/03/coming-soon-in-qgis-2-0-blend-modes-for-layers/

I thought I had seen an unusually large spike in my Aussie traffic… .

Posted in Cartography, QGIS | Tagged: , , | Leave a Comment »

QGIS Compositing, more comparisons

Posted by smathermather on April 10, 2013

QGIS Compositing, more comparisons… .  You guess which is QGIS and which is TileStache… .

more_compositing_comparisons

Posted in Cartography, QGIS, TileStache | Tagged: , , | Leave a Comment »

QGIS Compositing, more gushing yet…

Posted by smathermather on April 9, 2013

Ever had a workflow on the web that resulted in stuff so nice, you wanted to replicate on the desktop?  Ya, me neither until recently.  I love the cartography a particular website, know all the bits and pieces of color and effects that go into, but had no desktop application that could do the same.   Until now.  On the left, QGIS, on the right, TileStache (i.e. mapnik).  There were a few practical differences in application which result in most of the differences you do see, but now we can wrap great cartography into all our products, printed or web.  And no, print is not dead yet, whatever the declaration.

blending_compositing_qgis

Posted in Cartography, QGIS, TileStache | Tagged: , , | Leave a Comment »

Quantum GIS Compositing Continued

Posted by smathermather on April 9, 2013

QGIS compositing is not limited just to between layers, but also for elements in the Print Composer. How is this useful? Every want a non-rectangular map? With 1.9 alpha, you can use an SVG to affect the elements under it.  On the right, the svg.  On the left, the map element inside the Print Composer.

01

Overlay the two with “Blending Mode” set to “Normal” and the svg covers the map.

02

Set the svg blending mode to “Dodge”, and we get an interesting mask, as well as (in this case) some additional affects related to the two different shades in our svg.

03

The svg shapes can be anything:

04

But let’s try something more meaningful, for example, using an svg to mask our map of a peninsula:

05

06

For your inner cartographer– behold!  A non-rectangular map!  Wrap some text around that puppy and call it art.

BTW, the map itself is a fake summer aerial created with povray, a winter aerial, and a little tinting of the winter aerial using blending mode “multiply” in the map itself.  But that is the topic of another post… .

 

Posted in Cartography, QGIS | Tagged: , | 2 Comments »

Way beyond red-dot fever– bees hives and overlapping home ranges

Posted by smathermather on April 6, 2013

Last week, post Boston Code Sprint, I spent a couple of hours playing with bee data, specifically bee keeper data for Norfolk County Massachusetts.

My friend Eric (a bee keeper of 4 hives in said county) says that worker bees can fly as far as 3 miles for nectar, but after that approximate limit, they hit diminishing returns relative to the calories they burn.

Proximity of bee hives is important for reasons of competition (although bees are quite friendly with each other on the flower) but also disease transfer, which in this age of not-so-easy bee keeping, is an important factor.  So we set out to map bees.

With a list of addresses, QGIS, and the mmqgis extension (see Plugins:Fetch Python Plugins)  which uses Google services for address lookup, we get a nice little set of points for beekeepers in Norfolk County.

01 points

Having a good context map for any such set of points is important.  This is the part of the project I worried most about.  Fortunately, we also have the OpenLayers Plugin, which allows us to add a number of web maps as background (BTW, when we want print quality maps down the road, this will cause us suffering, but for now it is a nice stand-in for a good base layer).  We decided the colorless Stamen Toner map was perfect for our purposes.

02 points toner

Now, let’s buffer these points– give those bees 1.5 miles of free reign, and see where the overlaps in range are (we could make these 3 mile radii, but you get the point):

03 buffer

The map tells us something of overlapping ranges, etc., but it seems like we could use something like we could do something more sophisticated.  Anyone who has followed my blog for a while will not be surprised by the employment of Voronoi polygons… .

04 voronoi

Eric, having suffered an explanation of different ways to calculate Voronoi earlier in the week, remembered the relationship between buffers and Voronoi, and asked if we could combine them.   In this case, picture soap bubbles of your youth.  Blow a soap bubble for each bee point, and the walls of bubbles in between form Voronoi polygons.  In our case, we use cones instead of soap bubbles, but after a couple hours of playing in PovRay, we made some code like this:

#version 3.6;

// Pov Includes
#include “colors.inc”
#include “transforms.inc”
#include “cone_coords.inc”

#declare Camera_Size = 500000; //freekin huge

background {color <0, 0, 0>}

//Set the center of image
#declare scene_center_x=759496;
#declare scene_center_y=2861454;

#declare Camera_Location = <scene_center_x,5,scene_center_y> ;
#declare Camera_Lookat = <scene_center_x,0,scene_center_y> ;

// Use orthographic camera for true plan view
camera {
orthographic
location Camera_Location
look_at Camera_Lookat
right Camera_Size*x
up Camera_Size*y
}

// Union all the cones together into one object

#declare coner = union {
cone { <0,0,0>,15840,<0,5,0>,0

} };

union {

#declare LastIndex = dimension_size(cone_coords, 1)-2;
#declare Index = 0;
#while(Index <= LastIndex)
object {
coner
translate cone_coords[Index]
}
#declare Index = Index + 1;
#end

// Pigment cones according to distance from camera
pigment {
gradient x color_map {
[0 color Blue ] // Blue to orange will help us employ blue as the alpha values later
[1 color Orange ]
}
scale <vlength(Camera_Location-Camera_Lookat),1,1>
Reorient_Trans(x, Camera_Lookat-Camera_Location)
translate Camera_Location
}
finish {ambient 1}
}

We get a funky result (yes, this is the result I hoped for):

05 raw pov blue 06 dialog 1

A little transparency, alternate QGIS blending mode, and using the blue band as a transparency band give us a nice output:

07 final 1

We’ll add in those Voronoi boundaries to emphasize the edge of these areas:

07 final

And since this is really only meant for Norfolk County bee keepers, and doesn’t represent folks outside that area, we’ll use a mask with a blending mode of “Subtract” to really offset this map:

08 mask norfolk 09 norfolk masked

I will be interested to see if this helps them look at disease control and spread.  In case you are wondering, Eric is luck enough to have an almost dedicated area for his bees, which includes a huge wetland complex (think: lots of flowers) that is (in his words) all his own.  Well, all his bees own, anyway.

Posted in Analysis, Optics, Other, POV-Ray, QGIS | Tagged: , , , | 2 Comments »

Compositing lands on the desktop– QGIS

Posted by smathermather on April 5, 2013

Ok, how come no one told me this?  Blending modes in QGIS?  I’m running the nightly build for 1.9, so I have no idea if this is new or old, but a little compositing in QGIS is very welcome… :

get_out_of_dodge

Now, how the heck do I set transparency?

Posted in Cartography, QGIS | Tagged: , , | 2 Comments »

Cartographic tricks and tips– making text readable.

Posted by smathermather on January 6, 2013

I was playing recently with techniques for making text/labels in maps more readable in a map.  We can use simple buffers to do this, but this isn’t always adequate.  Take this example:

Labeling

which is a label on top of contours.  It is adequately readable.  If we show 2 ft contours as well, the map becomes somewhat cluttered:

2ft contours

So, we apply the common technique of halo or buffer, which in this case we’ll do in QGIS:

image004

and so we get an adequate result:

image005

If we color the halo the same as our background color, we achieve a subtle but effective result:

image006Overall, I’m pretty pleased with this result. But note the contour lines running through the “O” and “G”, etc.  This would be more readable if we blocked more of the contour linework.  Enter convex polygons:

image007

image008

image010

Overall, I like this effect a lot. It can be subtle but quite powerful.  It would also may a nice addition to existing rendering pipelines as a labeling option, in middleware such as GeoServer, MapServer, or the Mapnik family.

golf_orig ——–>golf_final

Irony here– I’m absolutely awful at anything but mini-golf (putt-putt).

Posted in QGIS | Tagged: , | 4 Comments »

Using Quantum GIS for real work…

Posted by smathermather on July 7, 2012

I have long lived in the desktop realm of ESRI, and expect ESRI products to be a part of my workflow for a long time to come.  But, the time has come to delve in deeply with Quantum GIS.  I’ve read from many sources that it has come of age as a desktop GIS.  I tried it 4 years ago, along with its competitors in the Open Source desktop GIS world, and was unimpressed.  Consider me convinced.

So why now?  Why try QGIS again?  I had a unpaid side project (church volunteer work).  Unpaid one-off projects inspire the use of FOSS tools.  That said, the tool is likely to now be part of my paid work flow as well.  It was easy to use, easy to compose a decent looking map in very little time, had nice tools for labeling and line rendering, as well as sane and useful defaults.  The one flaw I found was for a large format print (I wanted 24″x36″) the exported PDF was prohibitively large (158 Mb).  As I was working on a Mac, I simply printed to PDF with fine results and a reasonable file size (1.6 Mb).

Posted in Cartography, QGIS | Tagged: , , , | 1 Comment »