Installing D3 TopoJSON us-states on Fedora

2014-03-01

I’m trying to make maps of the (U.S.) states that can be shaded to reflect certain data (for example, tax levels by state) using D3.js. So I installed TopoJSON, which was straightforward enough, but that didn’t have the state boundary definitions, so I had to install us-atlas, which is where thing’s got interesting.

Mike Bostock‘s installation directions were straightforward:
<br /> git clone https://github.com/mbostock/us-atlas.git<br /> cd us-atlas<br /> npm install<br /> make<br />

The first two commands went fine, but when I ran nmp install, I got an error related to the canvas package. Mike mentions this as a possible issue and gives intructions for a workaround on Mac, but I’m on Fedora. However I found this, which told me to run this:
<br /> $ su -c 'yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel'<br />
and then I was able to run npm install.

On to running make.  I ran it and got this error:
<br /> Makefile:272: *** mixed implicit and normal rules. Stop.<br />

I discover  that this generally is an issue with make version 3.82 and the solution is to temporarily downgrade to make 3.81 and discovered here how to do it on Fedora. But that didn’t quite do it, as I got this error:
<br /> GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-13-x86_64<br />

So I threw caution to the wind and modified the command to
<br /> sudo yum --nogpgcheck downgrade make --releasever=13<br />

and it worked. Whew! Now to run make again. Are we out of the woods yet? No. This time I got a different error:
<br /> ogr2ogr: command not found<br />

I tried sudo yum install ogr2ogr to no avail, so I googled ogr2ogr and it appears to be part of the gdal package. So a
<br /> sudo yum install gdal<br />
later, I ran make again and it successfully installed.

Hope this helps someone.

Written on March 1, 2014