<?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; openlayers</title>
	<atom:link href="http://www.azavea.com/blogs/labs/tag/openlayers/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, 19 Jul 2010 04:11:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Truncating Floats in OpenLayers and SQLServer</title>
		<link>http://www.azavea.com/blogs/labs/2010/02/truncating-floats-in-openlayers-and-sqlserver/</link>
		<comments>http://www.azavea.com/blogs/labs/2010/02/truncating-floats-in-openlayers-and-sqlserver/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 16:19:48 +0000</pubDate>
		<dc:creator>Carissa Brittain</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=442</guid>
		<description><![CDATA[A perfectly valid question when dealing with map coordinates is &#8220;How accurate do we need to be?&#8221; For some applications, a tenth of a degree is more than accurate enough while for others, several more decimal places are needed. Sometimes this question is answered for you: if your data source only stores four decimal places, [...]]]></description>
			<content:encoded><![CDATA[<p>A perfectly valid question when dealing with map coordinates is &#8220;<a title="There's even a govt study" href="http://egsc.usgs.gov/isb/pubs/factsheets/fs17199.html" target="_blank">How accurate do we need to be?</a>&#8221; For some applications, a tenth of a degree is more than accurate enough while for others, several more decimal places are needed. Sometimes this question is answered for you: if your <a title="Some good free gis data" href="http://data.geocomm.com/" target="_blank">data source</a> only stores four decimal places, then that&#8217;s all the precision you&#8217;re going to have. If you&#8217;re in the <a title="4-leaves?" href="http://en.wikipedia.org/wiki/Shamrock" target="_blank">lucky</a> (unlucky?) position of generating your own coordinates, one common answer to the &#8220;how accurate&#8221; debate is &#8220;store it all&#8221;. This is the path Sajara chose, mostly because we didn&#8217;t have a good reason to choose a less precise solution over a more precise one. It just so happens that SQLServer&#8217;s <a title="Almost too much info" href="http://en.wikipedia.org/wiki/Floating_point" target="_blank">floating data type</a> precision limit is not tied so much to the number of decimal places, as to the number of numeric digits to be stored. They allow up to <a title="or 53 bits" href="http://en.wikipedia.org/wiki/Double_precision" target="_blank">16 numeric digits</a>, plus a <a title="We didn't always use one" href="http://en.wikipedia.org/wiki/Decimal_separator" target="_blank">period character</a> and a <a title="We didn't always use one either" href="http://en.wikipedia.org/wiki/Negative_number#History" target="_blank">negative character</a> as needed. Sajara works with coordinate systems in both meters and degrees, so depending on which system we&#8217;re using for a given implementation, we could be storing a value far more precise than is even visible to the <a title="half a millimeter or so" href="http://en.wikipedia.org/wiki/Naked_eye#Small_objects_and_maps" target="_blank">naked eye</a>.</p>
<p>Fast forward a few years and bring OpenLayers into the mix. We rewrote the asset editing portion of the software to allow data managers to move asset coordinates using an OpenLayers map. These coordinates were saved with still considerably more precision than we needed, but remember, we&#8217;re storing whatever precision we get. So far so good.</p>
<p>Now back to the present and we&#8217;re working on a comparison tool for our data managers. Suddenly values in the database are not matching the values coming out of our OpenLayers map. Almost, but not quite. In fact, only the last degrees of precision are different. After a bit of digging, we discovered that OpenLayers was returning numbers with between 1 and 3 fewer decimal places than our stored coordinates. Remember that we&#8217;re talking about distance differences smaller than <a title="Don't fall" href="http://images.google.com/images?hl=en&amp;client=firefox-a&amp;hs=ltN&amp;rls=org.mozilla:en-US:official&amp;resnum=0&amp;q=crack+in+the+sidewalk&amp;um=1&amp;ie=UTF-8&amp;ei=8PCHS4mEPI7U8Qakr8G8Dw&amp;sa=X&amp;oi=image_result_group&amp;ct=title&amp;resnum=4&amp;ved=0CCkQsAQwAw" target="_blank">a crack in the sidewalk</a> here, but programing languages don&#8217;t know anything about &#8220;close enough&#8221;. Either two numbers are the same or they aren&#8217;t and -39.6827663878 is not the same as -39.682766387 no matter how small the physical difference is. So we started <a title="Not quite this deep though" href="http://listverse.com/2008/09/21/top-10-amazing-holes-in-the-earth/" target="_blank">digging</a> for the reason.</p>
<p>OpenLayers has a value tucked away in its utility files that sets the default precision of a floating point number to 14 characters. This limit was added when a user noticed that the edges of certain coordinate systems were not behaving correctly due to some floating-point math precision errors. While the OpenLayers community recognizes that most systems allow floats to have 16 digits,  &#8220;<a title="Line 830-something or so" href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Util.js#L838">14 significant digits are sufficient to represent sub-millimeter accuracy in any coordinate system that anyone is likely to use with OpenLayers</a>&#8220;. So OpenLayers&#8217; answer to the accuracy question is to save everything that will fit in a standard float, with a few decimal places pared off just in case.</p>
<p>So the next question is: &#8220;So what?&#8221; The difference between 14 and 16 decimal places in a meter-based coordinate system is microscopic, and in a degrees-based one it&#8217;s not much bigger. So far as storing a saved coordinate in Sajara, we didn&#8217;t really care if we had 16 digits or 14 digits; the result wouldn&#8217;t look any different to our audience. However, since our initial coordinates had 16 digits and OpenLayers only preserved 14 of them, any programmatic comparison <a title="Though not quite this epic-ly" href="http://www.themadhat.com/images/fail_20at_20failing.jpg" target="_blank">fails!</a> No one likes to deal with false positives, but a 100% false positive rate was unacceptable.</p>
<p>We had a few choices here. First we could reset the default precision value in OpenLayers to zero, which would tell the library to never truncate anything. That&#8217;s a fairly simple change but we weren&#8217;t sure it wouldn&#8217;t have unforeseen data effects. Also, there&#8217;s a somewhat vague warning about problems with the <a title="The official definition." href="http://spatialreference.org/ref/sr-org/45/">Web Mercator</a> projection when this value is zero, which is one of the projections Sajara can use. So that option was out.</p>
<p>Second, we could have told SQLServer to alter the precision of coordinate values to 14, which is a fairly major change. This option was ruled out because of a difference in the definition of &#8220;precision&#8221; between SQLServer and OpenLayers. I mentioned earlier that SQLServer will store a maximum of 16 numeric digits plus a decimal and a negative sign, so a total of 18 characters. OpenLayers, however, considers the default precision of 14 to mean 14 characters instead of 14 numeric digits. So if a number has a decimal and a negative sign, we&#8217;re down to 12 numeric digits.  This little difference reintroduces the possibility of <a title="Wrong and right at the same time?" href="http://en.wikipedia.org/wiki/Type_I_and_type_II_errors#False_positive_rate">false positives</a>, so it isn&#8217;t really a change for the better.</p>
<p>The solution we finally decided to use was to change the OpenLayers default precision value to 18. Why 18? That&#8217;s the maximum amount of characters that SQLServer will store for a float, so OpenLayers will always be able to deal with any stored coordinates without having to truncate. Now, if we compare our stored coordinates with OpenLayer coordinates, we only get a change notice when an asset has actually been moved. Which is exactly what we wanted.</p>
<p>Here are some technical details for those interested:</p>
<p>The full variable name is OpenLayers.Util.DEFAULT_PRECISION and can be found in the Util.js file. There are a few good comments preceding the variable in the code, but more background can be found in the OpenLayers <a href="http://trac.openlayers.org/ticket/1951" target="_self">ticket #1951</a>. SQLServer information can be found in <a title="Very Technical" href="http://msdn.microsoft.com/en-us/library/ms173773.aspx" target="_blank">mdsn</a>. Note that if you wind up changing the OpenLayers precision value, you should do it as soon as possible after loading the library, so you don&#8217;t have the possibility of code using different precision values.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2010/02/truncating-floats-in-openlayers-and-sqlserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting an ArcGIS Server Map Cache in S3</title>
		<link>http://www.azavea.com/blogs/labs/2010/02/arcgis-server-cache-in-s3/</link>
		<comments>http://www.azavea.com/blogs/labs/2010/02/arcgis-server-cache-in-s3/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 15:08:44 +0000</pubDate>
		<dc:creator>Sean McGinnis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[ArcGIS Server]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=430</guid>
		<description><![CDATA[When deciding how to best handle the air photos in the new Philadelphia Water Department Stormwater Map Viewer, we kicked around a few ideas. We decided to put the cache in Amazon&#8217;s Simple Storage Service to offload some of the local disk requirements and leverage their fast data storage and delivery infrastructure. In moving the [...]]]></description>
			<content:encoded><![CDATA[<p>When deciding how to best handle the air photos in the new <a href="http://phillystormwater.org">Philadelphia Water Department Stormwater Map Viewer</a>, we kicked around a few ideas. We decided to put the cache in <a href="http://aws.amazon.com/s3/">Amazon&#8217;s Simple Storage Service</a> to offload some of the local disk requirements and leverage their fast data storage and delivery infrastructure. In moving the process, we learned a few things:</p>
<h1>Tune Your Cache</h1>
<p>Make sure you spend time planning the cache. Not only will the cache look better in the final application, but it will also load to S3 faster and cost less in the long run.</p>
<ul>
<li>Set the extents in the MXD or MSD before publishing to a map service. The overhead of transferring the 254 byte empty tiles caused a lot of unnecessary burden on the upload process as well as the fact that you are paying for them to be stored in the cloud. If it doesn&#8217;t need to be there, don&#8217;t build it.</li>
<li>Choose the correct image format for the cache. If you are caching a base map and do not need to support transparency, make it a JPEG. If it needs to support background transparency, use PNG. <a href="http://www.esri.com">ESRI&#8217;s</a> suggestions for planning a map cache can be found <a href="http://webhelp.esri.com/arcgisserver/9.3.1/dotNet/index.htm#planning_a_map_cache.htm">here</a>.</li>
</ul>
<h1>Get a Good Tool to Transfer the Files</h1>
<p>I started using the free version of <a href="http://cloudberrylab.com/?page=cloudberry-explorer-amazon-s3">Cloudberry Labs S3 explorer</a>. But I had to move over 90 Gbs worth of data to my S3 bucket. The <a href="http://cloudberrylab.com/?page=s3-explorer-pro">CloudBerry S3 Explorer &#8211; Pro</a> supported multithreading which allowed for up to 5 threads to either enumerate through the folders, copy the files or apply the ACL. It is a low cost application that more than pays for itself when moving a lot of files up to a bucket.</p>
<p>When transferring the files up, I was working in blocks of directories, not the whole scale level. It was quicker for me to work in 20 to 30 subdirectories than grabbing a whole scale level. It did require a little bit more management on my end, but more steady progress was made.</p>
<h1>Accessing the Tiles</h1>
<p>ArcGIS Server does not support cloud hosted caches at the 9.3.1 release.  The ESRI <a href="http://resources.esri.com/arcgisserver/index.cfm?fa=JSAPIs">Javascript API</a> and <a href="http://resources.esri.com/arcgisserver/apis/flex/">Flex API</a> can be extended to use caches hosted in the cloud (<a href="http://thunderheadxpler.blogspot.com/2008/09/arcgis-tiles-on-amazon-s3.html">Flex example</a> from <a href="http://thunderheadxpler.blogspot.com/">Mansour Raad</a>), so you&#8217;ll have to roll your own. For the <a href="http://www.phillystormwater.org">Philly Storm Water</a> project, we were using the <a href="http://openlayers.org/">Open Layers</a> and someone has rolled one for us. There is a <a href="http://trac.openlayers.org/attachment/ticket/1967/ArcGISCache.patch">patch</a> that can be used to access the cache without communicating through ArcGIS Server straight from the client-side library. The one thing to note is that the Tile Origin is pretty touchy, we had to make some adjustments to the origin values to make sure everything lined up correctly.</p>
<h1>Summary</h1>
<p>Now that the site is up there and we are starting to get some traffic hitting it, putting the tiles in S3 was the right decision. There is no reason for ArcGIS Server to waste any cycles moving tiles around, let it do the heavy lifting with the vector layers and queries. Hopefully the <a href="http://events.esri.com/uc/QandA/index.cfm?fuseaction=Answer&amp;ConferenceID=2A8E2713-1422-2418-7F20BB7C186B5B83&amp;QuestionID=2645">rumors</a> are true, and the ArcGIS Server 10 release will be more aligned with cloud computing. Until then, there are still plenty of ways to take advantage of the benefits.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2010/02/arcgis-server-cache-in-s3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenLayers Map Centering and the International Date Line</title>
		<link>http://www.azavea.com/blogs/labs/2009/08/openlayers-map-centering-and-the-international-date-line/</link>
		<comments>http://www.azavea.com/blogs/labs/2009/08/openlayers-map-centering-and-the-international-date-line/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 18:37:57 +0000</pubDate>
		<dc:creator>Carissa Brittain</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IDL]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=232</guid>
		<description><![CDATA[I recently came across another piece of OpenLayers to be aware of when working with maps that wrap the International Date Line. I store the map extent throughout a user's session so they can leave the map page, come back, and still see the same set of results as when they left. Unfortunately, the map was sometimes taking a stored location in the North Pacific and displaying Northern Africa instead! Obviously not what I want it to do...]]></description>
			<content:encoded><![CDATA[<p>I recently came across another piece of OpenLayers to be aware of when working with maps that wrap the International Date Line. I store the map extent throughout a user&#8217;s <a title="Temporary communication contracts, anyone?" href="http://en.wikipedia.org/wiki/Session_(computer_science)" target="_blank">session </a>so they can leave the map page, come back, and still see the same set of results as when they left. Unfortunately, the map was sometimes taking a stored location in the <a title="Lots of water..." href="http://www.pmel.noaa.gov/np/pages/seas/npmap1.html" target="_blank">North Pacific</a> and displaying <a title="... lots of sand" href="http://en.wikipedia.org/wiki/Northern_Africa" target="_blank">Northern Africa</a> instead! Obviously not what I want it to do. Before I get into why this happens, here&#8217;s a few OpenLayers object introductions to make sure we&#8217;re all on the same page.</p>
<p>The <a title="OpenLayers.Layer" href="http://dev.openlayers.org/apidocs/files/OpenLayers/Layer-js.html">Layer object</a> can understand what projection you&#8217;re working in, if you happen to give it one. If the displayed map area happens to wrap around the IDL (and your layers are set up correctly), the Layer object gracefully acknowledges the IDL and produces correct coordinates.</p>
<p>In contrast, the <a title="OpenLayers.BaseTypes.Bounds" href="http://dev.openlayers.org/apidocs/files/OpenLayers/BaseTypes/Bounds-js.html" target="_blank">Bounds object</a> is pure math. It&#8217;s meant to be as projection-agnostic as possible without actually messing up coordinates in objects that do know about <a title="An intro to the subject" href="http://members.shaw.ca/quadibloc/maps/mapint.htm" target="_self">projections </a>and their quirks. This can be a very good thing, since doing math without worrying about projections is a lot faster and works just fine in most cases.</p>
<p>The problem I ran into comes from one little Layer object configuration option that is uncharacteristically poorly documented: wrapDateLine. The issue it tells you to reference (#487) talks about using <a title="Like clocks" href="http://en.wikipedia.org/wiki/Modular_arithmetic" target="_blank">modular arithmatic</a> to fix how layers handle the IDL&#8230; I&#8217;m not a math person, but handling the IDL is exactly what I want it to do! Too bad they couldn&#8217;t have mentioned this in the documentation.  <img src='http://www.azavea.com/blogs/labs/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   What the Map winds up doing if you don&#8217;t have this config option set is using the Bounds object&#8217;s straight-up math to get the center of the extent. Unfortunately, using straight math when the IDL is in play puts the center of the map at the longitude exactly opposite of where logic dictates it should go. If the wrapDateLine configuration item is set, then the Layer tells the Map &#8220;<a title="Hi Ho Silver!" href="http://www.otr.net/?p=lone" target="_blank">Whoa, there!</a> The Bounds object doesn&#8217;t know about the IDL, but I do. Use my math first.&#8221; So the Map uses the Layer&#8217;s math to turn the extent into coordinates that the Bounds object&#8217;s math will work correctly on. Viola! <a title="I'm sailing away..." href="http://go.hrw.com/atlas/norm_map/npacific.gif" target="_blank">The North Pacific</a>!</p>
<p>So the simple fix is to have <a title="OpenLayers example code" href="http://openlayers.org/dev/examples/wrapDateLine.html">wrapDateLine: true</a> in your layer configuration object.</p>
<p>To see this bit of oddness &#8216;in action&#8217;, go to the <a title="OpenLayers example code" href="http://openlayers.org/dev/examples/google.html">OpenLayers Google Map example</a> and pan the map so that the IDL is in view. Using FireBug, enter the commands <strong>map.getCenter()</strong> and <strong>map.getExtent().getCenterLonLat()</strong>. The resulting coordinate longitudes will be on opposite sides of the planet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2009/08/openlayers-map-centering-and-the-international-date-line/feed/</wfw:commentRss>
		<slash:comments>0</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[Uncategorized]]></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 and do [...]]]></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">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>
		<item>
		<title>Azavea R&amp;D: sourcemap.org</title>
		<link>http://www.azavea.com/blogs/labs/2009/05/azavea_rd_sourcemaporg/</link>
		<comments>http://www.azavea.com/blogs/labs/2009/05/azavea_rd_sourcemaporg/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:32:40 +0000</pubDate>
		<dc:creator>David Zwarg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cartography]]></category>
		<category><![CDATA[mit]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[sourcemap]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blogs/labs/?p=70</guid>
		<description><![CDATA[Azavea is a rare company. One of the benefits that we (full-time employees) earn is the ability to define our own research project after 6 months.  There is a list of active research projects here.  My personal interests took me to working with C. Dana Tomlin, and implementing a radial propagation tool for ArcToolbox. In addition, I wanted to collaborate with the MIT Media Lab's Tangible Media Group on the project http://www.sourcemap.org/.

I won't get into what sourcemap is (that's already been done), but I thought it would be cool to mention some of the technical challenges that the project was/is facing, and what we're doing about it.]]></description>
			<content:encoded><![CDATA[<p>Azavea is a rare company. One of the benefits that we (full-time employees) earn is the ability to define our own research project after 6 months.  There is a list of <a href="http://www.azavea.com/Research.aspx">active research projects</a><a href="http://www.azavea.com/Research.aspx"> here</a>.  My personal interests took me to working with C. Dana Tomlin, and implementing a radial propagation tool for ArcToolbox, as well as collaborating with the <a href="http://www.media.mit.edu/">MIT Media Lab</a>&#8217;s <a href="http://www.media.mit.edu/research/39">Tangible Media Group</a> on the project <a href="http://www.sourcemap.org">http://www.sourcemap.org/</a>.</p>
<p>I won&#8217;t get into what sourcemap is (that&#8217;s already been done), but I thought it would be cool to mention some of the technical challenges that the project was/is facing, and what we&#8217;re doing about it.</p>
<p>First, the project started out with maps from a free, proprietary mapping API. This was a great stepping off point, but as the maps and networks became more complex, that API started to break.  I advocated that the project migrate to an Open Source JavaScript mapping library, by the name of OpenLayers.  This helped us overcome that barrier to complex maps.</p>
<p>Next, we wanted to change the cartography from simple lines between points to something more &#8217;stylish&#8217;.  The problem that we experienced was that it was difficult to discriminate the paths of colinear parts of an object. To solve this, we added a slight arc to the lines.  This technique makes it easier to discriminate the connections between colinear parts and an object.</p>
<p>Time to bust out the trigonometry again!  I doodled the following sketches on a mousepad weekly planner.  I wanted an offset of the line in the vertical direction for most horizontal lines.  This calculation got me started, but then I realized that it would be weird if the arcs suddenly swapped sides if you passed the Y axis (e.g. from 359 degrees to 1 degree).</p>
<p><img class="aligncenter size-full wp-image-93" src="http://www.azavea.com/blogs/labs/wp-content/uploads/2009/05/calc1.png" alt="Initial Calculation" width="295" height="285" /></p>
<p style="text-align: center;">
<p style="text-align: left;">So I added another step, which attenuated the arcing, starting at 45 degrees from either side of the Y axis, and gradually decreasing to no deflection in the Y direction.</p>
<p style="text-align: left;"><img class="aligncenter size-full wp-image-94" src="http://www.azavea.com/blogs/labs/wp-content/uploads/2009/05/calc2.png" alt="Deflection Attenuation" width="296" height="286" /></p>
<p style="text-align: center;">
<p style="text-align: left;">The result?  A cool looking network of lines that are clearly distinguishable! You can see it in action <a href="http://www.sourcemap.org/beta/stage/index.php/objects/object-171">here</a>.</p>
<p style="text-align: left;">We&#8217;ve got even more improvements on the way for the map, and I think it will make it a really compelling, and intuitive visualization of global supply chains.  Watch this space for the next installment.</p>
<p style="text-align: left;">
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2009/05/azavea_rd_sourcemaporg/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenLayers with ArcGIS or ArcIMS</title>
		<link>http://www.azavea.com/blogs/labs/2009/04/openlayers-with-arcgis-or-arcims/</link>
		<comments>http://www.azavea.com/blogs/labs/2009/04/openlayers-with-arcgis-or-arcims/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 13:16:50 +0000</pubDate>
		<dc:creator>David Zwarg</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ArcIMS]]></category>
		<category><![CDATA[arcxml]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://www.azavea.com/blog_labs/?p=6</guid>
		<description><![CDATA[OpenLayers, an open source web mapping library for browsers, is 99% web mapping goodness.  We took a look at the library, and found that we could almost use it in our projects to provide a robust mapping interface.  The extra 1% that we really needed was support for ArcIMS and ArcGIS Server.
So we fixed it.
Jeff [...]]]></description>
			<content:encoded><![CDATA[<p><a title="http://www.openlayers.org" href="http://www.openlayers.org">OpenLayers</a>, an open source web mapping library for browsers, is 99% web mapping goodness.  We took a look at the library, and found that we could <em>almost</em> use it in our projects to provide a robust mapping interface.  The extra 1% that we <em>really</em> needed was support for ArcIMS and ArcGIS Server.</p>
<p>So we fixed it.</p>
<p>Jeff added support for ArcGIS Server, and I added support for ArcIMS (in addition to a subset of ArcXML).  These are tickets in the OpenLayers tracking system, under the monickers <a href="http://trac.openlayers.org/ticket/1749">#1749</a> and <a href="http://trac.openlayers.org/ticket/213">#213</a>, respectively.  ArcGIS Server has made it into the trunk, and we are anxiously awaiting the incorporation of ArcIMS/ArcXML support.  It looks like they are both on track to make it into OpenLayers v2.8, so we are excited.</p>
<p>We&#8217;ve been running production applications with the patches we&#8217;ve provided to the OpenLayers community for months now, so it&#8217;ll be wonderful to make it &#8216;official&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.azavea.com/blogs/labs/2009/04/openlayers-with-arcgis-or-arcims/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
