<?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>Sun, 29 Apr 2012 13:44:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>geocoder.ca&#8217;s excellent database</title>
		<link>http://glaikit.org/2012/04/15/geocoder-cas-excellent-database/</link>
		<comments>http://glaikit.org/2012/04/15/geocoder-cas-excellent-database/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 17:37:54 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[canada]]></category>
		<category><![CDATA[odbl]]></category>
		<category><![CDATA[ogr]]></category>
		<category><![CDATA[postal codes]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shapefile]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=703</guid>
		<description><![CDATA[geocoder.ca provides a crowdsourced postal code geocoder under the ODbL. You can download the database as CSV directly. Here&#8217;s a bash script to convert that text file into a (very large) point shapefile: Though the script is a bit Unix-centric, &#8230; <a href="http://glaikit.org/2012/04/15/geocoder-cas-excellent-database/">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/2012/04/15/geocoder-cas-excellent-database/"></g:plusone></div><p><a href="http://geocoder.ca/">geocoder.ca</a> provides a crowdsourced postal code geocoder under the ODbL. You can <a href="http://geocoder.ca/?freedata=1#postal">download</a> the database as CSV directly. Here&#8217;s a bash script to convert that text file into a (very large) point shapefile:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
# geocoder2shp.sh - convert geocoder.ca CSV to a shape file
# NB: input CSV is UTF-8; it is passed through unchanged
# Needs &gt;= v1.7 of GDAL
# scruss - 2012/04/15

if [ ! -f Canada.csv.gz ]
then
    echo &quot;&quot;
    echo &quot; &quot; Download \&quot;Canada.csv.gz\&quot; into the current directory from
    echo &quot;  &quot; http://geocoder.ca/onetimedownload/Canada.csv.gz
    echo &quot; &quot; and try again.
    echo &quot;&quot;
    exit 1
fi

# make input file with header
echo PostalCode,Latitude,Longitude,City,Province &gt; Canada2.csv
gunzip -c Canada.csv.gz &gt;&gt; Canada2.csv

# create GDAL VRT file
cat &gt; Canada2.vrt &lt;&lt;EOF
&lt;OGRVRTDataSource&gt;
  &lt;!-- note that OGRVRTLayer name must be basename of source file --&gt;
  &lt;OGRVRTLayer name=&quot;Canada2&quot;&gt;
    &lt;SrcDataSource&gt;Canada2.csv&lt;/SrcDataSource&gt;
    &lt;GeometryType&gt;wkbPoint&lt;/GeometryType&gt;
    &lt;LayerSRS&gt;EPSG:4326&lt;/LayerSRS&gt;
    &lt;GeometryField encoding=&quot;PointFromColumns&quot; x=&quot;Longitude&quot; y=&quot;Latitude&quot;/&gt;
    &lt;Field name=&quot;PostalCode&quot; type=&quot;String&quot; width=&quot;6&quot; /&gt;
    &lt;Field name=&quot;Latitude&quot; type=&quot;Real&quot; /&gt;
    &lt;Field name=&quot;Longitude&quot; type=&quot;Real&quot; /&gt;
    &lt;Field name=&quot;City&quot; type=&quot;String&quot; width=&quot;60&quot; /&gt;
    &lt;Field name=&quot;Province&quot; type=&quot;String&quot; width=&quot;2&quot; /&gt;
  &lt;/OGRVRTLayer&gt;
&lt;/OGRVRTDataSource&gt;
EOF

# create shapefile
ogr2ogr PostalCodes.shp Canada2.vrt

# clean up
rm -f Canada2.csv	Canada2.vrt
</pre>
<p>Though the script is a bit Unix-centric, it&#8217;s just a simple list of instructions which could be run on any command line. What it does is add some headers to the geocoder.ca file, then sets up an OGR <a href="http://www.gdal.org/ogr/drv_vrt.html">Virtual Format</a> to convert the text into a fairly well-defined shapefile. When you use this shapefile, you should credit geocoder.ca as the ODbL requires.</p>
<p>Eek! <a href="http://geocoder.ca/?sued=1">geocoder.ca has been sued by Canada Post</a>! (News responses: <a href="http://www.michaelgeist.ca/content/view/6415/125/">Michael Geist</a>, <a href="http://boingboing.net/2012/04/13/canada-post-sues-crowdsourced.html">Boing Boing</a>, <a href="http://www.cbc.ca/news/technology/story/2012/04/13/technology-canada-post-postal-code-copyright.html">CBC</a>) I&#8217;ve donated to defend this useful service.</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=703&amp;md5=de1bcba65dabe028b5cc3e4cab82af65" 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/04/15/geocoder-cas-excellent-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2012%2F04%2F15%2Fgeocoder-cas-excellent-database%2F&amp;language=en_GB&amp;category=text&amp;title=geocoder.ca%26%238217%3Bs+excellent+database&amp;description=geocoder.ca+provides+a+crowdsourced+postal+code+geocoder+under+the+ODbL.+You+can+download+the+database+as+CSV+directly.+Here%26%238217%3Bs+a+bash+script+to+convert+that+text+file+into+a+%28very...&amp;tags=bash%2Ccanada%2Codbl%2Cogr%2Cpostal+codes%2Cscript%2Cshapefile%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Georeferencing QGIS output rasters</title>
		<link>http://glaikit.org/2012/04/05/georeferencing-qgis-output-rasters/</link>
		<comments>http://glaikit.org/2012/04/05/georeferencing-qgis-output-rasters/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 04:49:03 +0000</pubDate>
		<dc:creator>scruss</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[georeference]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[qgis]]></category>
		<category><![CDATA[raster]]></category>

		<guid isPermaLink="false">http://glaikit.org/?p=698</guid>
		<description><![CDATA[Some of the design packages I rely on use very crude GIS facilities. In fact, all they can support is a georeferenced raster as a background image, so it&#8217;s more of a rough map than GIS. It helps if these &#8230; <a href="http://glaikit.org/2012/04/05/georeferencing-qgis-output-rasters/">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/2012/04/05/georeferencing-qgis-output-rasters/"></g:plusone></div><p>Some of the design packages I rely on use very crude GIS facilities. In fact, all they can support is a georeferenced raster as a background image, so it&#8217;s more of a rough map than GIS. It helps if these rasters are at a decent resolution, typically 1m/pixel or better.</p>
<p>A while back, I <a href="http://forum.qgis.org/viewtopic.php?f=2&amp;t=6045&amp;p=10338&amp;hilit=scruss&amp;sid=951ab6b0dee051719866ac477c5fa9bf#p10335">asked</a> on the QGIS forum if the package could output high resolution georeferenced rasters. I received a rather terse response that no, it couldn&#8217;t (and I inferred from the tone that the poster thought that it shouldn&#8217;t, and I was wrong to want such a thing). I shelved the idea at the time.</p>
<p>After having to fix a lot of paths in a QGIS project file I&#8217;d moved to a new system, I noticed that all the map composer attributes are rather neatly defined in the XML file structure. Some messing around with Perl, <a href="http://search.cpan.org/~grantm/XML-Simple-2.18/lib/XML/Simple.pm">XML::Simple</a> and <a href="http://search.cpan.org/~ovid/Data-Dumper-Simple-0.11/lib/Data/Dumper/Simple.pm">Data::Dumper::Simple</a>, and I had a little script that would spit out an ESRI World File for the map composer raster defined in the project.</p>
<p>To run this, you have to create a project with just one Print Composer page, save the composed map as an image, save the project, then run the script like this:</p>
<pre>
./geoprint.pl project.qgs &gt; image.pngw
</pre>
<p>There are some caveats:</p>
<ul>
<li>This probably won&#8217;t work for projects with multiple print composers</li>
<li>It doesn&#8217;t quite get the scale right, but it&#8217;s within a pixel or so. I may not have corrected for image borders.</li>
</ul>
<p>Though there&#8217;s some fairly hideous XML-mungeing in the code, what the script does is entirely trivial. If you feel you can use it, good; if you feel you can improve it, be my guest.</p>
<pre class="brush: perl; title: ; notranslate">
#!/usr/bin/perl -w
# geoprint - georef a QGIS output image by creating a world file
# one arg: qgis project file (xml)
# $Id: geoprint.pl,v 1.3 2012/04/06 03:32:01 scruss Exp $

use strict;
use XML::Simple;
use constant MM_PER_INCH =&gt; 25.4;

my $qgis = $ARGV[0];
die &quot;$qgis must exist\n&quot; unless ( -f $qgis );

my $q = XMLin($qgis) or die &quot;$!\n&quot;;
my %composer = %{ $q-&gt;{Composer} };
my $image_width =
  int( $composer{Composition}-&gt;{paperWidth} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH );
my $image_height =
  int( $composer{Composition}-&gt;{paperHeight} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH );

# we need xpixelsize, ypixelsize, ulx and uly
my $xpixelsize =
  ( $composer{ComposerMap}-&gt;{Extent}-&gt;{xmax} -
    $composer{ComposerMap}-&gt;{Extent}-&gt;{xmin} ) /
  int( $composer{ComposerMap}-&gt;{ComposerItem}-&gt;{width} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH );
my $ypixelsize =
  -1.0 *
  ( $composer{ComposerMap}-&gt;{Extent}-&gt;{ymax} -
    $composer{ComposerMap}-&gt;{Extent}-&gt;{ymin} ) /
  int( $composer{ComposerMap}-&gt;{ComposerItem}-&gt;{height} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH );
my $ulx =
  $composer{ComposerMap}-&gt;{Extent}-&gt;{xmin} -
  $xpixelsize *
  int( $composer{ComposerMap}-&gt;{ComposerItem}-&gt;{x} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH ) - $xpixelsize;
my $uly =
  $composer{ComposerMap}-&gt;{Extent}-&gt;{ymax} -
  $ypixelsize *
  int( $composer{ComposerMap}-&gt;{ComposerItem}-&gt;{y} *
    $composer{Composition}-&gt;{printResolution} /
    MM_PER_INCH ) - $ypixelsize;

printf( &quot;%.12f\n%.12f\n%.12f\n%.12f\n%.12f\n%.12f\n&quot;,
  $xpixelsize, 0.0, 0.0, $ypixelsize, $ulx, $uly );

# FIXME? pixel scale seems a tiny bit off - allow for border?
exit;
</pre>
<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=698&amp;md5=d5ba7ad2652374f2c93b47abf232eede" 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/04/05/georeferencing-qgis-output-rasters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2012%2F04%2F05%2Fgeoreferencing-qgis-output-rasters%2F&amp;language=en_GB&amp;category=text&amp;title=Georeferencing+QGIS+output+rasters&amp;description=Some+of+the+design+packages+I+rely+on+use+very+crude+GIS+facilities.+In+fact%2C+all+they+can+support+is+a+georeferenced+raster+as+a+background+image%2C+so+it%26%238217%3Bs+more...&amp;tags=georeference%2Cperl%2Cqgis%2Craster%2Cblog" type="text/html" />
	</item>
		<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>
</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>
</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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2012%2F01%2F31%2Ftoronto-data-really-open%2F&amp;language=en_GB&amp;category=text&amp;title=Toronto+Data+really+open&amp;description=Looks+like+the+data+sets+at+toronto.ca%2Fopen+might+finally+actually+be+open%3B+that+is%2C+usable+in+a+way+that+doesn%26%238217%3Bt+bind+subsequent+users+to+impossible+terms.+The+new+licence+%28which...&amp;tags=data%2Copen%2Cosm%2Ctoronto%2Cblog" 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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F12%2F19%2Fwe-can-has-street-names%2F&amp;language=en_GB&amp;category=text&amp;title=we+can+has+street+names&amp;description=Pierre+B%C3%A9land+reminded+the+Canadian+OSM+group+of+the+GeoBase+WMS%2C+which+has+all+the+NRN+road+names+in+it.+Here%26%238217%3Bs+my+neighbourhood%26%238217%3Bs+OpenStreetMap+data+with+the+road+names+overlaid....&amp;tags=canada%2Cgeobase%2Copenstreetmap%2Croads%2Cwms%2Cblog" 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>
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/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>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=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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F12%2F19%2Fquite-a-bit-of-work-to-do-in-toronto%2F&amp;language=en_GB&amp;category=text&amp;title=quite+a+bit+of+work+to+do+in+Toronto&amp;description=Looking+at+the+OSM+Inspector+for+Toronto%2C+there+are+still+a+lot+of+nodes+that+need+to+be+remapped+%28or+OpenStreetMap+users+that+need+to+be+advised%29+when+the+big...&amp;tags=openstreetmap%2Cblog" 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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F12%2F11%2Fnot-really-getting-the-azimuthal-equidistant-projection-right%2F&amp;language=en_GB&amp;category=text&amp;title=Not+really+getting+the+Azimuthal+Equidistant+projection+right&amp;description=All+I+really+wanted+to+do+is+make+a+map+like+this%3A+This+is+an+Azimuthal+Equidistant+projection%2C+with+me+at+the+centre+%28of+course%29+and+the+rest+of+the...&amp;tags=map%2Cogr%2Cpdf%2Cpostel%2Cpostscript%2Cproj%2Cprojection%2Cqso%2Cradio%2Cblog" 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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F11%2F25%2Fbinning-by-angle%2F&amp;language=en_GB&amp;category=text&amp;title=binning+by+angle&amp;description=I+was+trying+to+sort+a+series+of+polar+coordinates+by+compass+direction%3A+everything+in+the+N+sector%2C+then+NNE%2C+NE%2C+ENE%2C+E%2C+%26%238230%3B+This+is+trickier+than+it+looks%2C...&amp;tags=angle%2Cbin%2Ccode%2Cblog" 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>
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/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>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=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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F09%2F27%2Fdrawing-eggs%2F&amp;language=en_GB&amp;category=text&amp;title=Drawing+Eggs&amp;description=When+designing+wind+farms%2C+you+need+to+keep+the+turbines+a+certain+distance+apart+from+one+another.+If+you+don%26%238217%3Bt%2C+the+wakes+from+the+turbines+reduce+efficiency%2C+and+the+turbulence...&amp;tags=awk%2Cseparation%2Cshapefile%2Cshapelib%2Cwind%2Cblog" 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>
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/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><link rel="stylesheet" type="text/css" href="http://glaikit.org/wp-content/plugins/osm//css/osm_map.css" /><style type="text/css">#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>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=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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F06%2F19%2Fham-radio-log-to-interactive-openstreetmap%2F&amp;language=en_GB&amp;category=text&amp;title=Ham+Radio+log+to+interactive+OpenStreetMap&amp;description=You+might+notice+that+there%26%238217%3Bs+now+a+Ham+Radio+QSO+Map+lurking+on+the+front+page.+Thanks+to+the+WordPress+OpenStreetMap+plugin+%28which+I%26%238217%3Bve+slightly+abused+before%29.+Here%26%238217%3Bs+a+small...&amp;tags=adif%2Camateur%2Cham%2Clog%2Cmap%2Copenstreetmap%2Cosm%2Cperl%2Cqso%2Cradio%2Cblog" 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). No related posts. Related posts brought to you by Yet Another Related Posts Plugin.
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/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>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=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="https://flattr.com/submit/auto?user_id=scruss&amp;popout=1&amp;url=http%3A%2F%2Fglaikit.org%2F2011%2F04%2F27%2Fbixi-comes-to-toronto%2F&amp;language=en_GB&amp;category=text&amp;title=Bixi+comes+to+Toronto%21&amp;description=BIXI+Toronto+is+%28nearly%29+here%21+Here+are+the+proposed+station+locations%3A+Bixi_Toronto_shp.zip+%28Shapefile%29+or%C2%A0Bixi_Toronto-kml_csv.zip+%28KML+and+CSV%29.+No+related+posts.+Related+posts+brought+to+you+by+Yet+Another+Related+Posts...&amp;tags=bike%2Cbixi%2Ckml%2Cshapefile%2Ctoronto%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>

