Ink and Water
Emmanuel Guibert used an incredibly clever technique to illustrate Alan’s War, a graphic novel about his friend’s experience in WWII. Here’s an example (via Drawn):
I was perplexed at first, but it all becomes clear about fifty seconds into the video.
Posted on Thursday, October 30th, 2008. Tags: art.
MacBook Markerboard
It recently occurred to me that the exterior surface of my MacBook is quite similar to the surface of a markerboard. Tonight I purchased a package of small dry-erase markers and put the idea to the test. It works great!
Now I can’t wait to bring my notebook computer to a meeting so I can take notes on its lid.
Posted on Thursday, October 30th, 2008. Tags: art, macbook.
Cartograms
A cartogram is a map in which the area of each region is distorted to represent a value other than physical area, such as population.
It’s election season here in the US, which means we see many maps of red and blue states. To keep the political persuasion of the nation in perspective, take a look at Michael Gastner, Cosma Shalizi, and Mark Newman’s maps of the 2004 and 2006 elections.
One of my favorite web sites, Strange Maps, has occasionally featured cartograms, including a map of world population from another collection of global cartograms prepared by Newman.
Strange Maps also featured a cartogram of where news happens drawn from a seminal paper by Gastner and Newman. The paper presents a solution to the challenge of preserving recognizable shapes and adjacencies while manipulating area. Traditional techniques typically compromise contiguity or detail, as seen in these examples from Borden Dent’s excellent Cartography: Thematic Map Design:
Conveniently, various implementations of Gastner and Newman’s algorithm are available: cart, by Newman; cartogram, by Gastner; and Cartogram Generator, by Frank Hardisty. Hardisty’s program has a cross-platform interface and works directly with shapefiles and shapefile attributes. I used it to create a cartogram of block groups in Binghamton based on their year 2000 populations:
The distortion is not extreme, but there are some interesting changes.
In addition to the interactive comparison view shown above, Cartogram Generator allows you to save the results as a new shapefile. It is supposed to have the ability to apply the same transformation to other shapefiles, too – useful for creating reference layers – but I could not get that feature to work.
I think it is important to show an undistorted map next to a cartogram except in cases where the actual sizes are well known (as with maps of the world or your state or nation). Otherwise, changes in proportion might not be recognized, and the story they are meant to tell will not be heard.
Posted on Saturday, October 4th, 2008. Tags: geography.
PROJ, GDAL, and OGR – Oh, My!
Here are brief introductions and home-brew installation instructions for two libraries (and sets of command line tools) widely used by open-source GIS applications.
In most cases you probably won’t need to compile these yourself, as end-user programs are typically packaged with everything you need. Sometimes batteries aren’t included, though, or you might want to write a program that uses these tools directly. They’re like wheels you don’t need to reinvent to build construction vehicles for your novel GIS problems.
proj-4.6.1: PROJ.4 Cartographic Projections Library
From the documentation (OF90-284):
Program proj (release 3) is a standard Unix filter function which converts geographic longitude and latitude coordinates into cartesian coordinates, (λ, φ) → (x, y), by means of a wide variety of cartographic projection functions.
Cartographic projection is the process by which points on a sphere are mapped to points on a plane. There are many ways this can be accomplished, all of which are necessarily compromises. PROJ.4 provides a programming interface to perform such projections.
./configure
make
make install
gdal-1.5.2: Geospatial Data Abstraction Library
GDAL provides a common programming interface to translate and access a variety of geospatial raster (i.e. bitmap) data formats. GDAL includes the OGR Simple Features Library, which performs a similar function for vector data. OGR uses PROJ.4.
./configure
make
make install
GDAL’s configure
script reports which optional features are available. Many have additional dependencies, such as the TIFF and PNG libraries built in a previous guide.
Posted on Monday, September 22nd, 2008. Tags: geography.
American FactFinder: Geo within Geo
A great deal of census data is available through American FactFinder. The custom table interface allows you to retrieve a single table containing exactly the data you want. To obtain data for many locations within another location, use the easily-overlooked “geo within geo” selection method to avoid the tedium of retrieving and combining separate tables for a group of locations.
As an example, I’ll show you how to retrieve the year 2000 population by age and sex for each block in Broome County, NY.
First, select Decennial Census from the Data Sets menu at factfinder.census.gov:
Then select Custom Table from the Census 2000 Summary File 1 category:
Here’s the important step. Click the geo within geo selection method tab:
Choose Blocks from the Show me all menu (your table will contain data at this resolution):
By default, the table will contain all block groups within a county. Select New York and Broome County from the following menus to select which county:
Select All Blocks from the list of blocks in Broome County and click Add:
Now that you have defined the enumeration units and area of interest, click Next to choose your variables:
Select P12 Sex by Age (Total Population) from the list of tables in Summary File 1 and click Go:
Check which variables you want from table P12 – all of them. Click Add, then click Next to proceed:
Click Show Result to display the table (this may take a few moments):
Lastly, choose Download from the Print/Download menu to obtain the table in spreadsheet form:
How you use the data is up to you. Perhaps you’ll use dbfjoin
to map it with an appropriate shapefile from the Census Bureau’s TIGER/Line repository. (Users of pro GIS tools don’t need dbfjoin
, but I’m bringin’ it to the streets!) Alternatively, you might want to plot the age/sex composition of a few blocks with Population Analyst. Stay tuned for more bargain-bin demography and cartography.
Posted on Sunday, September 21st, 2008. Tags: geography.
Compiling ChoroWare
ChoroWare is a suite of tools used to develop optimal data classifications for choropleth maps. I am surprised that I did not discover it until recently, because this is one of my favorite topics in cartography.
ChoroWare might prove to be particularly useful for ambitious users of free GIS applications like Quantum GIS or ArcExplorer. These programs do not offer very sophisticated classification schemes, but they do allow classes to be defined manually. In this way, I plan to try mapping classifications generated with ChoroWare.
Executable versions of ChoroWare are not available for Mac OS X (or any other platform), so you must build it from the source code. ChoroWare has two main dependencies: GTK+ and GSL. GTK+ itself has numerous prerequisites, which I have described in a separate article (again, it may be wise to use a package manager). Building GSL is relatively straightforward:
gsl-1.11: GNU Scientific Library
./configure
make
make install
With all the prerequisites in place, building ChoroWare is as simple as:
make
I found that make install
did not work, so I performed the equivalent action of copying the piping-hot new executables from their various subfolders to /usr/local/bin
.
The included example files run without fault. ChoroWare on Mac OS X:
More details about the theory and implementation of ChoroWare can be found in the documentation (PDF) and associated papers (PDF).
Posted on Sunday, September 21st, 2008. Tags: geography.
Building GTK+ the Hard Way
Update: Four days after posting this list, GTK+ OS X is available. I’m not sure how to use it build ChoroWare yet, but I’m sure it’s possible (and much easier than the process outlined below).
GTK+ is a user interface toolkit used by many open source software projects.
This is a record of how I managed to build GTK+ on my Mac, not a prescription for the best way to do it. The versions identified here may be out of date, for instance, and there may be additional dependencies I have failed to list. (Most of this work was done months ago, so these steps are based on old notes.)
This procedure yields an X11 version of GTK+. I understand that there is an effort to build a native version of GTK+ for Mac OS X, but this is not it.
I have provided a link to the web site or download area for each library, along with the commands used to build it. You should cd
to the library’s directory before running each set of commands. The libraries are listed in the general order in which they were built.
This is probably trivial with a package manager like Fink.
libiconv-1.11: Libiconv (Unicode conversion)
./configure
make
make check
make install
gettext-0.14.6: Gettext (internationalization)
./congfigure
make
make check
make install
libtool-1.5.22: Libtool (shared libraries)
Needed by LibJPEG.
./configure
make
make check
make install
jpeg-6b: LibJPEG
./configure --enable-shared
- (Edit line 39 of Makefile to point to path of GNU Libtool.)
make
make test
make install
tiff-3.8.2: LibTiff
./configure --with-apple-opengl-framework
make
make check
make install
libpng-1.2.12: LibPNG
./configure
make
make install
libxml2-2.6.26: LibXML 2
Needed by FontConfig.
./configure
make
make check
make install
fontconfig-2.4.1: FontConfig
Needed by Cairo.
./configure
make
make check
make install
cairo-1.2.4: Cairo (graphics renderer)
./configure
make
make test
make install
pango-1.14.4: Pango (text renderer)
./configure
make
make check
make install
atk-1.12.3: ATK (accessibility)
./configure
make
make check
make install
glib-2.12.4: The GIMP Library
./configure
make
make check
make install
Last, but not least:
gtk+-2.10.6: The GIMP Toolkit
./configure
make
make check
make install
Anyone brave enough to try all this is encouraged to post the inevitable corrections.
Posted on Saturday, September 20th, 2008. Tags: geography.
dbfjoin
This program creates a DBF output table by joining records with matching keys from a data table to a main table. Every record from the main table is copied to the output table. If a record with the same key exists in the data table, that data record is appended to the corresponding output record. If the data table does not contain a match, null values are appended instead.
If the format of the main table is “MAINKEY, VAL
” and the format of the data table is “DATAKEY, DATA
”, the format of the output table will be “MAINKEY, VAL, DATA
”.
If multiple data records have the same key, only the first record will be used. If multiple main records have the same key, each will appear in the output followed by the same values from the data table, if any.
Only string, integer, and double (floating-point number) field types are supported.
Example
To use dbfjoin
, state the names of the key fields from the main and data tables, followed by the paths to the respective input tables and lastly the path to the output table.
dbfjoin MAINKEY DATAKEY main.dbf data.dbf output.dbf
Acknowledgements
- Shapelib provides an attribute table API to read and write DBF files.
- Christopher Clark’s C Hash Table code helps locate data table records.
- Dan Bernstein’s djb2 hash function powers the hash table.
Download
- Mac OS X universal binary 18.2 KB
- dbfjoin-1.0 source code 11.6 KB
To compile dbfjoin
, you will need to edit the makefile to locate your copy of Shapelib.
Posted on Saturday, September 20th, 2008. Tags: geography, mac.
Rewriting the Population Analyst
In college I developed a web site called the Population Analyst. It is primarily a tool for demographic visualization with population pyramids. Here are Population Analyst representations of two communities in upstate New York:
These graphs are drawn with a common scale to facilitate accurate comparison. Clearly, a much greater percentage of Ithaca’s population is comprised of young adults. Plotting population pyramids of Binghamton and Ithaca on an absolute scale reveals that Binghamton has a larger population but similar numbers of young adults.
What do you know about these places that might explain the differences—or similarities—between their population structures? Alternatively, what can you predict about these towns or others with similar compositions?
I would like to rewrite the Population Analyst to make it more useful and easier to use. In addition to streamlining the interface and offering more control of diagram style, I would like to make these basic improvements:
- Provide direct integration with American FactFinder.
- Dramatically simplify input of data from other sources.
- Support arbitrary cohort intervals (instead of 5-year intervals from 0 to 85).
- Support arbitrary population segmentation (not just male and female).
- Offer vector output (PDF, PostScript, or SVG).
Asymmetric data sets (those without matching cohort intervals) should be supported as segments of the same graph as long as a common unit defines their cohort intervals.
The rewrite will not include a population projection component.
My dilemma is whether to implement the new version as a web app or a cross-platform desktop application. The original Population Analyst is a rudimentary web app, of course, but I am better prepared to deliver the desired data handling and interactive visualization features in a desktop environment.
Nevertheless, a program deployed as a web site has the great advantage of immediate accessibility. It would be a useful challenge to learn more contemporary techniques for doing nifty things in the browser. If I can identify good libraries and tool kits to help do some of the things I’ve planned for the new Population Analyst, it may yet remain on the web.
Posted on Thursday, September 18th, 2008. Tags: geography.
Recent Things Dock Stacks
Hot on the heels of an alternative to opening things with the Dock comes this tip (via Mac OS X Hints) about a different way to open things with the Dock. Fire up Terminal and enter these lines to restart the Dock with a new “recent things” stack:
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' killall Dock
Right-click the stack to choose what sort of items to display:
Visit the Appearance system preferences to choose how many items are displayed for each of the “Recent” options. The “Favorite Volumes” option displays connected drives, and the “Favorite Items” option shows the “Places” listed in the Finder sidebar (which can include files and applications as well as folders, by the way).
Here’s an example of what you might see in a Recent Applications stack:
You can run the command more than once to create a couple instances of the stack – useful if you’d like to use more than one of the display options.
Posted on Saturday, September 13th, 2008. Tags: dock, finder, mac.