<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Kier's Dispatches</title>
	<atom:link href="http://kiergsmith.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kiergsmith.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sat, 12 Apr 2008 18:30:11 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='kiergsmith.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e0286950b4cdc4ed92e94bccdd858545?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Kier's Dispatches</title>
		<link>http://kiergsmith.wordpress.com</link>
	</image>
			<item>
		<title>More Mashup Fun&#8230;</title>
		<link>http://kiergsmith.wordpress.com/2008/04/11/more-mashup-fun/</link>
		<comments>http://kiergsmith.wordpress.com/2008/04/11/more-mashup-fun/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 16:40:01 +0000</pubDate>
		<dc:creator>locksmith</dc:creator>
				<category><![CDATA[Web Build]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Weather Radar]]></category>

		<guid isPermaLink="false">http://kiergsmith.wordpress.com/?p=4</guid>
		<description><![CDATA[I wasn&#8217;t completely happy with the my last Google Maps/Weather Radar mashup.  Two things I discovered; that Google Maps doesn&#8217;t update a KML loaded from the search function, and that the radar locations weren&#8217;t clear enough.
The later, radar visibility, was fairly east to correct.  I added the transmitter points to the KML, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kiergsmith.wordpress.com&blog=3406250&post=4&subd=kiergsmith&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I wasn&#8217;t completely happy with the my last Google Maps/Weather Radar mashup.  Two things I discovered; that Google Maps doesn&#8217;t update a KML loaded from the search function, and that the radar locations weren&#8217;t clear enough.</p>
<p>The later, radar visibility, was fairly east to correct.  I added the transmitter points to the KML, and added a 10% magenta overprint to show the 200km range of the radar.</p>
<p>The first, I discovered that the Google Maps API is not completely in line with the KML reference, as that it doesn&#8217;t update images or dynamic content except with very specific controls.  Google Earth KML&#8217;s have a &lt;refreshMode&gt; tag that allows users to declare expiration of data base on user behavior, a time delay, or expiration date and time.  As far as I can tell, only the latter, <em>onExpire</em>, is supported by Google Maps.  The options for using onExpire are based on either HTTP header settings, or setting an expiry time in the kml.  The HTTP header settings are beyond my control with the hosting I use, and this left me with calculating a date/time stamp to be embedded in the KML.</p>
<p><span id="more-4"></span></p>
<p>At the suggestion of Coverfire, I calculated a proper date/time stamp during the web image grab, and just stuffed it into the KML, which in now assembled each time the script runs.  The kit and kaboodle is uploaded to the server, which should allow users to get recent images when following the link.</p>
<p><a title="EC Weather Radar in Google Maps" href="http://maps.google.ca/maps?f=q&amp;hl=en&amp;geocode=&amp;q=http:%2F%2Fwww.methlab.ca%2Fweatherradar02.kml&amp;ie=UTF8&amp;ll=46.604167,-84.572754&amp;spn=10.478254,29.355469&amp;t=k&amp;z=6" target="_blank">Environment Canada Weather Radar on Google Maps</a></p>
<p>Or if you prefer Google Earth:</p>
<p><a title="Weather Radar Google Earth" href="http://www.methlab.ca/weatherradar02.kmz" target="_blank">Environment Canada Weather Radar KMZ</a></p>
<p>A few things that came out of this clean up and finalization: Google Maps support of the KML is still really in beta, and is changing rapidly.  And, Bash shell parameter expansion can drive you mad.</p>
<p>It&#8217;ll be interesting to see how long this mashup still works.  I don&#8217;t see Google removing functionality, but they may streamline the KML import, and possible clean up some fuzzier aspects of refreshing dynamic content.</p>
<p>I spent two hours trying to get my shell scripts to crunch the <em>date</em> command to give me a nice ISO standard date 10 minutes in the future.  Figuring that adding 600 seconds to the epoch time was the easiest, I just had date spit out epoch seconds and add 600.  The most fun was getting all the variables to expand correctly while feeding it back to date.</p>
<p>Handy things to know about <em>date</em>:</p>
<p>To get the seconds since epoch:</p>
<blockquote><p>date +%s</p></blockquote>
<p>To get the date back from epoch time:</p>
<blockquote><p>date &#8211;date=@EPOCHSECONDS</p></blockquote>
<p>This option is incredibly handy for future dating as it makes the date command  take care of what day/hour/minute is is when you add time.  The only problem I found is nobody knows about it.   Neither the wikipedia entry, nor the unixhelp page listed this option.  I found it reading in the <a title="GNU Coreutils" href="http://www.gnu.org/software/coreutils/manual/coreutils.html#System-context" target="_blank">GNU manual</a>.  In fact, I don&#8217;t think I could have sorted out my difficulties with out this reference.  Good one to know!</p>
<p>At this point, I think I&#8217;m happy with the look and operation of the Weather Radar KML.  If you find any problems, or have suggestions, please leave me a note here, and I&#8217;ll look into it.</p>
<p>kgs</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kiergsmith.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kiergsmith.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kiergsmith.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kiergsmith.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kiergsmith.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kiergsmith.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kiergsmith.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kiergsmith.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kiergsmith.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kiergsmith.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kiergsmith.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kiergsmith.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kiergsmith.wordpress.com&blog=3406250&post=4&subd=kiergsmith&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kiergsmith.wordpress.com/2008/04/11/more-mashup-fun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/715db0237bc08b41fcb79eba86a04952?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">locksmith</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Maps/Ontario Weather Radar Mash Up&#8230;</title>
		<link>http://kiergsmith.wordpress.com/2008/04/08/google-mapsontario-weather-radar-mash-up/</link>
		<comments>http://kiergsmith.wordpress.com/2008/04/08/google-mapsontario-weather-radar-mash-up/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 04:43:39 +0000</pubDate>
		<dc:creator>locksmith</dc:creator>
				<category><![CDATA[Web Build]]></category>
		<category><![CDATA[Google Earth]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Weather]]></category>

		<guid isPermaLink="false">http://kiergsmith.wordpress.com/?p=3</guid>
		<description><![CDATA[Note &#8211; Links have been removed because of updates&#8230;
So after much humming and hawing, I&#8217;ve finally sat down to complete my first Google Maps mashup.  I had the idea a while back to drop the Environment Canada weather radar on top of Google maps to give my weather viewing some context.  And a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kiergsmith.wordpress.com&blog=3406250&post=3&subd=kiergsmith&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Note &#8211; Links have been removed because of updates&#8230;</em></p>
<p>So after much humming and hawing, I&#8217;ve finally sat down to complete my first Google Maps mashup.  I had the idea a while back to drop the Environment Canada weather radar on top of Google maps to give my weather viewing some context.  And a while back I cranked up a script to grab the radar image for my local transmitter (near Exeter, ON) and put it into ForecastFox Enhanced.</p>
<p>As it turned out, getting access to the Google Maps API and setting up a base map page was incredibly easy.  A quick look into the Google Maps documentation and they even provided me with sample code to set up my first page.  Then into the specifics of setting up overlays on Google Maps, and I&#8217;d be all set.  Or so I thought.</p>
<p><span id="more-3"></span>I was using the GGroundOverlay object in GM (Google Maps) to drop my first test image on a map, and it worked great.  So I thought I&#8217;d add a few more images to test out the local radar overlaps.  It did not work.  In fact, after much Javascript tweaking and re-ordering, I came to the following conclusion: GGroundOverlay is set up to work with ONE image only.  Creating a second overlay either was completely invisible, or it broke the GM Javascript.</p>
<p>At this point, I decided to take a break from the web side, and look at how to handle the radar images.  Give myself a break, as it were.  So I made sure I had up to date copies of ImageMagick on my machine and my test server, and broke out the graphics editor hat.  For those of you who have not used ImageMagick before, it is an incredibly powerful command line image editor.  I would hazard a guess that 50% of workflow on Photoshop could be done in Imagemagick.  Simply put, it rocks.  In the case I forsaw, I would retrieve the radar images from the Enviroment Canada weather site, trim them down and remove extraneous colours and details.  And thats just about the process that occurred.</p>
<p>The biggest trick with IM (ImageMagick) is to attempt to do the whole job on one command line.  This prevents having to save temp image files, which will cost time lost in disk access and possible in quality of the image.  That said, IM can only handle so many steps before it gets lost.  The second complication, one I brought upon myself, is that radar images are in fact circular, so I only wanted to display the circular data area.</p>
<p>This led to probably my most frustrating time of the whole project.  Simply put, I built an image the same size as the whole radar image from the web, cut out a circle where I wanted it, and filled the circle with the radar image.  This gave me a black image, with a circular image centered over the radar site.  Judicious cropping and colour removal, final application of transparency, and I had a .GIF to use for GM.  As a side note, Enviroment Canada&#8217;s decision to make the radar image a 256 colour .GIF image and basically defining 1 pixel = 1 km made my job very easy.</p>
<p>This is where the only major flaw kept cropping up.  When drawing the circle, IM kept antialiasing the edge to make it look nice, but when I removed colours, the nasty shades of grey defining the edge of the circle stayed around.  I think I spent around three hours digging through the IM website until I finally tripped across the reference to the <em>+antialias</em> command.   With this enabled, no grey edging, and the radar circles came out perfectly.</p>
<p>For those interested, here&#8217;s the IM command line as it ended up.  It generates a 400 pixel square image with a active 400 pixel circle visible in the middle, set at 25% opacity using PNG alpha channel transparency.</p>
<blockquote><p>convert +antialias -size 580&#215;480 xc:black -tile radar.gif -draw &#8216;circle 240,239 240,39&#8242; -fill black -opaque white -opaque \#999966 -opaque \#333366 -crop 401&#215;401+140+139 -transparent black -matte -channel A -evaluate divide 1.25 output.png</p></blockquote>
<p>Not to fetch the images.  Lucky for me, Environment Canada builds the radar pages from a generated stream of  data.  Be researching the actual call signs of the transmitters in Wikipedia, and careful examination of the radar website, I developed a script that would <em>wget</em> the webpages, parse them with regex&#8217;s and then <em>wget</em> the radar images.  A bit of research later, and some brushing up on BASH scripting, I now had a script easily configurable to get two or twenty images from the web.  I then blended the IM script into it, and set it to copy the finished image products to my servers web share.</p>
<p>This led me back to how to display more than one image at a time in GM.  About a month ago, I downloaded Google Earth on my Win partition again, and was rediscovering the fun of that app.  Along with starting to upload photos to Panoramio, I discovered the XML structure used in Google Earth KML files.  They supported multi-overlays with no problems, so I thought I&#8217;d build a Google Earth KML for the radar as a proof-of-type.</p>
<p>While researching the KML structure, I found the Google Maps Blog, and found that since the summer of 2007, GM supports some KML functions.  If the KML (or KMZ; a zipped KML) is web accessible, you can type it into the GM search function, and it will display the KML over Google Maps.  Here was all the tools I needed to finalize my Radar-over-Google Maps mashup.</p>
<p>My first KML in fact was a simple point declaration of all the Weather Radar transmitters in Ontario, verified and checked between Google Maps, Natural Resources of Canada topo maps and Environment Canada&#8217;s own website.</p>
<p><span style="text-decoration:line-through;"><a title="Ontario Weather Radars" href="http://maps.google.ca/" target="_blank">Ontario Weather Radar Sites in Google Maps</a></span></p>
<p>Using these verified locations, I build a spreadsheet that calculated the accurate Latitude/Longitude for a 400 km box around these stations, and used it to define the four sides of the display box for each weather radar image.</p>
<p>Combining this information with my previous KML file, I now had an accurate weather radar overlay displayable in Google Earth or in Google maps.</p>
<p><span style="text-decoration:line-through;">Ontario Weather Radar KMZ</span></p>
<p><span style="text-decoration:line-through;"><a title="Ontario Weather Radar" href="http://maps.google.ca/" target="_blank">Ontario Weather Radar in Google Maps</a></span></p>
<p>Watch this space!  There will be improvement and development forthcoming.</p>
<p>kgs</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/kiergsmith.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/kiergsmith.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kiergsmith.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kiergsmith.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kiergsmith.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kiergsmith.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kiergsmith.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kiergsmith.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kiergsmith.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kiergsmith.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kiergsmith.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kiergsmith.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kiergsmith.wordpress.com&blog=3406250&post=3&subd=kiergsmith&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://kiergsmith.wordpress.com/2008/04/08/google-mapsontario-weather-radar-mash-up/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/715db0237bc08b41fcb79eba86a04952?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">locksmith</media:title>
		</media:content>
	</item>
	</channel>
</rss>