<?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>David Lynch &#187; svg</title>
	<atom:link href="http://davidlynch.org/blog/tag/svg/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlynch.org/blog</link>
	<description>has a blog</description>
	<lastBuildDate>Fri, 18 Jun 2010 07:37:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Creating an image map from SVG</title>
		<link>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/</link>
		<comments>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 18:55:43 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/</guid>
		<description><![CDATA[I was asked how I made the map in my examples earlier. I wrote a small script to do it. (The script is quite limited &#8212; I only made it complete enough to handle the SVG files I was using. Others might break it. Also, it requires pyparsing&#8230; and hoo-boy is that slow.) Example! Wikipedia [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked how I made 
<a  href="http://davidlynch.org/js/maphilight/docs/demo_world.html">the map</a> in my examples earlier.</p>
<p>I wrote 
<a  href="http://davidlynch.org/toys/svg2imagemap.zip">a small script</a> to do it.  (The script is quite limited &#8212; I only made it complete enough to handle the SVG files I was using.  Others might break it.  Also, it requires pyparsing&#8230; and hoo-boy is that slow.)</p>
<p>Example!</p>
<p>Wikipedia is good for this, and has provided me with the example file I&#8217;ll use, 
<a  href="http://en.wikipedia.org/wiki/Image:Map_of_USA_with_state_names.svg">a map of the USA</a>.  If you have some GIS data already, I believe that ArcGIS 9.2 has native SVG support, or it looks like you can convert ESRI shapefiles with 
<a  href="http://www.carto.net/papers/svg/utils/shp2svg/">shp2svg</a>.</p>
<p>My example file is filled with all sort of crud that isn&#8217;t a definition of state boundaries, though, so I need to get just that.  Perusing it (in a text editor or a SVG editor like Inkscape) reveals that all the state borders are in a group named &#8220;States&#8221;.  Helpful!</p>
<p>So I run my script: <code>svg2imagemap.py Map_of_USA_with_state_names.svg 960 593 States</code></p>
<p>(The &#8220;960 593&#8243; is the size of the image I&#8217;m creating from the SVG file.)</p>
<p>This creates an html file named [svg name].html, so Map_of_USA_with_state_names.html.  It only contains the area tags, so I dump them into an image map in a page set up like the one in the other examples&#8230;</p>
<p>And we get: 
<a  href="http://davidlynch.org/js/maphilight/docs/demo_usa.html">A map of the USA</a>.</p>
<p>Just to disclaim again: That script is unlikely to be immediately useful for any particular SVG image.  You would almost certainly need to tweak it significantly to make it work for your purposes.  But it&#8217;s a good start, at least.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
