Hand Vectorizing Political Boundaries from Complicated Maps

FacebookTwitterGoogle+RedditLinkedIn

small

Anyone who has tried to vectorize a paper map has struggled with the fact that maps are not designed to be cleanly read by computers, they are designed to cram as much information as possible in the smallest space that the human eye can interpret. Using a freeware image tool called GIMP, I have a quick and dirty way of removing the clutter and leaving only the political boundaries for vectorization. Take for example this political boundary map from the Vietnam War (click to zoom, warning big download at 12 meg).

We just want the country boundaries, both between countries and between land and water. Unfortunately, the map is crammed with political boundaries, rivers, text, etc.

medium

You could physically trace the outside perimeter for every country, but that would be very time consuming. You could try just selecting the light blue for the ocean boundary and the black/yellow between the countries, but it will pick up a lot more than just the boundaries and the lines will be full of holes thanks to all of the text labels that crisscross the boundaries.

A good alternative is to load the picture up in a program like GIMP, and use the fill tool to color each country and the ocean a distinguishing color. Don’t worry about missing small bits, get the large parts filled in and pay particular attention to the border areas. If there are gaps in the borders, use the pencil tool to quickly plug the holes, and continue filling.

medium (3)

Now use the color select tool, while holding down shift, to select all of the areas that are filled in. Create a new layer, and paste that selection to the new layer. What you will have will look like ugly swiss cheese from all the holes left by text, map features, and places you missed filling in.

medium (1)

Now go to filters, and select the despeckle filter. GIMP will make an educated guess about what color should be in the holes base on the nearby colors. Play with the settings until you find a balance that works for you, and run the filter as many times as necessary to plug all the remaining holes.

medium (2)

The final product will have a margin of error along the perimeter, but in many cases will be within tolerance and can be improved upon by more careful filling/despeckling. Most importantly, it can be done in a fraction of the time of other methods.

Created 17 Jun 2011, 12:03 Tags: gis maps vectorization


Stata: Deleting Variables that are Completely Missing

When merging or subsetting data sets, it is common to end up with variables that are missing for all remaining observations. This code provides a very fast method for removing variables that are completely missing while leaving variables that are nonmissing for at least one observation.

foreach i of varlist  *  {

gen TEMP=.
replace TEMP=1 if !missing(`i')
egen TEMPSUM=sum(TEMP)
if TEMPSUM==0 {
drop `i'
}
drop TEMP TEMPSUM

}
FacebookTwitterGoogle+RedditLinkedIn

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>