Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Archive for April, 2013

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 »

Solarized

Posted by smathermather on April 5, 2013

I have been intending to use Ethan Schoonover’s Solarized (http://ethanschoonover.com/solarized) colors for vim for development work for a while now, and finally got around to adding it to my profile on my laptop.  What is nice about the colors is they are meant to be distinguishable in the terminal without using excessive contrast– color is the primary distinguishing element.  It makes writing or reading on a computer easy on the eyes, and so once again vim has become my goto for development work (although I don’t recommend it for everyone…).

solarize

Posted in Other | Tagged: | Leave a Comment »