<?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>MaisonBisson.com &#187; spatial data</title>
	<atom:link href="http://maisonbisson.com/blog/post/tag/spatial-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://maisonbisson.com</link>
	<description>A bunch of stuff I would have emailed you about.</description>
	<lastBuildDate>Sat, 14 Nov 2009 20:14:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>.SHP to MySQL</title>
		<link>http://maisonbisson.com/blog/post/12154/shp-to-mysql/</link>
		<comments>http://maisonbisson.com/blog/post/12154/shp-to-mysql/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 23:21:51 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Dispatches]]></category>
		<category><![CDATA[.shp]]></category>
		<category><![CDATA[file conversion]]></category>
		<category><![CDATA[geodata]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[shp2mysql]]></category>
		<category><![CDATA[shp2mysql-php]]></category>
		<category><![CDATA[spatial data]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12154</guid>
		<description><![CDATA[
GIS data seems to come in .shp (shape?) files, but it&#8217;s not like MySQL knows what to do with those. this MySQL forum post points to a PHP tool and Windows executable that promise to convert the .shp data into something more useful to MySQL.
Superfluo explains a little more, and there&#8217;s lots of .shp data [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12154"><!-- &nbsp; --></abbr>
<p>GIS data seems to come in .shp (shape?) files, but it&#8217;s not like MySQL knows what to do with those. <a href="http://forums.mysql.com/read.php?23,122827,122827#msg-122827" title="MySQL :: Import SHP into MySQL.">this MySQL forum post</a> points to a <a href="http://sourceforge.net/projects/shp2mysql-php" title="SourceForge.net: SHP to MySQL in PHP">PHP tool</a> and <a href="http://kartoweb.itc.nl/RIMapper/" title="RIMapper and RIMapperWMS">Windows executable</a> that promise to convert the .shp data into something more useful to MySQL.</p>
<p><a href="http://superfluo.org/blojsom/blog/pic/geo/2007/11/13/Experimenting-with-MySQL-spatial-extensions.html" title="Superfluo">Superfluo</a> explains a little more, and there&#8217;s lots of .shp data to be had <a href="http://www.esri.com/data/download/census2000_tigerline/index.html" title="Census 2000 TIGER/Line Data">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12154/shp-to-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Find Stuff By Minimum Bounding Rectangle</title>
		<link>http://maisonbisson.com/blog/post/12148/find-stuff-by-minimum-bounding-rectangle/</link>
		<comments>http://maisonbisson.com/blog/post/12148/find-stuff-by-minimum-bounding-rectangle/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 19:34:31 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[MBR]]></category>
		<category><![CDATA[minimum bounding rectangle]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL spatial functions]]></category>
		<category><![CDATA[spatial data]]></category>
		<category><![CDATA[spatial functions]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12148</guid>
		<description><![CDATA[
MySQL offers ENVELOPE() to find the minimum bounding rectangle of a geometric object.
The result is a polygon with four segments, defined by five points. It took me a while to make sense of it, partially because the only documentation that I&#8217;ve run across so far for POLYGON() syntax is in the ENVELOPE() function mentioned above. [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12148"><!-- &nbsp; --></abbr>
<p><a href="http://www.flickr.com/photos/maisonbisson/2568621754/" title="mbr mysql minimum bounding rectangle by misterbisson, on Flickr"><img src="http://farm4.static.flickr.com/3276/2568621716_b5eb180c55_o.png" width="245" height="245" alt="mbr mysql minimum bounding rectangle" style="float: right;" /></a>MySQL offers <code>ENVELOPE()</code> to <a href="http://dev.mysql.com/doc/refman/5.0/en/general-geometry-property-functions.html#function_envelope" title="MySQL :: MySQL 5.0 Reference Manual :: 18.5.2.1 General Geometry Functions">find the minimum bounding rectangle</a> of a geometric object.</p>
<p>The result is a polygon with four segments, defined by five points. It took me a while to make sense of it, partially because the only documentation that I&#8217;ve run across so far for <code>POLYGON()</code> syntax is in the <code>ENVELOPE()</code> function mentioned above. I also had to draw a picture to think it through.</p>
<p>They write this: <code>POLYGON(( MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY ))</code>, I think this (in pseudocode-ish form): <code>POLYGON(( $point_a, $point_b, $point_c, $point_d, $point_a ))</code>, with the <code>$point_</code>s corresponding to the diagram.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12148/find-stuff-by-minimum-bounding-rectangle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working With Spatial Data in MySQL</title>
		<link>http://maisonbisson.com/blog/post/12147/working-with-spatial-data-in-mysql/</link>
		<comments>http://maisonbisson.com/blog/post/12147/working-with-spatial-data-in-mysql/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 16:41:45 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL spatial functions]]></category>
		<category><![CDATA[spatial data]]></category>
		<category><![CDATA[spatial functions]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12147</guid>
		<description><![CDATA[
It&#8217;s MySQL spatial data week here, though I am spreading out the posts to, um, ease the pain (or boredom). Anyway, here are some commands/functions I don&#8217;t want to forget about later:
Start with an existing table called geometry, add a spatial column and index it:

ALTER TABLE geometry ADD coord POINT NOT NULL;
CREATE SPATIAL INDEX coord [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12147"><!-- &nbsp; --></abbr>
<p>It&#8217;s MySQL spatial data week here, though I am spreading out the posts to, um, ease the pain (or boredom). Anyway, here are some commands/functions I don&#8217;t want to forget about later:</p>
<p>Start with an existing table called <code>geometry</code>, add <a href="http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-columns.html">a spatial column</a> and <a href="http://dev.mysql.com/doc/refman/5.0/en/creating-spatial-indexes.html">index it</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">ALTER</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #999900; font-weight: bold;">geometry</span> <span style="color: #990099; font-weight: bold;">ADD</span> coord <span style="color: #999900; font-weight: bold;">POINT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #FF9900; font-weight: bold;">SPATIAL</span> <span style="color: #990099; font-weight: bold;">INDEX</span> coord <span style="color: #990099; font-weight: bold;">ON</span> <span style="color: #999900; font-weight: bold;">geometry</span> <span style="color: #FF00FF;">&#40;</span>coord<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p><a href="http://dev.mysql.com/doc/refman/5.0/en/populating-spatial-columns.html">Insert</a> some data; think in terms of POINT(X Y) or POINT(lat lon):</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #999900; font-weight: bold;">geometry</span> <span style="color: #FF00FF;">&#40;</span>coord<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #00CC00;">GeomFromText</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008000;">'POINT(40 -100)'</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #999900; font-weight: bold;">geometry</span> <span style="color: #FF00FF;">&#40;</span>coord<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #00CC00;">GeomFromText</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008000;">'POINT(1 1)'</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p>Get those <a href="http://dev.mysql.com/doc/refman/5.0/en/point-property-functions.html">X,Y coordinates</a> back from the table:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #00CC00;">X</span><span style="color: #FF00FF;">&#40;</span>coord<span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> <span style="color: #00CC00;">Y</span><span style="color: #FF00FF;">&#40;</span>coord<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #999900; font-weight: bold;">geometry</span></pre></div></div>

<p>Get points within a <a href="http://dev.mysql.com/doc/refman/5.0/en/relations-on-geometry-mbr.html" title="MySQL :: MySQL 5.0 Reference Manual :: 18.5.5 Relations on Geometry Minimal Bounding Rectangles (MBRs)">bounding rectangle</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #00CC00;">MBRContains</span><span style="color: #FF00FF;">&#40;</span>
	<span style="color: #00CC00;">GeomFromText</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008000;">'POLYGON((0 0,0 3,3 3,3 0,0 0))'</span> <span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
	coord
<span style="color: #FF00FF;">&#41;</span>
<span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #999900; font-weight: bold;">geometry</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12147/working-with-spatial-data-in-mysql/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>