<?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>Azavea Labs &#187; Aaron Ogle</title>
	<atom:link href="http://www.azavea.com/blogs/labs/author/aogle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.azavea.com/blogs/labs</link>
	<description>Insight on what our engineers are doing</description>
	<lastBuildDate>Mon, 06 Feb 2012 22:32:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Fueling the Software Engineer</title>
		<link>http://www.azavea.com/blogs/labs/2009/08/fueling-the-software-engineer/</link>
		<comments>http://www.azavea.com/blogs/labs/2009/08/fueling-the-software-engineer/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 16:45:51 +0000</pubDate>
		<dc:creator>Aaron Ogle</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[humor]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=245</guid>
		<description><![CDATA[SEPTA trains are fueled by electricity.  Automobiles are fueled by gasoline.  Sailing ships are fueled by the wind.  But at Azavea, software engineers are fueled by something very special. Much thanks to Black Sheep Coffee for this custom blend!]]></description>
			<content:encoded><![CDATA[<p><a title="SEPTA" href="http://septa.org/" target="_blank">SEPTA</a> trains are fueled by electricity.  Automobiles are fueled by gasoline.  Sailing ships are fueled by the wind.  But at Azavea, software engineers are fueled by something very special.</p>
<div id="attachment_246" class="wp-caption alignnone" style="width: 460px"><a href="http://www.azavea.com/blogs/labs/wp-content/uploads/2009/08/se_blend.jpg"><img class="size-medium wp-image-246 " src="http://www.azavea.com/blogs/labs/wp-content/uploads/2009/08/se_blend-450x600.jpg" alt="Software Engineer's Blend" width="450" height="600" /></a><p class="wp-caption-text">Software Engineer&#39;s Blend - Just the right mix of know-how and eccentric geek chic!</p></div>
<p>Much thanks to <a title="Black Sheep Coffee" href="http://www.blacksheepcoffeecafe.com/" target="_blank">Black Sheep Coffee</a> for this custom blend!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2009/08/fueling-the-software-engineer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Write an OpenLayers Plugin</title>
		<link>http://www.azavea.com/blogs/labs/2009/07/how-to-write-an-openlayers-plugin/</link>
		<comments>http://www.azavea.com/blogs/labs/2009/07/how-to-write-an-openlayers-plugin/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 16:12:16 +0000</pubDate>
		<dc:creator>Aaron Ogle</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[openlayers]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=155</guid>
		<description><![CDATA[Several weeks ago I gave an internal presentation to Azavea developers on the fundamentals of writing OpenLayers plugins.  I have modified that presentation to serve as a quick-start guide to writing your own plugins. Understand JavaScript OpenLayers is a JavaScript library.  If you do not have a sound understanding of JavaScript, do not pass Go [...]]]></description>
			<content:encoded><![CDATA[<p>Several weeks ago I gave an internal presentation to Azavea developers on the fundamentals of writing <a title="OpenLayers Home" href="http://openlayers.org/" target="_blank">OpenLayers</a> plugins.  I have modified that presentation to serve as a quick-start guide to writing your own plugins.</p>
<h1>Understand JavaScript</h1>
<p>OpenLayers is a JavaScript library.  If you do not have a sound understanding of JavaScript, do not pass Go and do not collect $200.  Instead, pick up Doug Crockford&#8217;s <a title="JavaScript: The Good Parts" href="http://oreilly.com/catalog/9780596517748/" target="_blank">JavaScript: The Good Parts</a> or Stoyan Stefanov&#8217;s <a title="Object-Oriented JavaScript" href="http://www.packtpub.com/object-oriented-javascript-applications-libraries/book" target="_blank">Object-Oriented JavaScript</a>.  Come back here when you&#8217;re done.  We&#8217;ll wait.</p>
<h1>Check Out the Source</h1>
<p>The OpenLayers source code is hosted in <a title="Subversion" href="http://subversion.tigris.org/" target="_blank">Subversion</a>.  Check out the source to your development directory from:</p>
<pre>http://svn.openlayers.org/trunk/openlayers/</pre>
<h1>Get Familiar with the Source</h1>
<p>The most important thing you can do is invest some time familiarizing yourself with the JavaScript source code including the code structure, object inheritance, and components similar to the one you want to write.</p>
<h2>Code Structure</h2>
<p>OpenLayers is written to be object-oriented.  As such, the code is (mostly) structured such that the base objects are located in the root directory and any children of that object are in a sub-folder of the base object&#8217;s name. <a title="Browse OpenLayers Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers" target="_blank">You can browse the source here.</a></p>
<h2>Object Inheritance</h2>
<p>OpenLayers object inheritance could be an article in and of itself, so we&#8217;ll just stick to the highlights.</p>
<p>All inheritance is done via the <a title="OpenLayers.BaseTypes.Class Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js" target="_blank">OpenLayers.Class</a> function and supports multiple inheritance by augmenting any number of existing object definitions with your own object literal definition.  In real life, it looks like this:</p>
<pre>OpenLayers.MyNewObj = OpenLayers.Class(OpenLayers.MyBaseObj, {
    prop1: 1,
    prop2: 2,
    doThis: function() {
        /* doing this */
    }
});</pre>
<p>Check out the source code of <a title="OpenLayers.Class" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/BaseTypes/Class.js" target="_blank">OpenLayers.Class</a> to really understand how OpenLayers implements object inheritance.</p>
<h2>Dig Into a Component Similar to the One You Want to Write</h2>
<p>Odds are that you are not setting out to write a completely unique component, but rather wish to build a specific implemention of something that already exists.  Most of my plugins have been tile-based layer plugins that get content from HTTP requests.  By looking through the <a title="OpenLayers Examples" href="http://openlayers.org/dev/examples/" target="_blank" class="broken_link" rel="nofollow">examples</a>, we know that OpenLayers already supports this type of functionality in <a title="OpenLayers.Layer.WMS Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/WMS.js" target="_blank">OpenLayers.Layer.WMS</a> and others.</p>
<p>We can discover what functionality OpenLayers already supports by digging into the WMS source code. Start by looking at the object definition and find its base object.  For example, the WMS layer extends <a title="OpenLayers.Layer.Grid Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/Grid.js" target="_blank">OpenLayers.Layer.Grid</a>.  The source for the base object will tell you which properties and functions you will have access to by default and if there are any functions you are required to override.  But don&#8217;t stop there!  Keep investigating base objects of the base objects until you get all the way up the chain.  For WMS, you will find <a title="OpenLayers.Layer.Grid Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/Grid.js" target="_blank">OpenLayers.Layer.Grid</a>, <a title="OpenLayers.Layer.HTTPRequest Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/HTTPRequest.js" target="_blank">OpenLayers.Layer.HTTPRequest</a>, and <a title="OpenLayers.Layer Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer.js" target="_blank">OpenLayers.Layer</a>.  Understanding these objects will be invaluable when debugging.</p>
<p>Once you have an understanding of the base objects, and assuming they have the functionality you need, take another look at the <a title="OpenLayers.Layer.WMS Source" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/WMS.js" target="_blank">WMS layer object</a>.  Look at each property and try to understand why the author added it.  Also look at the functions.  Is it a new function?  Why was it added?  Is it an override? How is it different than the base functionality and why?  Answering these questions will enable you to pinpoint the functionality you will need to implement for your plugin.</p>
<h1>Code!</h1>
<p>You now know the way of the OpenLayers plugin, grasshopper.  Go and code.  But don&#8217;t forget the <a title="OpenLayers Code Conventions" href="http://trac.openlayers.org/wiki/CodingStandards" target="_blank">code conventions</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2009/07/how-to-write-an-openlayers-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

