<?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>Numpty&#039;s Progress &#187; GIS</title>
	<atom:link href="http://glaikit.org/category/gis/feed/" rel="self" type="application/rss+xml" />
	<link>http://glaikit.org</link>
	<description>lost, to five decimal places</description>
	<lastBuildDate>Wed, 01 Feb 2012 03:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Toronto Data really open</title>
		<link>http://glaikit.org/2012/01/31/toronto-data-really-open/</link>
		<comments>http://glaikit.org/2012/01/31/toronto-data-really-open/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:04:13 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[osm]]></category>
		<category><![CDATA[toronto]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=677</guid>
		<description><![CDATA[Looks like the data sets at toronto.ca/open might finally actually be open; that is, usable in a way that doesn&#8217;t bind subsequent users to impossible terms. The new licence (which unfortunately is behind a squirrelly link) basically just requires you &#8230; <a href="http://glaikit.org/2012/01/31/toronto-data-really-open/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/' rel='bookmark' title='quite a bit of work to do in Toronto'>quite a bit of work to do in Toronto</a> <small>Looking at the OSM Inspector for Toronto, there are still...</small></li>
<li><a href='http://glaikit.org/2011/04/27/bixi-comes-to-toronto/' rel='bookmark' title='Bixi comes to Toronto!'>Bixi comes to Toronto!</a> <small>BIXI Toronto is (nearly) here! Here are the proposed station...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2012/01/31/toronto-data-really-open/"></g:plusone></div><p>Looks like the data sets at <a href="http://www.toronto.ca/open">toronto.ca/open</a> might finally actually be <strong>open</strong>; that is, usable in a way that doesn&#8217;t bind subsequent users to impossible terms. The new <a href="http://www1.toronto.ca/wps/portal/open_data/open_data_fact_sheet_details?vgnextoid=59986aa8cc819210VgnVCM10000067d60f89RCRD">licence</a> (which unfortunately is behind a squirrelly link) basically just requires you to put a reference to this paragraph somewhere near your data/application/whatever:</p>
<p style="padding-left: 30px;">Contains public sector Datasets made available under the City of Toronto&#8217;s Open Data Licence v2.0.</p>
<p>and a link to the licence, where possible.</p>
<p>Gone are the revocation clauses, which really prevented any open use before, because they would require you to track down all the subsequent users of the data and get them to stop. Good. I think we can now use the data in <a href="http://www.openstreetmap.org/">OpenStreetMap</a>.</p>
<p>While commenting on the licence&#8217;s squirrelly URL — I mean, could <em>you</em> remember <a href="http://www1.toronto.ca/wps/portal/open_data/open_data_fact_sheet_details?vgnextoid=59986aa8cc819210VgnVCM10000067d60f89RCRD">http://www1.toronto.ca/wps/portal/open_data/open_data_fact_sheet_details?vgnextoid=59986aa8cc819210VgnVCM10000067d60f89RCRD</a>? — I stumbled upon the comedy gold that is the <a href="http://wx.toronto.ca/inter/2point0/comments.nsf/form?OpenForm#log">City of Toronto Comments Wall log</a>. There goes my planned reading for the day.</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/' rel='bookmark' title='quite a bit of work to do in Toronto'>quite a bit of work to do in Toronto</a> <small>Looking at the OSM Inspector for Toronto, there are still...</small></li>
<li><a href='http://glaikit.org/2011/04/27/bixi-comes-to-toronto/' rel='bookmark' title='Bixi comes to Toronto!'>Bixi comes to Toronto!</a> <small>BIXI Toronto is (nearly) here! Here are the proposed station...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=677&amp;md5=5690f2b7f52c3f625a7df00d4d2d0e40" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2012/01/31/toronto-data-really-open/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=677&amp;md5=5690f2b7f52c3f625a7df00d4d2d0e40" type="text/html" />"
	</item>
		<item>
		<title>we can has street names</title>
		<link>http://glaikit.org/2011/12/19/we-can-has-street-names/</link>
		<comments>http://glaikit.org/2011/12/19/we-can-has-street-names/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 20:20:47 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[canada]]></category>
		<category><![CDATA[geobase]]></category>
		<category><![CDATA[openstreetmap]]></category>
		<category><![CDATA[roads]]></category>
		<category><![CDATA[wms]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=673</guid>
		<description><![CDATA[Pierre Béland reminded the Canadian OSM group of the GeoBase WMS, which has all the NRN road names in it. Here&#8217;s my neighbourhood&#8217;s OpenStreetMap data with the road names overlaid. No related posts. Related posts brought to you by Yet &#8230; <a href="http://glaikit.org/2011/12/19/we-can-has-street-names/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/12/19/we-can-has-street-names/"></g:plusone></div><p><a href="http://glaikit.org/wp-content/uploads/2011/12/geobase_nrn-osm.png"><img class="aligncenter size-medium wp-image-674" title="geobase_nrn-osm" src="http://glaikit.org/wp-content/uploads/2011/12/geobase_nrn-osm-512x332.png" alt="" width="512" height="332" /></a>Pierre Béland reminded the Canadian OSM group of the <a href="http://www.geobase.ca/geobase/en/wms/index.html">GeoBase WMS</a>, which has all the <abbr title="National Road Network">NRN</abbr> road names in it. Here&#8217;s my neighbourhood&#8217;s OpenStreetMap data with the road names overlaid.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=673&amp;md5=f8c4b4021090475765266e6c064d9da3" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/12/19/we-can-has-street-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=673&amp;md5=f8c4b4021090475765266e6c064d9da3" type="text/html" />"
	</item>
		<item>
		<title>quite a bit of work to do in Toronto</title>
		<link>http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/</link>
		<comments>http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 19:23:43 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[openstreetmap]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=667</guid>
		<description><![CDATA[Looking at the OSM Inspector for Toronto, there are still a lot of nodes that need to be remapped (or OpenStreetMap users that need to be advised) when the big licence change comes. (and yes, I blogged this just so &#8230; <a href="http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/02/08/fixing-garmin-file-dates/' rel='bookmark' title='fixing garmin file dates'>fixing garmin file dates</a> <small>While the Garmin GPSMap 60csx is a lovely unit, it...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/"></g:plusone></div><p><a href="http://glaikit.org/wp-content/uploads/2011/12/Screen-Shot-2011-12-19-at-14.14.00-.png"><img class="aligncenter size-medium wp-image-668" title="Screen Shot 2011-12-19 at 14.14.00" src="http://glaikit.org/wp-content/uploads/2011/12/Screen-Shot-2011-12-19-at-14.14.00--512x333.png" alt="" width="512" height="333" /></a>Looking at the <a href="http://tools.geofabrik.de/osmi/?view=wtfe&amp;lon=-79.27701&amp;lat=43.73602&amp;zoom=11&amp;overlays=overview,wtfe_point_harmless,wtfe_line_harmless,wtfe_point_modified,wtfe_line_modified_cp,wtfe_line_modified,wtfe_point_created,wtfe_line_created_cp,wtfe_line_created">OSM Inspector</a> for Toronto, there are still a lot of nodes that need to be remapped (or <a href="http://www.openstreetmap.org/">OpenStreetMap</a> users that need to be advised) when the <a href="http://www.osmfoundation.org/wiki/License/We_Are_Changing_The_License">big licence change</a> comes.</p>
<p>(and yes, I blogged this just so I&#8217;d remember the link for OSM Inspector.)</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/02/08/fixing-garmin-file-dates/' rel='bookmark' title='fixing garmin file dates'>fixing garmin file dates</a> <small>While the Garmin GPSMap 60csx is a lovely unit, it...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=667&amp;md5=85efc9731739fb415115c6c30f1c792b" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/12/19/quite-a-bit-of-work-to-do-in-toronto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=667&amp;md5=85efc9731739fb415115c6c30f1c792b" type="text/html" />"
	</item>
		<item>
		<title>Not really getting the Azimuthal Equidistant projection right</title>
		<link>http://glaikit.org/2011/12/11/not-really-getting-the-azimuthal-equidistant-projection-right/</link>
		<comments>http://glaikit.org/2011/12/11/not-really-getting-the-azimuthal-equidistant-projection-right/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 00:16:39 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[ogr]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[postel]]></category>
		<category><![CDATA[postscript]]></category>
		<category><![CDATA[proj]]></category>
		<category><![CDATA[projection]]></category>
		<category><![CDATA[qso]]></category>
		<category><![CDATA[radio]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=650</guid>
		<description><![CDATA[All I really wanted to do is make a map like this: This is an Azimuthal Equidistant projection, with me at the centre (of course) and the rest of the world spread out in a fan by distance and bearing. &#8230; <a href="http://glaikit.org/2011/12/11/not-really-getting-the-azimuthal-equidistant-projection-right/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/12/11/not-really-getting-the-azimuthal-equidistant-projection-right/"></g:plusone></div><p>All I really wanted to do is make a map like this:</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/12/va3pid_world.pdf"><img class="aligncenter size-full wp-image-653" title="va3pid_world" src="http://glaikit.org/wp-content/uploads/2011/12/va3pid_world.png" alt="" width="408" height="411" /></a>This is an <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Azimuthal_equidistant_projection">Azimuthal Equidistant</a> projection, with me at the centre (of course) and the rest of the world spread out in a fan by distance and bearing. It&#8217;s somewhat surprising to find that South Africa is almost directly east of Toronto, and New Zealand to the southwest.</p>
<p>If I had a directional antenna and a rotor, this map would show me where I would have to point the antenna to contact that part of the world. I can&#8217;t rotate my dipole (unless I commit some unauthorized local plate tectonics) so I&#8217;m stuck with where my antenna transmits and receives best.</p>
<p>The above map was made with <a href="http://www.wm7d.net/az_proj/az_html/azproj.shtml">AZ_PROJ</a>, a PostScript program of some complexity for plotting world maps for radio use. The instructions for installing and running AZ_PROJ are complex and slightly dated. I got the above output running it through <a href="http://www.ghostscript.com/">Ghostscript</a> like this:</p>
<pre>gs -sDEVICE=pdfwrite -sOutputFile=va3pid_world.pdf az_ini.ps -- az_proj.ps world.wdb</pre>
<p>The format of the az_ini.ps file is complex, and I&#8217;m glad I&#8217;m an old PS hacker to be able to make head or tail of it.</p>
<p>For all its user-hostility, AZ_PROJ is powerful. Here&#8217;s a version of the map I wanted all along:</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/12/va3pid_worldqso.pdf"><img class="aligncenter size-full wp-image-655" title="va3pid_worldqso" src="http://glaikit.org/wp-content/uploads/2011/12/va3pid_worldqso.png" alt="" width="408" height="412" /></a>This shows my furthest QSO in each of the 16 compass directions. (You might note that North is empty: my furthest contact in that direction is some 13km away, whether by lack of folks in that sector or dodginess of my antenna.) Contrast that with my Mercator <a href="http://glaikit.org/ham-radio-qso-map/">QSO map</a>, and you&#8217;ll see that Azimuthal Equidistant is a much better projection for this application.</p>
<p>To show how radically different the world looks to different people, here&#8217;s the world according to my mate Rob in <a href="http://www.openstreetmap.org/?lat=-37.776&amp;lon=175.267&amp;zoom=11&amp;layers=M">Hamilton, NZ</a>:</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/12/rob_hamilton_nz.pdf"><img class="aligncenter size-full wp-image-661" title="rob_hamilton_nz" src="http://glaikit.org/wp-content/uploads/2011/12/rob_hamilton_nz.png" alt="" width="408" height="411" /></a>I&#8217;d been trying to use OGR to transform arbitrary shapefiles into this projection. For maps entirely contained within the same hemisphere (so having extent less than ±90° in any cardinal direction), this works:</p>
<pre>ogr2ogr -t_srs "+proj=aeqd  +lat_0=43.7308 +lon_0=-79.2647" out.shp in.shp</pre>
<p>The lat_0 and lon_0 parameters are just where you want the centre of the map to be. Things get a bit odd if you try to plot the whole world:</p>
<p><img class="aligncenter size-full wp-image-657" title="aeqd2" src="http://glaikit.org/wp-content/uploads/2011/12/aeqd2.png" alt="" width="598" height="605" />The antipodes get plotted underneath, and everything looks messed up. I may have to take my question to <a href="http://gis.stackexchange.com/">GIS &#8211; Stack Exchange</a> to see if I can find an answer. Still, for all its wrongness, you can make something pretty, like my <a href="http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/">whole world Maidenhead locator grid</a> projected this way turns into a rose:</p>
<p><img class="aligncenter size-full wp-image-658" title="grid-aeqd2" src="http://glaikit.org/wp-content/uploads/2011/12/grid-aeqd2.png" alt="" width="610" height="608" /></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=650&amp;md5=ee2f6c8f73b731b48d813de908b39f34" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/12/11/not-really-getting-the-azimuthal-equidistant-projection-right/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=650&amp;md5=ee2f6c8f73b731b48d813de908b39f34" type="text/html" />"
	</item>
		<item>
		<title>binning by angle</title>
		<link>http://glaikit.org/2011/11/25/binning-by-angle/</link>
		<comments>http://glaikit.org/2011/11/25/binning-by-angle/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 01:40:17 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[angle]]></category>
		<category><![CDATA[bin]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=648</guid>
		<description><![CDATA[I was trying to sort a series of polar coordinates by compass direction: everything in the N sector, then NNE, NE, ENE, E, &#8230; This is trickier than it looks, since the North sector includes angles between 348.75° and 11.25°. &#8230; <a href="http://glaikit.org/2011/11/25/binning-by-angle/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/11/25/binning-by-angle/"></g:plusone></div><p>I was trying to sort a series of polar coordinates by compass direction: everything in the N sector, then NNE, NE, ENE, E, &#8230; This is trickier than it looks, since the North sector includes angles between 348.75° and 11.25°.</p>
<p>It&#8217;s easier to think of the problem instead of being one of <em>N</em> bins <span style="text-decoration: underline;">centred on</span> 0°, but rather one of <em>2N</em> bins <span style="text-decoration: underline;">starting at</span> 0°. Then, all one needs to do is shift everything round by one of these half bins (so +1, modulo <em>2N</em>), then divide the number of bins back to the number we want. Done!</p>
<p>Here&#8217;s some code to do it. It may look like C-like pseudocode, but it&#8217;s real live AWK:</p>
<pre>function bin(angle,nbins){
  return int(((int(angle/(360.0/(nbins*2)))+1)%(nbins*2))/2);
}</pre>
<p>You probably want the angles to be between 0..360°. But you knew that.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=648&amp;md5=27b0b7b6e311d7baea57a35a90dabc9e" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/11/25/binning-by-angle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=648&amp;md5=27b0b7b6e311d7baea57a35a90dabc9e" type="text/html" />"
	</item>
		<item>
		<title>Drawing Eggs</title>
		<link>http://glaikit.org/2011/09/27/drawing-eggs/</link>
		<comments>http://glaikit.org/2011/09/27/drawing-eggs/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 02:43:32 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[separation]]></category>
		<category><![CDATA[shapefile]]></category>
		<category><![CDATA[shapelib]]></category>
		<category><![CDATA[wind]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=630</guid>
		<description><![CDATA[When designing wind farms, you need to keep the turbines a certain distance apart from one another. If you don&#8217;t, the wakes from the turbines reduce efficiency, and the turbulence can reduce the warranted life of the machine. Typically, a &#8230; <a href="http://glaikit.org/2011/09/27/drawing-eggs/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/09/27/drawing-eggs/"></g:plusone></div><p>When designing wind farms, you need to keep the turbines a certain distance apart from one another. If you don&#8217;t, the wakes from the turbines reduce efficiency, and the turbulence can reduce the warranted life of the machine. Typically, a manufacturer might specify a minimum downwind separation of 5 diameters, and a crosswind separation of 3 diameters. It&#8217;s an easy check with a buffer overlap, but these buffers are elliptical, which not all GIS packages can draw.</p>
<p>Take, for example, the following three points designated as (<em>completely made-up</em>)  wind turbine locations:</p>
<pre>name    XCOORD           YCOORD
1    557186.675000    4757125.590000
2    557447.931000    4756968.690000
3    557664.999000    4756817.810000</pre>
<p>These look quite far apart, even if you were using large, 100+m diameter wind turbines:</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/09/fakewtgs1.png"><img class="aligncenter size-medium wp-image-632" title="fakewtgs1" src="http://glaikit.org/wp-content/uploads/2011/09/fakewtgs1-512x313.png" alt="" width="512" height="313" /></a>But if we have a wind direction of 210°, downwind/crosswind separation of 5D &amp; 3D respectively, and a 101m diameter rotor, it&#8217;s not so good:</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/09/fakewtgs2.png"><img class="aligncenter size-medium wp-image-631" title="fakewtgs2" src="http://glaikit.org/wp-content/uploads/2011/09/fakewtgs2-512x313.png" alt="" width="512" height="313" /></a>Turbines 2 &amp; 3 are too close together; the ellipses shouldn&#8217;t touch.</p>
<p>As awk is the only scripting language I have on my work computer, I wrote the script that generates the buffer shapefile in awk. The script calls Frank&#8217;s <a href="http://shapelib.maptools.org/">Shapefile C Library</a> utilities to actually make the shapefile. Here&#8217;s the code:</p>
<pre class="brush: plain; title: ; notranslate">
#!/bin/awk -f
# draw an ellipse based on turbine location to generate
#  for WTG separation buffer
# scruss - 2011-09-27

# assumes that stdin has three columns:
#  1 - label
#  2 - x coordinate
#  3 - y coordinate

# variables:
#  diameter = rotor diameter
#  cross = crosswind separation, diameters
#  down = downwind separation, diameters
#  wind = prevailing wind direction
#  base = base for shape file name

BEGIN {
	OFMT=&quot;%.1f&quot;;
	CONVFMT=&quot;%.1f&quot;;
	OFS=&quot; &quot;;

	if (diameter &lt; 0) {
		print &quot;diameter must be set&quot;;
		exit;
	}

	if (cross &lt; 0) {
		print &quot;cross must be set&quot;;
		exit;
	}

	if (down &lt; 0) {
		print &quot;down must be set&quot;;
		exit;
	}

	if (down &lt; cross) {
		print &quot;down must be greater than cross&quot;;
		exit;
	}

	if (wind &lt; 0) {
		print &quot;wind must be set&quot;;
		exit;
	}

	if (base ~ /^$/) {
		print &quot;base must be a string&quot;;
		exit;
	}

	pi = 3.141592654; # I know, I know ...
	# calc cartesian angle from wind bearing, in radians
	beta = ((450 - wind)%360) * pi/180;

	# output shapelib tools init commands
	print &quot;dbfcreate &quot; base &quot; -s name 40&quot;;
	print &quot;shpcreate &quot; base &quot; polygon&quot;;
}

# for every line
{
	name=$1;
	x=$2;
	y=$3;

	major = diameter * down/2;
	minor = diameter * cross/2;
	first=&quot;&quot;;
	points=&quot;&quot;;
	maxn=36;
	for (i=0; i&lt;maxn; i++) {
	    alpha = (i * (360/maxn)) * pi/180;
	    x1 = x + major * cos(alpha) * cos(beta) - minor * sin(alpha) * sin(beta);
	    y1 = y +  major * cos(alpha) * sin(beta) + minor * sin(alpha) * cos(beta);
	    if (i == 0) { # store the first point
		first= x1 &quot; &quot; y1;
	    }
	    points = points  &quot; &quot; x1 &quot; &quot; y1;
	}
	points = points  &quot; &quot; first;
	print &quot;dbfadd &quot; base &quot;.dbf &quot; name;
	print &quot;shpadd &quot; base, points;
}
</pre>
<p>awk is charmingly odd in that you can specify variable on the command line. Here&#8217;s how I called it, with the above coordinates as input:</p>
<pre>awk -v diameter=101 -v cross=3 -v down=5 -v wind=210 -v base="fakewtg-ellipse" -f separation.awk</pre>
<p>Pipe the output through a shell, and there are your ellipses.</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=630&amp;md5=c83103c35beaf202a8336bb5e6d59845" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/09/27/drawing-eggs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=630&amp;md5=c83103c35beaf202a8336bb5e6d59845" type="text/html" />"
	</item>
		<item>
		<title>Ham Radio log to interactive OpenStreetMap</title>
		<link>http://glaikit.org/2011/06/19/ham-radio-log-to-interactive-openstreetmap/</link>
		<comments>http://glaikit.org/2011/06/19/ham-radio-log-to-interactive-openstreetmap/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 21:27:47 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[adif]]></category>
		<category><![CDATA[amateur]]></category>
		<category><![CDATA[ham]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[openstreetmap]]></category>
		<category><![CDATA[osm]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[qso]]></category>
		<category><![CDATA[radio]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=610</guid>
		<description><![CDATA[You might notice that there&#8217;s now a Ham Radio QSO Map lurking on the front page. Thanks to the WordPress OpenStreetMap plugin (which I&#8217;ve slightly abused before). Here&#8217;s a small piece of Perl which will take your ADIF log and &#8230; <a href="http://glaikit.org/2011/06/19/ham-radio-log-to-interactive-openstreetmap/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
<li><a href='http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/' rel='bookmark' title='More radio amateur grid squares'>More radio amateur grid squares</a> <small>After yesterday&#8217;s post, I went a bit nuts with working...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/06/19/ham-radio-log-to-interactive-openstreetmap/"></g:plusone></div><p>You might notice that there&#8217;s now a <a href="http://glaikit.org/ham-radio-qso-map/">Ham Radio QSO Map</a> lurking on the front page. Thanks to the <a href="http://www.faktor.cc/Fotomobil/wp-osm-plugin">WordPress OpenStreetMap plugin</a> (which I&#8217;ve slightly <a href="http://glaikit.org/2010/07/04/my-neighbourhood-canada-day-2010/">abused</a> <a href="http://glaikit.org/2010/09/15/making-of-the-canada-day-post/">before</a>). Here&#8217;s a small piece of Perl which will take your <a href="http://www.adif.org/">ADIF</a> log and convert it to a WP-OSM marker file.</p>
<p><span style="color: #ff0000;">Note that this program assumes you&#8217;ve downloaded your log from QRZ.com, as it requires the locator field for both inbound and outbound stations.</span></p>
<pre class="brush: perl; title: ; notranslate">
#!/usr/bin/perl -w
# adif2osm - convert ADIF log to OSM map file
# scruss.com / VA3PID - 2011/06/19

use strict;
use constant MARKERDIR =&gt;
  'http://glaikit.org/wp-content/plugins/osm/icons/';
use constant QRZURL =&gt; 'http://qrz.com/db/';
sub maidenhead2latlong;

my ( $temp, @results ) = '';

### Fast forward past header
while (&lt;&gt;) {
  last if m/&lt;eoh&gt;\s+$/i;
}

### While there are records remaining...
while (&lt;&gt;) {
  $temp .= $_;

  ### Process if end of record tag reached
  if (m/&lt;eor&gt;\s+$/i) {
    my %hash;
    $temp =~ s/\n//g;
    $temp =~ s/&lt;eoh&gt;.*//i;
    $temp =~ s/&lt;eor&gt;.*//i;
    my @arr = split( '&lt;', $temp );
    foreach (@arr) {
      next if (/^$/);
      my ( $key, $val ) = split( '&gt;', $_ );
      $key =~ s/:.*$//;
      $hash{ lc($key) } = $val unless ( $key eq '' );
    }
    push @results, \%hash;
    $temp = '';
  }
}

# generate OSM plugin file
my @data = ();
my ( $mygrid, $station_callsign ) = '';

# output header
print
  join( &quot;\t&quot;, qw/lat lon title description icon iconSize iconOffset/ ),
  &quot;\n&quot;;
foreach (@results) {
  next unless ( exists( $_-&gt;{gridsquare} ) &amp;&amp; exists( $_-&gt;{call} ) );
  $mygrid = $_-&gt;{my_gridsquare}
    if ( exists( $_-&gt;{my_gridsquare} ) );
  $station_callsign = $_-&gt;{station_callsign}
    if ( exists( $_-&gt;{station_callsign} ) );

  push @data, $_-&gt;{freq} . ' MHz' if ( exists( $_-&gt;{freq} ) );
  $data[$#data] .= ' (' . $_-&gt;{band} . ')' if ( exists( $_-&gt;{band} ) );
  push @data, $_-&gt;{mode} if ( exists( $_-&gt;{mode} ) );
  push @data, $_-&gt;{qso_date} . ' ' . $_-&gt;{time_on} . 'Z'
    if ( exists( $_-&gt;{qso_date} ) &amp;&amp; exists( $_-&gt;{time_on} ) );
  my ( $lat, $long ) = maidenhead2latlong( $_-&gt;{gridsquare} );
  print join( &quot;\t&quot;,
    $lat,
    $long,
    '&lt;a href=&quot;' . QRZURL . $_-&gt;{call} . '&quot;&gt;' . $_-&gt;{call} . '&lt;/a&gt;',
    join( ' - ', @data ),
    MARKERDIR . 'wpttemp-green.png',
    '0,-24' ),
    &quot;\n&quot;;

  @data = ();
}

# show home station last, so it's on top
my ( $lat, $long ) = maidenhead2latlong($mygrid);
print join( &quot;\t&quot;,
  $lat,
  $long,
  '&lt;a href=&quot;'
    . QRZURL
    . $station_callsign . '&quot;&gt;'
    . $station_callsign . '&lt;/a&gt;',
  'Home Station',
  MARKERDIR . 'wpttemp-red.png',
  '0,-24' ),
  &quot;\n&quot;;

exit;

sub maidenhead2latlong {

  # convert a Maidenhead Grid location (eg FN03ir)
  #  to decimal degrees
  # this code could be cleaner/shorter/clearer
  my @locator =
    split( //, uc(shift) );    # convert arg to upper case array
  my $lat      = 0;
  my $long     = 0;
  my $latdiv   = 0;
  my $longdiv  = 0;
  my @divisors = ( 72000, 36000, 7200, 3600, 300, 150 )
    ;                          # long,lat field size in seconds
  my $max = ( $#locator &gt; $#divisors ) ? $#divisors : $#locator;

  for ( my $i = 0 ; $i &lt;= $max ; $i++ ) {
    if ( int( $i / 2 ) % 2 ) {    # numeric
      if ( $i % 2 ) {             # lat
        $latdiv = $divisors[$i];    # save for later
        $lat += $locator[$i] * $latdiv;
      }
      else {                        # long
        $longdiv = $divisors[$i];
        $long += $locator[$i] * $longdiv;
      }
    }
    else {                          # alpha
      my $val = ord( $locator[$i] ) - ord('A');
      if ( $i % 2 ) {               # lat
        $latdiv = $divisors[$i];    # save for later
        $lat += $val * $latdiv;
      }
      else {                        # long
        $longdiv = $divisors[$i];
        $long += $val * $longdiv;
      }
    }
  }
  $lat  += ( $latdiv / 2 );         # location of centre of square
  $long += ( $longdiv / 2 );
  return ( ( $lat / 3600 ) - 90, ( $long / 3600 ) - 180 );
}
</pre>
<p>You&#8217;ll need to update MARKERDIR to reflect your own WP-OSM installation. Mine might move, so if you don&#8217;t change it, and you don&#8217;t get markers, please don&#8217;t blame me.</p>
<p>The basic code to include a map is like this:</p>
<pre><style type="text/css">.entry .olMapViewport img {max-width: none; max-height: none;}.entry-content img, .widget img {max-width: none; max-height: none;}.olControlAttribution {bottom: 0 !important;}div.olControlMousePosition {bottom: 1em !important;}#map_1 {clear: both; padding: 0px; margin: 0px; border: 0px; width: 100%; height: 100%; margin-top:0px; margin-right:0px;margin-left:0px; margin-bottom:0px; left: 0px;}#map_1 img{clear: both; padding: 0px; margin: 0px; border: 0px; width: 100%; height: 100%; position: absolute; margin-top:0px; margin-right:0px;margin-left:0px; margin-bottom:0px;}</style><div id="map_1" style="width:600px; height:450px; overflow:hidden;padding:0px;border:thin solid black;"><script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script><script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script><script type="text/javascript">/* <![CDATA[ */(function($) { OpenLayers.ImgPath = "http://glaikit.org/wp-content/plugins/osm/themes/ol/"; map = new OpenLayers.Map ("map_1", {            controls:[              new OpenLayers.Control.Navigation(),              new OpenLayers.Control.PanZoom(),              new OpenLayers.Control.Attribution()              ],          maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),          maxResolution: 156543.0399,          numZoomLevels: 19,          units: "m",          projection: new OpenLayers.Projection("EPSG:900913"),           displayProjection: new OpenLayers.Projection("EPSG:4326")      } );var lmap = new OpenLayers.Layer.OSM.Mapnik("Mapnik");var layerOSM_Attr = new OpenLayers.Layer.Vector("OSM-plugin",{attribution:"<a href=\"http://www.Fotomobil.at/wp-osm-plugin\">OSM plugin</a>"});map.addLayers([lmap, layerOSM_Attr]);map.addControl(new OpenLayers.Control.ScaleLine());    function osm_getTileURL(bounds) {        var res = this.map.getResolution();        var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));        var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));        var z = this.map.getZoom();        var limit = Math.pow(2, z);        if (y < 0 || y >= limit) {            return OpenLayers.Util.getImagesLocation() + "404.png";        } else {            x = ((x % limit) + limit) % limit;            return this.url + z + "/" + x + "/" + y + "." + this.type;        }    }var lonLat = new OpenLayers.LonLat(-4,33.348).transform(map.displayProjection,  map.projection);map.setCenter (lonLat,1);var pois = new OpenLayers.Layer.Text( "va3pid-qso",        { location:"http://glaikit.org/wp-content/uploads/2011/06/va3pid-qso.txt",          projection: map.displayProjection        });map.addLayer(pois);})(jQuery)/* ]]&gt; */ </script></div></pre>
<p>You&#8217;ll need to change the <em>marker_file</em> URL, too.</p>
<p>Note that, while this script generates links into the <a href="http://qrz.com/">QRZ</a> callsign database, it doesn&#8217;t hit that site unless you click a link.</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
<li><a href='http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/' rel='bookmark' title='More radio amateur grid squares'>More radio amateur grid squares</a> <small>After yesterday&#8217;s post, I went a bit nuts with working...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=610&amp;md5=8e63b2b16a5dae6053b2195f41e88eb3" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/06/19/ham-radio-log-to-interactive-openstreetmap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=610&amp;md5=8e63b2b16a5dae6053b2195f41e88eb3" type="text/html" />"
	</item>
		<item>
		<title>Bixi comes to Toronto!</title>
		<link>http://glaikit.org/2011/04/27/bixi-comes-to-toronto/</link>
		<comments>http://glaikit.org/2011/04/27/bixi-comes-to-toronto/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 23:18:51 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[bike]]></category>
		<category><![CDATA[bixi]]></category>
		<category><![CDATA[kml]]></category>
		<category><![CDATA[shapefile]]></category>
		<category><![CDATA[toronto]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=587</guid>
		<description><![CDATA[BIXI Toronto is (nearly) here! Here are the proposed station locations: Bixi_Toronto_shp.zip (Shapefile) or Bixi_Toronto-kml_csv.zip (KML and CSV). Related posts: More radio amateur grid squares After yesterday&#8217;s post, I went a bit nuts with working... Related posts brought to you by &#8230; <a href="http://glaikit.org/2011/04/27/bixi-comes-to-toronto/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/' rel='bookmark' title='More radio amateur grid squares'>More radio amateur grid squares</a> <small>After yesterday&#8217;s post, I went a bit nuts with working...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/04/27/bixi-comes-to-toronto/"></g:plusone></div><p><a href="https://toronto.bixi.com/">BIXI Toronto</a> is <small><small><small>(nearly)</small></small></small> here!</p>
<p><a href="http://glaikit.org/wp-content/uploads/2011/04/bixi_toronto.jpg"><img class="aligncenter size-medium wp-image-589" title="bixi toronto locations" src="http://glaikit.org/wp-content/uploads/2011/04/bixi_toronto-512x381.jpg" alt="" width="512" height="381" /></a>Here are the proposed station locations: <a href="http://glaikit.org/wp-content/uploads/2011/04/Bixi_Toronto_shp.zip">Bixi_Toronto_shp.zip</a> (Shapefile) or <a href="http://glaikit.org/wp-content/uploads/2011/04/Bixi_Toronto-kml_csv.zip">Bixi_Toronto-kml_csv.zip</a> (KML and CSV).</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/' rel='bookmark' title='More radio amateur grid squares'>More radio amateur grid squares</a> <small>After yesterday&#8217;s post, I went a bit nuts with working...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=587&amp;md5=784a19a25a487f06c7174972ff85c5fd" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/04/27/bixi-comes-to-toronto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=587&amp;md5=784a19a25a487f06c7174972ff85c5fd" type="text/html" />"
	</item>
		<item>
		<title>More radio amateur grid squares</title>
		<link>http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/</link>
		<comments>http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 18:41:04 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[amateur]]></category>
		<category><![CDATA[kml]]></category>
		<category><![CDATA[maidenhead]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[radio]]></category>
		<category><![CDATA[shapefile]]></category>
		<category><![CDATA[toronto]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=579</guid>
		<description><![CDATA[After yesterday&#8217;s post, I went a bit nuts with working out the whole amateur radio grid locator thing (not that I&#8217;m currently likely to use it, though). I&#8217;d hoped to provide a shapefile of the entire world, but that would &#8230; <a href="http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/"></g:plusone></div><div id="attachment_580" class="wp-caption aligncenter" style="width: 522px"><a href="http://glaikit.org/wp-content/uploads/2011/04/Toronto-FN03-grid.png"><img class="size-medium wp-image-580" title="Toronto, as understood by the Maidenhead Locator system" src="http://glaikit.org/wp-content/uploads/2011/04/Toronto-FN03-grid-512x313.png" alt="" width="512" height="313" /></a><p class="wp-caption-text">Toronto, as understood by the Maidenhead Locator system</p></div>
<p>After yesterday&#8217;s post, I went a bit nuts with working out the whole amateur radio grid locator thing (<em><a href="http://scruss.com/blog/2011/04/01/the-silence-of-the-hams/">not that I&#8217;m currently likely to use it</a>, though</em>). I&#8217;d hoped to provide a shapefile of the entire world, but that would be too big for the format&#8217;s 2GB file size limit.</p>
<p>What I can give you, though, is:</p>
<ul>
<li>A Perl program that will generate a shapefile of an entire Maidenhead grid field, down to the subsquare level: <a title=" make_grid - make shapefile of 2 character Maidenhead locators" href="http://glaikit.org/wp-content/uploads/2011/04/make_grid.pl">make_grid.pl</a>. You&#8217;ll need <a href="http://search.cpan.org/dist/Geo-Shapelib/Shapelib.pm">Geo::Shapelib</a> to make this work. 324 (= 18<sup>2</sup>) of these files would cover the whole world, and at 8MB or so a pop, things get unwieldy quickly.</li>
<li>A Google Earth KML file covering the whole world in 20° by 10° grid fields: <a href="http://glaikit.org/wp-content/uploads/2011/04/Maidenhead_Locator_World_Grid.kml">Maidenhead_Locator_World_Grid</a>. (If you&#8217;re feeling nerdy, here it is in Shapefile format: <a href="http://glaikit.org/wp-content/uploads/2011/04/Maidenhead_Locator_World_Grid-shp.zip">Maidenhead_Locator_World_Grid-shp</a>).</li>
</ul>
<p>If anyone would like their grid square in Google Earth format, <a href="http://glaikit.org/contact-me/">let me know</a>.</p>
<p>Related posts:<ol>
<li><a href='http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/' rel='bookmark' title='Maidenhead Grid Locator, in Perl'>Maidenhead Grid Locator, in Perl</a> <small>Amateur radio operators sometimes use the Maidenhead Grid Locator Square...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=579&amp;md5=02992c534ab7bbd58b9421569c2be8fd" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/04/03/more-radio-amateur-grid-squares/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=579&amp;md5=02992c534ab7bbd58b9421569c2be8fd" type="text/html" />"
	</item>
		<item>
		<title>Maidenhead Grid Locator, in Perl</title>
		<link>http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/</link>
		<comments>http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 22:33:09 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[ham]]></category>
		<category><![CDATA[maidenhead]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=574</guid>
		<description><![CDATA[Amateur radio operators sometimes use the Maidenhead Grid Locator Square system to identify location. Here&#8217;s my attempt at a translator, written in slightly squirrelly Perl: Grid square to lat/long and grid square shapefiles to follow. No related posts. Related posts &#8230; <a href="http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="standard" count="false" url="http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/"></g:plusone></div><p>Amateur radio operators sometimes use the <a href="http://www.arrl.org/grid-squares">Maidenhead Grid Locator Square</a> system to identify location. Here&#8217;s my attempt at a translator, written in slightly squirrelly Perl:</p>
<pre class="brush: perl; title: ; notranslate">
#!/usr/bin/perl -w
# maidenhead - 6 character locator
# created by scruss/VA3PID on 02011/04/01
# RCS/CVS: $Id: maidenhead,v 1.3 2011/04/03 11:04:38 scruss Exp $

use strict;
sub latlong2maidenhead;
sub maidenhead2latlong;

if ( $#ARGV &gt;= 1 ) {    # two or more args
                        # convert lat/long to grid
  print latlong2maidenhead( $ARGV[0], $ARGV[1] ), &quot;\n&quot;;
}
elsif ( $#ARGV == 0 ) {    # one arg
                           # convert grid to lat/long
  print join( &quot;, &quot;, maidenhead2latlong( $ARGV[0] ) ), &quot;\n&quot;;
}
else {                     # no args

  # print usage
  print 'Usage: ', $0, ' dd.dddddd ddd.dddddd', &quot;\n&quot;,
    ' or', &quot;\n&quot;,
    $0, ' grid_location', &quot;\n&quot;;
}
exit;

sub maidenhead2latlong {

  # convert a Maidenhead Grid location (eg FN03ir)
  #  to decimal degrees
  # this code could be cleaner/shorter/clearer
  my @locator =
    split( //, uc(shift) );    # convert arg to upper case array
  my $lat      = 0;
  my $long     = 0;
  my $latdiv   = 0;
  my $longdiv  = 0;
  my @divisors = ( 72000, 36000, 7200, 3600, 300, 150 )
    ;                          # long,lat field size in seconds
  my $max = ( $#locator &gt; $#divisors ) ? $#divisors : $#locator;

  for ( my $i = 0 ; $i &lt;= $max ; $i++ ) {
    if ( int( $i / 2 ) % 2 ) {    # numeric
      if ( $i % 2 ) {             # lat
        $latdiv = $divisors[$i];    # save for later
        $lat += $locator[$i] * $latdiv;
      }
      else {                        # long
        $longdiv = $divisors[$i];
        $long += $locator[$i] * $longdiv;
      }
    }
    else {                          # alpha
      my $val = ord( $locator[$i] ) - ord('A');
      if ( $i % 2 ) {               # lat
        $latdiv = $divisors[$i];    # save for later
        $lat += $val * $latdiv;
      }
      else {                        # long
        $longdiv = $divisors[$i];
        $long += $val * $longdiv;
      }
    }
  }
  $lat  += ( $latdiv / 2 );         # location of centre of square
  $long += ( $longdiv / 2 );
  return ( ( $lat / 3600 ) - 90, ( $long / 3600 ) - 180 );
}

sub latlong2maidenhead {

  # convert a WGS84 coordinate in decimal degrees
  #  to a Maidenhead grid location
  my ( $lat, $long ) = @_;
  my @divisors =
    ( 72000, 36000, 7200, 3600, 300, 150 );    # field size in seconds
  my @locator = ();

  # add false easting and northing, convert to seconds
  $lat  = ( $lat + 90 ) * 3600;
  $long = ( $long + 180 ) * 3600;
  for ( my $i = 0 ; $i &lt; 3 ; $i++ ) {
    foreach ( $long, $lat ) {
      my $div  = shift(@divisors);
      my $part = int( $_ / $div );
      if ( $i == 1 ) {    # do the numeric thing for 2nd pair
        push @locator, $part;
      }
      else {              # character thing for 1st and 3rd pair
        push @locator,
          chr( ( ( $i &lt; 1 ) ? ord('A') : ord('a') ) + $part );
      }
      $_ -= ( $part * $div );    # leaves remainder in $long or $lat
    }
  }
  return join( '', @locator );
}
</pre>
<p><del>Grid square to lat/long and</del> grid square shapefiles to follow.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p> <p><a href="http://glaikit.org/?flattrss_redirect&amp;id=574&amp;md5=619f266f7feb0dc7833064c7ac081c6a" title="Flattr" target="_blank"><img src="http://glaikit.org/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://glaikit.org/2011/04/02/maidenhead-grid-locator-in-perl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="http://glaikit.org/?flattrss_redirect&amp;id=574&amp;md5=619f266f7feb0dc7833064c7ac081c6a" type="text/html" />"
	</item>
	</channel>
</rss>

