<?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>Burcu Dogan&#039;s Blog &#187; maps</title>
	<atom:link href="http://burcudogan.com/tag/maps/feed/" rel="self" type="application/rss+xml" />
	<link>http://burcudogan.com</link>
	<description>Burcu Dogan is a software engineer, a technologist and an open source enthusiastic.</description>
	<lastBuildDate>Thu, 26 Apr 2012 14:34:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='burcudogan.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Burcu Dogan&#039;s Blog &#187; maps</title>
		<link>http://burcudogan.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://burcudogan.com/osd.xml" title="Burcu Dogan&#039;s Blog" />
	<atom:link rel='hub' href='http://burcudogan.com/?pushpress=hub'/>
		<item>
		<title>Setting bounds of a map to cover collection of POIs on Android</title>
		<link>http://burcudogan.com/2010/04/20/setting-bounds-of-a-map-to-cover-collection-of-pois-on-android/</link>
		<comments>http://burcudogan.com/2010/04/20/setting-bounds-of-a-map-to-cover-collection-of-pois-on-android/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 10:51:14 +0000</pubDate>
		<dc:creator>Burcu Dogan</dc:creator>
				<category><![CDATA[Regular]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.burcudogan.com/?p=521</guid>
		<description><![CDATA[Lately, as I browse web for maps related questions on Android, what&#8217;s frequently requested is an example of setting bounds of a map (zooming to a proper level and panning) to be able show all of the pins given on &#8230; <a href="http://burcudogan.com/2010/04/20/setting-bounds-of-a-map-to-cover-collection-of-pois-on-android/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=521&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Lately, as I browse web for maps related questions on Android, what&#8217;s frequently requested is an example of setting bounds of a map (zooming to a proper level and panning) to be able show all of the pins given on the screen.</p>
<p>Most of the maps APIs provide this functionality such as Google Maps API, so developers seem to have problems with implementing theirs. Google Maps API for Android does not provide functionality for setting bounds to a box. Instead, what&#8217;s provided is to zoom to a span.</p>
<p><code>com.google.android.maps.MapController.<strong>zoomToSpan</strong>(int latSpanE6, int lonSpanE6)</code></p>
<p>latSpanE6 is the difference in latitudes * 10^6 and similarly lonSpanE6 is the difference longitude * 10^6. You may question how map controllers know where to zoom in just by the differences. For examples, kms between longitudes differ from equator to poles. Fortunately, Google maps projection has them in the same length. This may remind you the infamous <a href="http://answers.yahoo.com/question/index?qid=20090824125304AAiAM3j">South America versus Greenland syndrome</a>. Although Greenland is much much smaller than South America, it doesnt look so with this map projection.</p>
<p>On the below, I implemented a boundary arranger method for MapView. Method takes three arguments: items, hpadding and vpadding. items as you may guess is a list of POIs. Other arguments are a little bit more interesting. hpadding and vpadding is the percentage of padding you would like to leave horizontally and vertically so that pins don&#8217;t appear just on the corners. For instance, if you assign 0.1 for hpadding, 10% padding will be given from top and bottom.</p>
<p>BTW, You&#8217;ll have to extend the existing MapView and add this method to your own MapView to use this method properly.</p>
<pre class="java">public void <strong>setMapBoundsToPois</strong>(List&lt;GeoPoint&gt; items, double hpadding, double vpadding) {

    MapController mapController = this.getController();
    // If there is only on one result
    // directly animate to that location

    if (items.size() == 1) { // animate to the location
        mapController.animateTo(items.get(0));
    } else {
        // find the lat, lon span
        int minLatitude = Integer.MAX_VALUE;
        int maxLatitude = Integer.MIN_VALUE;
        int minLongitude = Integer.MAX_VALUE;
        int maxLongitude = Integer.MIN_VALUE;

        // Find the boundaries of the item set
        for (GeoPoint item : items) {
            int lat = item.getLatitudeE6(); int lon = item.getLongitudeE6();

            maxLatitude = Math.max(lat, maxLatitude);
            minLatitude = Math.min(lat, minLatitude);
            maxLongitude = Math.max(lon, maxLongitude);
            minLongitude = Math.min(lon, minLongitude);
        }

        // leave some padding from corners
        // such as 0.1 for hpadding and 0.2 for vpadding
        maxLatitude = maxLatitude + (int)((maxLatitude-minLatitude)*hpadding);
        minLatitude = minLatitude - (int)((maxLatitude-minLatitude)*hpadding);

        maxLongitude = maxLongitude + (int)((maxLongitude-minLongitude)*vpadding);
        minLongitude = minLongitude - (int)((maxLongitude-minLongitude)*vpadding);

        // Calculate the lat, lon spans from the given pois and zoom
        mapController.zoomToSpan(Math.abs(maxLatitude - minLatitude), Math
.abs(maxLongitude - minLongitude));

        // Animate to the center of the cluster of points
        mapController.animateTo(new GeoPoint(
              (maxLatitude + minLatitude) / 2, (maxLongitude + minLongitude) / 2));
    }
} // end of the method</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/burcudo.wordpress.com/521/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/burcudo.wordpress.com/521/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/burcudo.wordpress.com/521/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=521&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://burcudogan.com/2010/04/20/setting-bounds-of-a-map-to-cover-collection-of-pois-on-android/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7526ec3e801f8ba99f6746498a154a6?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thejbf</media:title>
		</media:content>
	</item>
		<item>
		<title>Maps Development on Android: Registering a Maps API key</title>
		<link>http://burcudogan.com/2009/11/06/maps-development-on-android-registering-a-maps-api-key/</link>
		<comments>http://burcudogan.com/2009/11/06/maps-development-on-android-registering-a-maps-api-key/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 12:29:57 +0000</pubDate>
		<dc:creator>Burcu Dogan</dc:creator>
				<category><![CDATA[Regular]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.burcudogan.com/?p=307</guid>
		<description><![CDATA[Location based applications are  musts on mobile platforms. Android does not have maps natively but Google Maps team is providing an add-on that comes with Android SDK (at least 1.5). In this post, I&#8217;m not going to show you how &#8230; <a href="http://burcudogan.com/2009/11/06/maps-development-on-android-registering-a-maps-api-key/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=307&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Location based applications are  musts on mobile platforms. Android does not have maps <em>natively</em> but Google Maps team is providing an add-on that comes with Android SDK (at least 1.5). In this post, I&#8217;m not going to show you how to pop out maps on your little mobile screen, but underline the application signature details related with Maps API.</p>
<p>First of all in our to show map tiles properly, we need an API key. This is all because you are requesting from Google Data API and have to agree with the terms of service. I&#8217;m also sure that quote rules also apply.</p>
<p>Every Android application is signed with a signature of the publisher. While obtaining a key, you must provide the MD5 summary of your signature to Google, and Google activates possible transactions between Maps API and the application your signature signs. In order to complete these actions, you have to</p>
<ol>
<li>Obtain the MD5 summary of your signature. If you do not have a signature, you can use the default one.</li>
<li><a href="http://code.google.com/android/maps-api-signup.html">Sign up for an API key</a> directly from Google by providing the hash of your signature.</li>
<li>Use API key with map elements and generate a sample map view.</li>
</ol>
<h2>Obtaining an API key</h2>
<p>You will have to use the keytool to obtain information about signatures. If you haven&#8217;t created one, Android SDK puts a default one in your <code>~/.android</code> directory. In this tutorial, I&#8217;m going to show you how to register with this default signature. Open a terminal prompt and enter</p>
<pre>$ keytool -list -keystore <strong>~/.android/debug.keystore</strong></pre>
<p>It&#8217;s going to ask you the password of the keystore (debug.keystore). Default is &#8220;android&#8221;. If you receive a MalformedKeyringException, you are giving the wrong password. If everything works great, it will output a few lines of information including the hash. Please read the summary line and copy the hash.</p>
<pre>Certificate fingerprint (MD5): <strong>E8:F4:F2:BF:03:F3:3A:3D:F3:52:19:9B:58:20:87:68</strong></pre>
<p>After obtaining the summary key, you can jump to the next level &#8212; <a href="http://code.google.com/android/maps-api-signup.html">signing up for an API key</a>. Give the hash as input and register. Please note the API key Google has given to you.</p>
<h2>Generating Maps on Android</h2>
<p>Android SDK comes with two archives. First one is the <code>android.jar</code> which contains the standard platform libraries. And <code>maps.jar</code> which is a library dedicated to generation of maps. In the maps API, you will notice <a href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapView.html">MapView</a>. You can extend MapView to customize and add new features to show a custom map view. Or <a href="http://developer.android.com/guide/tutorials/views/hello-mapview.html">invoke the existing methods</a> to perform simple operations like panning, zooming and adding overlays to show information on the default map. There are great tutorials about Android&#8217;s map view and controller on web, I simply didn&#8217;t want to copy-cat the existing. Google&#8217;s <a href="http://developer.android.com/guide/tutorials/views/hello-mapview.html">Hello, MapView</a> is a place to start.</p>
<h2>Multiple-Developer Cases</h2>
<p>A signature can only be associated with a single API-key. What you are going to do if development is made across a team? You <strong>dont need to </strong>create different signatures for each developer and register them to use Data API one by one. Register a single signature and obtain a key. Then, <em>distibute the signature among the developers</em> &#8211; better add it to your version controlling system.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/burcudo.wordpress.com/307/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/burcudo.wordpress.com/307/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/burcudo.wordpress.com/307/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=307&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://burcudogan.com/2009/11/06/maps-development-on-android-registering-a-maps-api-key/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7526ec3e801f8ba99f6746498a154a6?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thejbf</media:title>
		</media:content>
	</item>
		<item>
		<title>Let&#8217;s modify our representation of addresses in adr microformat</title>
		<link>http://burcudogan.com/2009/08/02/lets-modify-our-representation-of-addresses-in-adr-microformat/</link>
		<comments>http://burcudogan.com/2009/08/02/lets-modify-our-representation-of-addresses-in-adr-microformat/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 21:25:37 +0000</pubDate>
		<dc:creator>Burcu Dogan</dc:creator>
				<category><![CDATA[Regular]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[microformats]]></category>

		<guid isPermaLink="false">http://blog.burcudogan.com/?p=258</guid>
		<description><![CDATA[Microformats define a representation spec for addresses, called adr. This year, I made two distinct proposal to modify the current draft, but turned down each time I tried. In this post, I&#8217;m going to address the current problems and how &#8230; <a href="http://burcudogan.com/2009/08/02/lets-modify-our-representation-of-addresses-in-adr-microformat/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=258&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Microformats define a representation spec for addresses, called <a href="http://microformats.org/wiki/adr">adr</a>. This year, I made two distinct proposal to modify the current draft, but turned down each time I tried. In this post, I&#8217;m going to address the current problems and how tiny enhancements can bring new horizons in the retrieval of location based information.</p>
<h3>The problem</h3>
<p><a href="http://microformats.org/wiki/adr#Format">Current spec</a> does not serve as a latitude, longitude carrier. Current properties only include <em>post-office-box, extended-address, street-address, locality, region, postal-code and country-name</em> which are text fields to form an address. This schema is defined in vCard and migrated to hCard microformat in 2004. Then, the need of address-based extraction led them to copycat this format and call it <em>adr</em>. <strong>vCard&#8217;s final design spec was way before we had online maps. </strong>Nowadays, we have addresses all over the Web. Automatically directing these text addresses to locations on maps or providing a preview on hovers would be the first basic attempts to improve our data representations. But unfortunately, maps are talking more in mathematics than text addresses. In practise, there is a process that takes addresses and transforms them into a latitude, longitude couple and pans map to that location. This process is called <a href="http://en.wikipedia.org/wiki/Geocoding">geocoding</a>, and it is far away from perfection in today&#8217;s scale. Instead of depending on a geocoder to transform addresses into mathematical locations, I suggest microformats to enable built-in (lat, long) arrays in adr.</p>
<h3>Extending adr with a set of latitudes and longitudes</h3>
<p>What I&#8217;m going for is to extend adr with an optional list of (lat, long) values. So, in cases where coordinates are given, instead of asking a geocoder to land us on a location we can directly move. But why to use a list of coordinates and not a single point? Because, in spatial domain different geometric structures are being represented as different shapes. Examples are below.</p>
<ol>
<li>If you are talking about a city centre, it&#8217;s most likely to be a <strong>Point</strong>.</li>
<li>Mississippi river is a long long <strong>Line</strong>.</li>
<li>And a university campus is obviously a <strong>Polygon</strong>.</li>
</ol>
<p>In the image above, British Museum is represented by 12 latitudes and longitudes as the inner area which these points compose. On the other hand another representation may be made with the centre point of the museum with (51.529038,-0.128403). Formally speaking, the museum is located on &#8220;<em>British Museum, Great Russell Street, London, WC1B 3DG, UK</em>&#8220;. And this translates to the coordinate I gave. What about using them together to form:</p>
<pre>&lt;div class="adr"&gt;

&lt;div class="street-address"&gt;Great Russell Street&lt;/div&gt;
&lt;span class="locality"&gt;London&lt;/span&gt;,
&lt;span class="postal-code"&gt;WC1B 3DG&lt;/span&gt;,
&lt;div class="country-name"&gt;UK&lt;/div&gt;

&lt;div class="geo"&gt; &lt;!-- optional coordinates attribute from geo --&gt;
&lt;span class="latitude"&gt;51.529038&lt;/span&gt;,
&lt;span class="longitude"&gt;-0.128403&lt;/span&gt;
&lt;/div&gt;

&lt;/div&gt;</pre>
<p>In the example above, I&#8217;ve used <a href="http://microformats.org/wiki/geo">geo</a> to include the single point &lt;lat, long&gt; optionally to map the address to a physical location. More useful structures can be defined within standards to enable multiple point entries to provide polygons such as 12-point representation of British Museum in the image above. Or basically, multiple geo entries inside an adr may work.</p>
<p><strong>TODO:</strong> Write about the impact this usage can bring.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/burcudo.wordpress.com/258/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/burcudo.wordpress.com/258/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/burcudo.wordpress.com/258/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=258&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://burcudogan.com/2009/08/02/lets-modify-our-representation-of-addresses-in-adr-microformat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7526ec3e801f8ba99f6746498a154a6?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thejbf</media:title>
		</media:content>
	</item>
		<item>
		<title>Data Manipulation on Client Machines</title>
		<link>http://burcudogan.com/2009/05/22/data-manipulation-on-client-machines/</link>
		<comments>http://burcudogan.com/2009/05/22/data-manipulation-on-client-machines/#comments</comments>
		<pubDate>Fri, 22 May 2009 11:47:42 +0000</pubDate>
		<dc:creator>Burcu Dogan</dc:creator>
				<category><![CDATA[Regular]]></category>
		<category><![CDATA[clientside]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[realtime web]]></category>

		<guid isPermaLink="false">http://blog.burcudogan.com/?p=227</guid>
		<description><![CDATA[It&#8217;s my third week and I&#8217;m discussing the scalability of the real-time web. We&#8217;re only talking about text input, realtime search, trend extractions and etc. I had a love growing inside for this instant replier, it makes me feel I&#8217;m &#8230; <a href="http://burcudogan.com/2009/05/22/data-manipulation-on-client-machines/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=227&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s my third week and I&#8217;m <a href="http://friendfeed.com/search?q=realtime&amp;comment=thejbf">discussing</a> the scalability of the real-time web. We&#8217;re only talking about text input, realtime search, trend extractions and etc. I had a love growing inside for this instant replier, it makes me feel I&#8217;m more connected to real people (<em>sort of egoism</em>). It&#8217;s good because we have text, none of the realtime providers are working on more than indexing the &#8220;text&#8221; for searching, as it revealed. Text is medium of communication and there are a lot more: images, audio, videos etc. You are not really interested in multimedia as I guess because, <em>text is cool</em>. You can skim it, you can select it, easily process it. But the world is not man-made and I cant even imagine a moment where maps are served as text, for example. Typing is human&#8217;s built-in analog to digital converter. Love it or not, but we are forced ungracefully by this nature to talk in multimedia when text alone is not efficient enough.</p>
<h3>Realtime Data Processing</h3>
<p>Realtime environment have to play with data to make connections, be able to provide smart searching that does not only depend on full-text comparison. Imagine that they have to tokenize text input to post-process what&#8217;s going on with the message. Almost requires O(n) on CPU. Twitter has about 1 million users, let&#8217;s assume averagely every user enters a new twit once in 3 days and average entry is 100 characters long (doesn&#8217;t sound realistic, but let&#8217;s be optimistic). It converges to 350k posts a day. 350k times tokenizing the 100 character-long input = <strong>35 million characters</strong> are processed during a day.  I tried to tokenize a 100 char string 350k times and it took only 41 seconds since I was using the same string over and over again. With helps of caching, CPU minimizes the memory I/O and it made a huge difference, so my 41 seconds were far from being accurate. But besides tokenizing, there are other operations you have to run. And once you fetch it from memory, you&#8217;re done. Therefore, I believe it&#8217;s not really an extra load to tokenize the input on the server-side.</p>
<p>But, what would you do if you have to post-process terabytes of imagery? I&#8217;m not sure if you are aware of Microsoft&#8217;s Virtual Earth 3D but, it is more like<strong> Google Earth running on your browser</strong>.</p>
<p>&nbsp;</p>
<p>A very long time ago, I was making a demo to my friends and showing the Mt. Rainer in WA distinct in 3D mode. Virtual Earth 3D fetches higher quality imagery for forefront. Since there is no colour balance adjustments at VE imagery, many people thought  the level differences on the scene is sort of a corruption and not good looking. I decided to talk to engineers that we can solve this problem with <em>relative histogram equalization</em> (fancy name but easy method). I didn&#8217;t sound perfectly realistic, cause our imagery were tens of terabytes and it was very risky to process them all for such a tiny improvement.<span id="more-227"></span></p>
<p>Luckily, I recognize client power for the first time and the power it brings out. I was going to add a improvement step to equalize imagery once it is loaded as &#8220;it is&#8221; to user machine. User&#8217;s itself was about to play a role to balance images on the front-end.</p>
<h3>Future of the Web: More Realtime Data Needs More Client Power</h3>
<p>Twitter example is quite lightweight, 35 million characters/day is not huge as you may guess. As millions started to use realtime equipment passionately and generate a hundred thousands times more content than this, we may have to take advantage of our user&#8217;s machines mostly for pre and post processing of data. All of the new client technologies are about the provide a rich environment and framework to let the users contribute to the overall system with scalability. Future is going to be all about <strong>making a distribution decision between clients and servers</strong>. If you are a server guy who has no idea on the user machines, study your lesson before this balance dominates the world.</p>
<p><strong>Edit: </strong>Sorry for quoting VE&#8217;s 3D mode with Silverlight, thanks for Jon O&#8217;Brein (a Microsoft MVP) for fixing my deadly fault. I was high or something.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/burcudo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/burcudo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/burcudo.wordpress.com/227/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=227&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://burcudogan.com/2009/05/22/data-manipulation-on-client-machines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7526ec3e801f8ba99f6746498a154a6?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thejbf</media:title>
		</media:content>
	</item>
		<item>
		<title>JPEG to Compress Vector Graphics?</title>
		<link>http://burcudogan.com/2009/04/09/jpeg-to-compress-vector-graphics/</link>
		<comments>http://burcudogan.com/2009/04/09/jpeg-to-compress-vector-graphics/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 22:26:39 +0000</pubDate>
		<dc:creator>Burcu Dogan</dc:creator>
				<category><![CDATA[Regular]]></category>
		<category><![CDATA[image compression]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://blog.burcudogan.com/201/</guid>
		<description><![CDATA[Compressing, entropy and information theory have things in common with economics. Nobody&#8217;s going to turn his head unless you stop talking maths. I truly understand they are a bit boring and complex for your grandmother, but surprisingly most of the &#8230; <a href="http://burcudogan.com/2009/04/09/jpeg-to-compress-vector-graphics/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=201&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Compressing, entropy and information theory have things in common with economics. Nobody&#8217;s going to turn his head unless <em>you stop talking maths</em>. I truly understand they are a bit boring and complex for your grandmother, but surprisingly most of the technical people doesn&#8217;t bother to understand the underlying concept either. In this post, I&#8217;m going to pass over the following topics in a daily tongue to illustrate the overall scheme on your mind:</p>
<ol>
<li>What is image compression and why do we use it? </li>
<li>A short brief of JPEG compression. </li>
<li>A review of <a href="http://maps.google.com/">Google Maps</a> and <a href="http://maps.live.com">Live Search Maps</a> for serving images as the primary content. </li>
</ol>
<h2>Introduction to Image Compression</h2>
<p>If you understand the term <em>&quot;compression</em>&quot;, it doesn&#8217;t mean we are over with the definition. Hold on. </p>
<blockquote><p>Image compression, the art and science of reducing the amount of data required to represent an image, is one of the most useful and commercially successful technologies in the field of digital image processing. (<em>Digital Image Processing 3rd Ed., Gonzalez &amp; Woods, page 525</em>)</p>
</blockquote>
<p>Let&#8217;s first try to understand how compression became one of the most commercially successful field in image processing? With the irrepressible popularity of television and Internet (after mid-90s), images and videos become significant elements to represent information. With no compression;&#160; a coloured <a href="http://en.wikipedia.org/wiki/Standard-definition_television">standard TV</a> broadcast, 640&#215;480 wide with refresh rate of 30 frames per seconds, requires 27,648,000 bytes to be transmitted per second. Even in tomorrow&#8217;s technology, supplying a connection of almost 30Mbytes/second just for a TV cast doesn&#8217;t seem to be possible with no doubt. It&#8217;s no surprise to hear many failed quotes back from early 1900s that television will never be able to find opportunity to be on the market.</p>
<h3>Data versus Information</h3>
<p>When the issue is compression, it refers to the compression of data. Data is being transferred to carry information. Therefore, we might be able to reduce the amount of data to represent a given quantity of information. A parrot in a very populated barber shop in downtown loves to say &quot;Hello&quot; to every new customer that comes in. How would you transmit the words it spells in text most efficiently?</p>
<p><img class="inline" title="Data vs. Information" border="0" alt="image" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image.png" /> </p>
<p>Statistically hello is the most common word. Representing it in a bit is highly acceptable, instead of transferring 5 characters (5*8 = 40 bits). In the example above, it&#8217;s very clear that statistics say &quot;stranger&quot; is the second word we most likely to hear from parrot and so on. Converting (mapping) the string array into a bit stream saves 94% of bandwidth in this case. <a href="http://en.wikipedia.org/wiki/Huffman_coding">Huffman coding</a>, which is going to remind you the method above, guarantees you to use minimum possible number of bits if you have statistical information of data.</p>
<h3>Image Compression Techniques</h3>
<p>Generally, image compression techniques are separated into two columns:&#160; lossy and lossless compression. Lossy methods takes the advantage of capabilities of <strong>human vision range</strong>, eliminates details and loose information to reduce amount of data. Lossy methods are mostly used for natural images. In lossless compression, encoding process finds a smart way to represent same amount of information in lesser amount of data, just like in the example above with Mr. Parrot. And some may use hybrid models to mix advantages of both sides.<span id="more-201"></span> </p>
<h2>JPEG Compression</h2>
<p><a href="http://blog.burcudogan.com/wp-content/uploads/2009/04/image2.png"><img style="display:inline;margin-left:0;margin-right:0;border-width:0;" title="image" border="0" alt="image" align="right" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb.png" width="300" height="67" /></a>JPEG is a hybrid compression method, optionally can perform as totally lossless. It mainly depends on the fact that correlation between close pixels doesn&#8217;t change much in natural photos. So, we are able to guess closer pixels around if we know the one in the middle. JPEG&#8217;s encoding algorithm is separated into four steps:</p>
<ol>
<li>Blocking the image into little pieces, usually 8&#215;8 pixel blocks – some use 16&#215;16 blocks. Separating images into little pieces will help us the guess the nearby pixels. </li>
<li><strong>Discrete Cosine Transform (DCT):</strong> In &quot;<em>simple</em>&quot; terms, this process generates a bit stream for each block which starts with the average value of the block continuing the details of how pixels change horizontally and vertically. So, as an addition to the guess, we have extra information to fix it. Therefore, DCT is totally lossless. It only represents the same information in other words. Outputs a stream of 64 numerical elements like: 125 34 –32 43 2 21 –43 1 –3 4&#8230; (Smart way to represent information) </li>
<li><strong>Quantization:</strong> Adjusts precision.&#160; This is where we loose information. Output stream may turn into: 125 35 –30 45 0 20 –45 –5 5&#8230; (Human vision range is not that sensitive) </li>
<li><strong>Entropy encoding:</strong> You may encode the stream coming from quantization with Huffman coding to save bandwidth – just like how we did in the parrot example. (Smart way to represent information) </li>
</ol>
<h2>Maps and Compression</h2>
<p>Maps serve images as their <em>primary content.</em> Most of the providers have road, aerial, labelled road, labelled aerial, terrain (<a href="http://maps.google.com/?ie=UTF8&amp;ll=51.727028,5.844727&amp;spn=13.051211,39.550781&amp;t=p&amp;z=5">Google does</a>), bird&#8217;s eye (<a href="http://maps.live.com/default.aspx?v=2&amp;FORM=LMLTCP&amp;cp=skj331gzpckc&amp;style=b&amp;lvl=1&amp;tilt=-90&amp;dir=0&amp;alt=-1000&amp;scene=16378878&amp;phx=0&amp;phy=0&amp;phscl=1&amp;encType=1">Live Search Maps does</a>) and etc. In this section, I&#8217;m going to discuss mostly the <em>aerial imagery</em> and how many bytes they are spreading to share the same amount of information. Both of the providers have road, aerial and aerial (with labels) image sources.</p>
<h3>Google Maps (maps.google.com)</h3>
<p>Google Maps choose to separate vector and natural images. Encode vectors as transparent PNGs and aerial images as JPEGs. And adds vector information as an overlay if user prefer to view the area with labels.</p>
<p><img class="inline" title="Aerial" border="0" alt="Aerial" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image3.png" width="150" height="150" /> <img class="inline" title="Labels" border="0" alt="Labels" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image4.png" width="150" height="150" /> <img class="inline" title="Aerial with Labels" border="0" alt="Aerial with Labels" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image5.png" width="150" height="150" />&#160;<a href="http://blog.burcudogan.com/wp-content/uploads/2009/04/image6.png"><img class="inline" alt="Road Map" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb1.png" width="150" height="150" /></a> </p>
<p>Image sizes in the corresponding order are: 27.6KB (JPEG), 13.7KB (PNG), 0KB (overlaid versions of 1st and 2nd image), 25.6KB (PNG). In this case, let&#8217;s count the bytes Google consumes on the following actions:</p>
<ol>
<li>Road imagery views: 25.6KB </li>
<li>A switch to labelled aerial: 27.6KB + 13.7KB = 41.3KB </li>
<li>A switch to aerial without labels: cost free </li>
<li><strong>Total cost</strong> = 25.6KB +&#160; 41.3KB = 66.9KB </li>
</ol>
<p>Google only seems to make an encoding decision depending on the image&#8217;<br />
s characteristics, JPEG for aerial, PNG for rest. But unfortunately, this leads to the transmission of repeated information of roads on an aerial switch. Take a look at image 2 and 4 above. </p>
<p>I&#8217;m guessing <strong>most people don&#8217;t tend to switch to aerial soon</strong> until they zoom in to <em>street level</em>. So, instead of pushing them to download two separate images for on road mode, Google Maps may choose this method. HTTP requests are costly. And a dozen of them are more costly than costly. A map control usually has to download 8-12 tiles depending on your screen resolution. Just think of the overhead that those 12 tiles are generating.</p>
<h3>Live Search Maps (maps.live.com)</h3>
<p>We are on the same area, somewhere in the downtown London again with Live Search Maps.</p>
<p><img class="inline" alt="Aerial" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image7.png" width="150" height="150" /> <a href="http://blog.burcudogan.com/wp-content/uploads/2009/04/image8.png"><img class="inline" alt="Hybrid" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb2.png" width="150" height="150" /></a> <img class="inline" title="Road Map" border="0" alt="image" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image9.png" width="150" height="150" /></p>
<p>Image sizes in the corresponding order are: 28.52KB (JPEG), 29.82KB (JPEG), 25.6KB (PNG). Repeating the same user actions above for a tile:</p>
<ol>
<li>Road imagery views: 25.6KB </li>
<li>A switch to labelled aerial: 29.82KB </li>
<li>A switch to aerial without labels: 28.52KB </li>
<li><strong>Total cost</strong> = 25.6KB + 29.82KB + 28.52KB = 83.94KB </li>
</ol>
<p>If every user were switching between these map modes back and forth on every zoom level, Google Maps would beat LSM with little difference*. Labels on aerial images don&#8217;t looks as sharp as Google&#8217;s, but keeps size in an appropriate level although it is encoded to be a JPEG. If users switches to non-labelled aerial very rarely, for example after pointing an area they are searching, this method might be practical and more efficient than Google&#8217;s overlaying concept. </p>
<p><img class="inline" title="LSM vs. Google Maps" border="0" alt="image" src="http://blog.burcudogan.com/wp-content/uploads/2009/04/image10.png" width="608" height="282" /> </p>
<p>Above, there are 200% zoomed versions of labelled aerial tiles from San Francisco. The left image comes from <a href="http://microsoft.com/virtualearth">Virtual Earth</a> and the other is Google&#8217;s. In my own personal opinion I find Google&#8217;s labels more readable than Virtual Earth&#8217;s, despite being 22-years-old and topping the heap when it comes to sensitivity in vision. </p>
<p>(*) Note: I repeated the process for 100+ random tiles. Ratios don&#8217;t seem to change much.</p>
<h5>Custom tiles?</h5>
<p>What about custom tile integration with Virtual Earth and Google Maps API? Google&#8217;s method allows you to overlay roads on your custom maps (didn&#8217;t check it, but it&#8217;s not a big deal &#8212; they already have isolated labels). </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/burcudo.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/burcudo.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/burcudo.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=burcudogan.com&#038;blog=21440216&#038;post=201&#038;subd=burcudo&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://burcudogan.com/2009/04/09/jpeg-to-compress-vector-graphics/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e7526ec3e801f8ba99f6746498a154a6?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">thejbf</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image.png" medium="image">
			<media:title type="html">Data vs. Information</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image3.png" medium="image">
			<media:title type="html">Aerial</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image4.png" medium="image">
			<media:title type="html">Labels</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image5.png" medium="image">
			<media:title type="html">Aerial with Labels</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb1.png" medium="image">
			<media:title type="html">Road Map</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image7.png" medium="image">
			<media:title type="html">Aerial</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image-thumb2.png" medium="image">
			<media:title type="html">Hybrid</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image9.png" medium="image">
			<media:title type="html">Road Map</media:title>
		</media:content>

		<media:content url="http://blog.burcudogan.com/wp-content/uploads/2009/04/image10.png" medium="image">
			<media:title type="html">LSM vs. Google Maps</media:title>
		</media:content>
	</item>
	</channel>
</rss>
