Spincloud Labs: Political boundaries overlay in Google maps (Part 1)

Update Sep.21.2011: I took the code in this post and part deux and made a github project off of it called Gborders. The code is simpler and there are more options to generate the borders overlay based on geographic regions. Happy forks!

One thing I needed when designing the Meteoalarm mashup for Spincloud were the political boundaries for all European countries. With them at hand, I would use the polygon overlay from the Coogle API and fill the country polygons with the respective weather warning colors.

This first part is a tutorial on how to import world political borders into a MySQL database table.
The second part in these series will use this table to create a script that will add the country borders overlay to Google Maps.

So after learning that Google Maps API doesn’t give programatic access to the political boundaries I moved on to doing it myself. I read about the encoded polylines and figured that I only missed the country boundaries as encoded polygons so I started searching for readily-available resources. Sure enough there were nowhere to be found.

The next best thing was to find the country boundaries in some GIS format and generate the polyligons myself. The information seems to be sparse but after a bit of research I found was the CIA World Databank but the format is incomplete, it only defines the polygons with no country names or any other administrative hook that I would be able to use. I then spent hours trying to find a better resource until I remembered that Mapping Hacks (an excellent book by the way) has data set for the examples in the book. I had the first breakthrough, the website makes available updated world borders files here, they are mirrored from thematicmapping.org.

We’ll use a utility called shp2mysql to export the boundaries to SQL. I’m on a MacBook and no shp2mysql binaries for my platform were available in the original package so we’ll have to compile it first then run it to be able to export the shapefile to SQL.

Below are detailed all steps needed to to produce the borders SQL file on Leopard 10.5.x (note that you have to have the Developer Tools installed). In short, copy and run the following script on your mac in a file called process_boundaries.sh. The script creates a file called wb_dump.sql which is ready to be imported into database:
Continue reading “Spincloud Labs: Political boundaries overlay in Google maps (Part 1)”

libcurl.3.dylib and Google Earth

I just installed Google Earth on my mac. It went smooth, the software was installed under Applications but when I launched it I got this:

The application Google Earth quit unexpectedly.

Hit the Report button and got:

Library not loaded: /usr/lib/libcurl.3.dylib 
Referenced from: 
      /Applications/Google Earth.app/Contents/MacOS/libge_net.dylib

Reason: image not found

I actually upgraded libcurl a while ago and to 7.19.0 and I now only have /usr/lib/libcurl4.dylib libcurl.3.dylib version is gone. 

The solution I found was to create libcurl.3.dylib by adding a symlink like this:

sudo ln -s /usr/lib/libcurl.4.dylib /usr/lib/libcurl.3.dylib

Now Google Earth works just fine. On to find fame using the couch potato version of Indiana Jones: armchair archeology.