<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tales From The Cloud &#187; tools</title>
	<atom:link href="http://blog.newsplore.com/tag/tools/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.newsplore.com</link>
	<description>Everything beta</description>
	<lastBuildDate>Tue, 07 Sep 2010 10:40:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Spincloud Labs: Political boundaries overlay in Google maps (Part 1)</title>
		<link>http://blog.newsplore.com/2009/02/22/spincloud-labs-political-boundaries-overlay-in-google-maps-part-1</link>
		<comments>http://blog.newsplore.com/2009/02/22/spincloud-labs-political-boundaries-overlay-in-google-maps-part-1#comments</comments>
		<pubDate>Sun, 22 Feb 2009 21:34:41 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gis]]></category>
		<category><![CDATA[overlay]]></category>

		<guid isPermaLink="false">http://blog.newsplore.com/?p=531</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="padding-right:0;margin-top:3px"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.newsplore.com%2F2009%2F02%2F22%2Fspincloud-labs-political-boundaries-overlay-in-google-maps-part-1"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.newsplore.com%2F2009%2F02%2F22%2Fspincloud-labs-political-boundaries-overlay-in-google-maps-part-1" height="61" width="51" /></a></div><p align="justify">One thing I needed when designing the <a href="http://blog.newsplore.com/?p=382">Meteoalarm mashup</a> for <a href="http://spincloud.com">Spincloud</a> were the political boundaries for all European countries. With them at hand, I would use the <a href="http://code.google.com/apis/maps/documentation/overlays.html#Polygons_Overview">polygon overlay</a> from the Coogle API and fill the country polygons with the respective weather warning colors.</p>
<p>This first part is a tutorial on how to import world political borders into a MySQL database table.<br />
The second part in these series will use this table to create a script that will add the country borders overlay to Google Maps.</p>
<p>So after learning that Google Maps API doesn&#8217;t give programatic access to the political boundaries I moved on to doing it myself. I read about the <a href="http://code.google.com/apis/maps/documentation/polylineutility.html">encoded polylines</a> 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.</p>
<p>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 <a href="http://www.evl.uic.edu/pape/data/WDB/">CIA World Databank</a> 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 <a href="http://mappinghacks.com/">Mapping Hacks</a> (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 <a href="http://mappinghacks.com/data/">here</a>, they are mirrored from <a href="http://thematicmapping.org/downloads/world_borders.php">thematicmapping.org</a>.</p>
<p>We&#8217;ll use a utility called <a href="http://kartoweb.itc.nl/RIMapper/code/shp2mysql_0_4.zip">shp2mysql</a> to export the boundaries to SQL. I&#8217;m on a MacBook and no shp2mysql binaries for my platform were available in the original package so we&#8217;ll have to compile it first then run it to be able to export the shapefile to SQL.</p>
<p>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 <a href="http://developer.apple.com/Tools/">Developer Tools</a> 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:<br />
<span id="more-531"></span></p>
<pre>mkdir borders
cd borders
wget http://mappinghacks.com/data/TM_WORLD_BORDERS-0.2.zip
mkdir boundaries_shp
unzip TM_WORLD_BORDERS-0.2.zip -d boundaries_shp
wget http://kartoweb.itc.nl/RIMapper/code/shp2mysql_0_4.zip
unzip shp2mysql_0_4.zip -d shp2mysql_04
wget http://dl.maptools.org/dl/shapelib/shapelib_1_2_10.zip
unzip shapelib_1_2_10.zip
cd shapelib-1.2.10
make
cd ..
rm ./shp2mysql_04/src/*.o
sed 's/^OBJS.*$/OBJS = \.\.\/\.\.\/shapelib-1\.2\.10\/shpopen\.o \.\.\/\.\.\/shapelib-1\.2\.10\/dbfopen\.o/' shp2mysql_04/src/Makefile &gt; shp2mysql_04/src/Makefile2
mv shp2mysql_04/src/Makefile2 shp2mysql_04/src/Makefile
cd shp2mysql_04/src
make
cd ../../
cp shp2mysql_04/src/shp2mysql .
./shp2mysql -d boundaries_shp/TM_WORLD_BORDERS-0.2.shp world_boundaries test_db &gt; wb_dump.sql
rm *.zip
rm -rf shp2mysql_04
rm -rf shapelib-1.2.10
rm -rf boundaries_shp</pre>
<p>Make the above script executable then run it:</p>
<pre>chmod +x process_boundaries.sh
./process_boundaries.sh</pre>
<p>If you&#8217;re interested in the details about this script then read on otherwise <a href="#import-to-DB">happily skip it</a>. The final SQL file is linked at the end of this post.</p>
<p>We&#8217;ll start by bringing the shape files:</p>
<pre>mkdir borders
cd borders
wget http://mappinghacks.com/data/TM_WORLD_BORDERS-0.2.zip
mkdir boundaries_shp
unzip TM_WORLD_BORDERS-0.2.zip -d boundaries_shp</pre>
<p>The files are in ESRI&#8217;s shp format which wasn&#8217;t exactly what I needed. I had to export them in a more usable format, SQL in my case. For this I used the <a href="http://kartoweb.itc.nl/RIMapper/code/shp2mysql_0_4.zip">shp2mysql</a> utility for which I didn&#8217;t find the MacOS executable so we&#8217;ll compile it from source. Since it has a dependency to <a href="http://shapelib.maptools.org/">shapelib</a> we have to download and compile it along:</p>
<pre>mkdir shp2mysql
wget http://kartoweb.itc.nl/RIMapper/code/shp2mysql_0_4.zip
unzip shp2mysql_0_4.zip -d shp2mysql
wget http://dl.maptools.org/dl/shapelib/shapelib_1_2_10.zip
unzip shapelib_1_2_10.zip
cd shapelib-1.2.10
make
cd ..</pre>
<p>Now you should have both shapelib and shp2mysql downloaded with shapelib succesfully compiled.  Now we&#8217;ll compile shp2mysql: we have to delete all .o files (they have been compiled for a different platform), fix the Makefile then issue the <code>make</code> command</p>
<pre>rm shp2mysql/src/*.o
sed 's/^OBJS.*$/OBJS = ../../shapelib-1.2.10/shpopen.o ../../shapelib-1.2.10/dbfopen.o/' shp2mysql/src/Makefile &gt; shp2mysql/src/Makefile2
mv shp2mysql/src/Makefile2 shp2mysql/src/Makefile
cd shp2mysql/src
make
cp shp2mysql/src/shp2mysql .</pre>
<p>which should execute successfully.<br />
We&#8217;re ready to export the world boundaries into SQL format. Switch to the <code>boundaries</code> folder then issue the export command as follows:</p>
<pre>cd ..
./shp2mysql -d boundaries_shp/TM_WORLD_BORDERS-0.2.shp world_boundaries test_db &gt; wb_dump.sql</pre>
<p>this will create a SQL file called wb_dump.sql ready to be loaded into your database.</p>
<p>Running the script will generate a file called wb_dump.sql which is ready to be imported on your spatially enabled database:<br />
<a name="import-to-DB"></a><br />
All we have to do now is to import the sql file into the database. Note that the database has to be spatially enabled (MySQL is by default, I&#8217;m using 5.0). Issue the following command:</p>
<pre>mysql -uroot -p my_database &lt; wb_dump.sql</pre>
<p>Now we should have country borders for the whole world imported in the database.<br />
For convenience, I have made the world boundaries SQL file available for <a href="http://blog.newsplore.com/wp-content/uploads/2009/02/wb_dump.zip">download</a> (4.3 MB).</p>
<p>In the second part of this how-to, we&#8217;ll use this table to create the country borders overlay for Google Maps.</p>
<p class="fbconnect_share"><fb:share-button class="url" href="http://blog.newsplore.com/2009/02/22/spincloud-labs-political-boundaries-overlay-in-google-maps-part-1" /></p>]]></content:encoded>
			<wfw:commentRss>http://blog.newsplore.com/2009/02/22/spincloud-labs-political-boundaries-overlay-in-google-maps-part-1/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>libcurl.3.dylib and Google Earth</title>
		<link>http://blog.newsplore.com/2008/11/22/libcurl3dylib-and-google-earth</link>
		<comments>http://blog.newsplore.com/2008/11/22/libcurl3dylib-and-google-earth#comments</comments>
		<pubDate>Sat, 22 Nov 2008 13:24:40 +0000</pubDate>
		<dc:creator>Florin</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.newsplore.com/?p=303</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="padding-right:0;margin-top:3px"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.newsplore.com%2F2008%2F11%2F22%2Flibcurl3dylib-and-google-earth"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.newsplore.com%2F2008%2F11%2F22%2Flibcurl3dylib-and-google-earth" height="61" width="51" /></a></div><p>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:</p>
<p>The application Google Earth quit unexpectedly.</p>
<p>Hit the Report button and got:</p>
<pre>Library not loaded: /usr/lib/libcurl.3.dylib 
Referenced from:
      /Applications/Google Earth.app/Contents/MacOS/libge_net.dylib

Reason: image not found</pre>
<p>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. </p>
<p>The solution I found was to create libcurl.3.dylib by adding a symlink like this:</p>
<pre>sudo ln -s /usr/lib/libcurl.4.dylib /usr/lib/libcurl.3.dylib</pre>
<p></p>
<div>Now Google Earth works just fine. On to find <span style="underline;"><a href="http://news.bbc.co.uk/2/hi/europe/4267238.stm">fame</a></span> using the couch potato version of Indiana Jones: <a href="http://news.nationalgeographic.com/news/2006/11/061107-archaeology.html">armchair archeology</a>.</div>
<p class="fbconnect_share"><fb:share-button class="url" href="http://blog.newsplore.com/2008/11/22/libcurl3dylib-and-google-earth" /></p>]]></content:encoded>
			<wfw:commentRss>http://blog.newsplore.com/2008/11/22/libcurl3dylib-and-google-earth/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
