

Also, create a recognizable Id and Label for the state lines (I just called it State_Lines). So just search online for a list of the state FIPS codes, find a labeled map if you need one (which one’s Indiana and which one’s Illinois again?), and chug along with this for a few minutes. But you can put in the state names or postal abbreviations for the Label. I recommend using the two-digit state FIPS codes for the Id values - it’s much easier to match data against FIPS codes than against state names (Does your dataset write North Carolina as two words or compress them into one? Did they put Washington DC or District of Columbia? etc.).

So… click on each state in turn, use Ctrl+Shift+O to get the Object Properties menu, and give the state an Id and a Label. (Let me know if you see a simpler way to do this!) We must give each object a meaningful name, so that we know which path corresponds to which state when add data to the map. But each path’s “id” is something like “path12345″ and there’s no way we can tell what state that’s supposed to be. If you resave the SVG and open it in Notepad again, you should see there are only about 52 different “path” elements instead of the hundreds we had before. Likewise for the other multi-part states. So again, click and drag to select all of Alaska’s various bits and bobs, and use Ctrl+K to combine them into a single object.

This way, when we edit the SVG later, they’re all part of the same path and we only have to change its style in one place.Īfter this, we also want to group Alaska’s islands together, and Hawaii’s, and the two parts of Michigan and also of Virginia (there’s that little peninsula across the Chesapeake Bay). We do this by going to Edit -> Find and, in the Style box, searching for the term “line” … then close the Find popup and hit Ctrl+K to combine all the lines into a single object. To get to this point, we want to select all of the lines and merge them into one object. So in the next few steps, nothing is going to look different visually on the map we’re just changing how the map is organized internally. In order to follow his approach, we’re going to want to end up with exactly one “path” for every state (so we can recolor them with our own data) and a final one for the state outlines (so we can change all the line colors at once). Open this SVG file in Notepad or similar, and you’ll see it contains XML, just as Nathan’s tutorial explains. You may as well save this as a SVG file now. To do this, just click and drag to select it, then hit Delete. I deleted Puerto Rico (bottom right corner) at this point, since I don’t need to map its data very often. Let’s Ungroup again so that we can select each state separately. Great, now we can edit this smaller map to contain just the pieces and info that we need.

Then drag the map into the document and stretch it out using the arrows (while holding down Ctrl so that the aspect ratio doesn’t change). I also wanted the final image to be around 500×500 pixels, so you can set that custom size under File -> Document Properties. Right-click and select Ungroup to break it up into its components, then select just the map in the top right and copy it into a new document. The mini-map I wanted is in the top right corner, but if you try to select anything, it’s initially all grouped together (so if you click and drag, the entire document moves together). With Shift + and Shift – you can zoom in and out of the map. It’s straightforward to open map2.eps in Inkscape. Fortunately, several images from the Census Atlas are available in EPS format near the bottom of this page, under “PostScript Map Files.” With access to such vector graphics, we can get started.įrom that website, I downloaded the “Location – Map 2″ file. To create a SVG file from this EPS, you’ll need a vector graphics program like Adobe Illustrator… or the open source alternative, Inkscape, which is what I used. Unfortunately, I haven’t been able to track down any colleagues who know where to find the original shapefiles for this map. I have wanted a map like this for my own purposes, when mapping a variable for all 50 states and DC. the fine detail was smoothed out) but still recognizable, and DC was enlarged to be big enough to see. I particularly liked the small multiples of state maps, which were highly generalized (i.e. The following was inspired by the 300-page Census Atlas of the United States, full of beautiful maps of 2000 decennial census data. And while I’m at it, how could I turn down the opportunity to replicate Nathan’s Python approach in R instead? However, if you don’t have a SVG handy already and instead you want to repurpose a map from another vector format such as PDF or EPS, there are a few extra steps that can be done in the free tool Inkscape. I love Nathan Yau’s tutorial on making choropleths from a SVG file.
