5

I would like to create a simple Dorling Cartogram map in QGIS. My goal is for it to be a similar style to these maps created by the New York Times:

http://www.nytimes.com/interactive/2013/11/20/us/which-states-will-allow-old-health-policies-to-be-renewed.html?smid=pl-share&_r=0

I have a shapefile of jurisdictions, and I would like to size them based on their population. The shapefile already has equal-sized square polygons for each jurisdiction, with each polygon roughly placed in its correct geographical location relative to the other polygons.

The Cartogram plug-in in QGIS does a good job of creating a Contiguous Cartogram, but I would like to keep the square-shape of each polygon; just size them larger or smaller based on their population.

After they have been sized, I would also like to be able to do some basic styling on them (i.e. have different colored polygons based on the type of jurisdiction, like City, Village, etc.).

2

there are a couple of tools out there (ProtoViz, Mapresso) that can do this but they're no longer actively developed or supported.

I did find this d3 example on Bloc.ks which does a Dorling (or is it Demers?) Cartogram.

It uses force-directed graphing to jostle the states into a pleasing layout to minimise overlaps, although some overlaps still exist (shown as brown in that example).

If you have sufficient JavaScript knowledge you might be able to adapt that, or even code it to output the results as a shapefile or delimited WKT file.

The resulting Cartogram can be dropped into Map Composer as an HTML frame. You might be able to extract the SVG (d3 works as SVG) and import as an image too.

2

I think the easiest way would be to use Adobe Illustrator (or some other vector editor) or programatically (like D3 - which is not necessarily easy)

With QGIS or ArcGIS, symbols at centroid positions will either overlap or be discontinuous, rather than displaced to correct(ish) positions (or at least in a nice and tidy, shape preserving way like the NYT example).

So if you can export a proportional symbol map to illustrator or another open-source alternative, you can easily manually adjust the symbols to appropriate locations.

2

There is actual working code in Appendix B of Dorling's CATMOD booklet that describes the method.

The pseudo code is:

For each region
   Calculate the radius of a circle so that its area is proportional to population'
   While the forces calculated below are not negligible
     For each region (the order of calculation has no effect)
       For each region which overlaps with the region
          Record a force away from the overlap in proportion to it
       For each region which originally neighboured the region
          Record a force towards it proportional to distance away 2
       If the forces of repulsion are greater than attraction
         Scale the forces to less than the distance of the closest circle
       Combine the two aggregate forces for each circle 3
   For each region
     Apply the forces recorded to be acting on each circle to its centroid 

IIRC it is mostly a matter of looping and book keeping to make it efficient. I'll see if I can dig up some code when I'm next at home.

0

If you convert the polygon shapefile to a point shapefile with the same attributes, you can use the style settings to display different sized squares based on the population field.

Go to layer properties, style tab. Choose "single symbol." Select square for the symbol shape. Next to where it says "size" click on the little menu icon. Choose the option Size Assistant... and choose population for the field. Tweak the other settings and rearrange the points until you like the way it looks.

  • I think that won't work too well because squares won't get displaced by bigger ones, they will just overlap. – underdark Sep 6 '16 at 17:30
  • The Size Assistant is a helpful feature, and one that gets me closer to the desired output. However, as @underdark mentioned, while I can control the size of the squares, they end up overlapping; while others (mainly the smaller ones) remain quite a distance away from their adjacent features, leaving a lot of "blank space" in between some of the squares. I could rearrange/move the points to place the squares closer to each other, but then if I want to resize the squares based on a different attribute, the points would then have to again be rearranged. – Wes Kent Sep 6 '16 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.