<?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>cat brain.log &#124; less &#187; mercator</title>
	<atom:link href="http://log.largevoid.com/tag/mercator/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Tue, 24 Aug 2010 00:16:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Log Math to Solve Iterative Problems</title>
		<link>http://log.largevoid.com/2009/11/using-log-math-to-solve-iterative-problems/</link>
		<comments>http://log.largevoid.com/2009/11/using-log-math-to-solve-iterative-problems/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 01:09:36 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[earth]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[mercator]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[projection]]></category>
		<category><![CDATA[viewport]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=134</guid>
		<description><![CDATA[Premise: You have a map of infinite resolution, but finite viewing space.  You have points on that map that have a fixed foot print.
Question: How much do you need to zoom before the points are clearly distinguishable?
Let us arbitrarily define the criteria for distinguishability as an icon of 25 pixels in size.  This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Premise</strong>: You have a map of infinite resolution, but finite viewing space.  You have points on that map that have a fixed foot print.</p>
<p><strong>Question</strong>: How much do you need to zoom before the points are clearly distinguishable?</p>
<p>Let us arbitrarily define the <em>criteria for distinguishability</em> as an icon of 25 pixels in size.  This icon, it can be said, has a radius of 13 pixels.  In reality, icon size is a function of your viewport&#8217;s size.  I leave that up to you to calculate.</p>
<p>Let us define the <em>scale of the map</em> as the absolute width of the map (in map units) divided by the width of the view port.  As an example, let&#8217;s use the Earth&#8217;s longitude range: -180 to +180 degrees, but in a global Mercator projection.  The coordinate range of longitude for this map is [-20037508,+20037508) meters.  Our viewport has a range of [0,255] pixels (viewport units).  The scale of this map in this viewport is (2*20037508)/256.  Be careful not to double-count +20037508, as -20037508 = +20037508 and would yield an improper scale.  The viewport size is an integer and does not wrap; there are no fractions of a pixel in a viewport.</p>
<p>We shall now define a <em>target scale</em>.  The target scale is the desired scale of the map that allows our icons to become viewable.  Our example will use buildings having a foot print of 300 meters (map units) in width and depth.  Our target scale, therefore, is 300/25 = 12 meters per pixel.</p>
<p><strong>Question</strong>: How much do we need to zoom in before our buildings are distinguishable?</p>
<p><strong>Implementation</strong> 1 (naive, iterative):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> zoomLevel<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$maprange</span><span style="color: #339933;">,</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">,</span> <span style="color: #000088;">$distFactor</span><span style="color: #339933;">=</span><span style="color:#800080;">0.10</span><span style="color: #339933;">,</span> <span style="color: #000088;">$zoomFactor</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// $viewport = 256;</span>
  <span style="color: #666666; font-style: italic;">// $maprange = 2*M_PI*6378137;</span>
  <span style="color: #000088;">$scale</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$maprange</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// 10% of viewport required to distinguish an icon.</span>
  <span style="color: #000088;">$target</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$distFactor</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$zoom</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$scale</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$target</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$zoom</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$scale</span> <span style="color: #339933;">/=</span> <span style="color: #000088;">$zoomFactor</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$zoom</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>Implementations</strong> 2, 3 and 4:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> zoomLevel<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$maprange</span><span style="color: #339933;">,</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">,</span> <span style="color: #000088;">$distFactor</span><span style="color: #339933;">=</span><span style="color:#800080;">0.10</span><span style="color: #339933;">,</span> <span style="color: #000088;">$zoomFactor</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$scale</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$maprange</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$target</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$distFactor</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$viewport</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// naive log</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$zoomFactor</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$zoomFactor</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// commutative log</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$zoomFactor</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// subtraction property of logs (best implementation)</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">ceil</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$scale</span><span style="color: #339933;">/</span><span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$zoomFactor</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2009/11/using-log-math-to-solve-iterative-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Projections with proj4</title>
		<link>http://log.largevoid.com/2009/11/mapping-projections-with-proj4/</link>
		<comments>http://log.largevoid.com/2009/11/mapping-projections-with-proj4/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 23:39:50 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[epsg]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[mercator]]></category>
		<category><![CDATA[ogc]]></category>
		<category><![CDATA[proj4]]></category>
		<category><![CDATA[wkt]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=120</guid>
		<description><![CDATA[EPSG:4326 &#8211; WGS84
OGC WKT
GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]]
proj4
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
[Unofficial] EPSG:900913 &#8211; Google Mercator 2008/Spherical
OGC WKT
PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown", SPHEROID["unnamed",6378137,0]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Mercator_2SP"], PARAMETER["standard_parallel_1",0], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1], EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"]]
proj4
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 [...]]]></description>
			<content:encoded><![CDATA[<h3>EPSG:4326 &#8211; WGS84</h3>
<h4>OGC WKT</h4>
<pre>GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]]</pre>
<h4>proj4</h4>
<pre>+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs</pre>
<h3>[Unofficial] EPSG:900913 &#8211; Google Mercator 2008/Spherical</h3>
<h4>OGC WKT</h4>
<pre>PROJCS["unnamed", GEOGCS["unnamed ellipse", DATUM["unknown", SPHEROID["unnamed",6378137,0]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Mercator_2SP"], PARAMETER["standard_parallel_1",0], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1], EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"]]</pre>
<h4>proj4</h4>
<pre>+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs</pre>
<h3>EPSG:32611 &#8211; WGS84 / UTM zone 11N</h3>
<h4>OGC WKT</h4>
<pre>PROJCS["WGS 84 / UTM zone 11N", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",-117], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","32611"]]</pre>
<h4>proj4</h4>
<pre>+proj=utm +zone=11 +ellps=WGS84 +datum=WGS84 +units=m +no_defs </pre>
<h3>EPSG:26944 &#8211; NAD83 / California zone 4</h3>
<h4>OGC WKT</h4>
<pre>PROJCS["NAD83 / California zone 4", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4269"]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["standard_parallel_1",37.25], PARAMETER["standard_parallel_2",36], PARAMETER["latitude_of_origin",35.33333333333334], PARAMETER["central_meridian",-119], PARAMETER["false_easting",2000000], PARAMETER["false_northing",500000], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","26944"]]</pre>
<h4>proj4</h4>
<pre>+proj=lcc +lat_1=37.25 +lat_2=36 +lat_0=35.33333333333334 +lon_0=-119 +x_0=2000000 +y_0=500000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs</pre>
<h3>EPSG:26965 &#8211; NAD83 / Hawaii zone 5</h3>
<h4>OGC WKT</h4>
<pre>PROJCS["NAD83 / Hawaii zone 5", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS 1980",6378137,298.257222101, AUTHORITY["EPSG","7019"]], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4269"]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",21.66666666666667], PARAMETER["central_meridian",-160.1666666666667], PARAMETER["scale_factor",1], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AUTHORITY["EPSG","26965"]]</pre>
<h4>proj4</h4>
<pre>+proj=tmerc +lat_0=21.66666666666667 +lon_0=-160.1666666666667 +k=1.000000 +x_0=500000 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs</pre>
<h3>EPSG:4135 &#8211; Old Hawaiian</h3>
<h4>OGC WKT</h4>
<pre>GEOGCS["Old Hawaiian", DATUM["Old_Hawaiian", SPHEROID["Clarke 1866",6378206.4,294.9786982138982, AUTHORITY["EPSG","7008"]], AUTHORITY["EPSG","6135"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.01745329251994328, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4135"]]</pre>
<h4>proj4</h4>
<pre>+proj=longlat +ellps=clrk66 +no_defs </pre>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2009/11/mapping-projections-with-proj4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: log.largevoid.com @ 2010-09-08 15:10:13 -->