<?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>mobile and gis dev notes &#187; mapserver</title>
	<atom:link href="http:///wordpress/category/gis-general/mapserver/feed/" rel="self" type="application/rss+xml" />
	<link>/wordpress</link>
	<description>by rupert</description>
	<lastBuildDate>Sun, 22 Jan 2012 04:34:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>iPhone Note #20:Integrating Mapserver/TileCache to RouteMe</title>
		<link>/wordpress/2010/01/iphone-note-20integrating-mapservertilecache-to-routeme/</link>
		<comments>/wordpress/2010/01/iphone-note-20integrating-mapservertilecache-to-routeme/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 01:37:57 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[route-me]]></category>

		<guid isPermaLink="false">/wordpress/?p=700</guid>
		<description><![CDATA[Below is a summary of how I was able to implement Mapserver, TileCache and Route-Me iPhone Mapping Framework. 1. Assuming you have a working Mapserver/TileCache setup. Take note of the ff parameters: resolution and bbox. Below is my tilecache.cfg: 61 [mapserver_australia_3857] 62 type=MapServerLayer 63 mapfile=/Users/rupert/projects/pelicancorp/DMOB/trunk/map/australia_3857.map 64 layers=all 65 extension=jpg 66 bbox=-20037508.34, -20037508.34, 20037508.34, 20037508.34 68 [...]]]></description>
			<content:encoded><![CDATA[<p>Below is a summary of how I was able to implement Mapserver, TileCache and Route-Me iPhone Mapping Framework. </p>
<p>1.  Assuming you have a <strong>working</strong> Mapserver/TileCache setup. Take note of the ff parameters: resolution and bbox. Below is my tilecache.cfg:</p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;"> 61 [mapserver_australia_3857]
 62 type=MapServerLayer
 63 mapfile=/Users/rupert/projects/pelicancorp/DMOB/trunk/map/australia_3857.map
 64 layers=all
 65 extension=jpg
 66 bbox=-20037508.34, -20037508.34, 20037508.34, 20037508.34
 68 maxResolution=156543.033928041
 70 levels=20
 71 srs=EPSG:3857
 72 tms_type=google
 73 extent_type=loose
 74 spherical_mercator=true</pre></div></div>

<p>2. Grab the RMGenericMercatorWMSSource from <a href="http://groups.google.com/group/route-me-map/browse_thread/thread/b58fa1d20cf15823/e30c42d9c90a8170?lnk=gst&#038;q=Generic#e30c42d9c90a8170">http://groups.google.com/group/route-me-map/browse_thread/thread/b58fa1d20cf15823/e30c42d9c90a8170?lnk=gst&#038;q=Generic#e30c42d9c90a8170</a></p>
<p>3. By default without any changes, the RMGenericMercatorWMSSource could display Mapserver WMS Tiles. This is possible by passing an NSDictionary *parameters, which contains arrayValues and arrayKeys for creating an http 256&#215;256 image request to the http://127.0.0.1/cgi-bin/mapserv binary.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//This would request to http://127.0.0.1/cgi-bin/mapserv</span>
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>arrayValues <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;/path-to/australia_3857.map&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;all&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;png&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;EPSG:3857&quot;</span>,<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>arrayKeys <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;MAP&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;LAYERS&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;FORMAT&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SRS&quot;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span>wmsParameters <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSDictionary</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span> arrayValues forKeys<span style="color: #002200;">:</span>arrayKeys <span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>Resulting http requests to the mapserv binary:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://192.168.1.193:81/tilecache/tilecache.py?LAYERS=australia_3857&amp;SRS=EPSG:3857&amp;REQUEST=GetMap&amp;SERVICE=WMS&amp;STYLES=&amp;EXCEPTIONS=application%2Fvnd.ogc.se_inimage&amp;FORMAT=png&amp;VERSION=1.1.1&amp;WIDTH=256&amp;HEIGHT=256&amp;BBOX=16828376.000000,-4006523.000000,16833268.000000,-4001631.000000</pre></div></div>

<p>Note that the bbox values does not contain decimal places. Nevertheless, it still works on Mapserver.</p>
<p>4. Now, assuming we have a valid tilecache running. And it is tested from browser, i.e http://127.0.0.1/map/tilecache_3857.html, open up firebug to see the requests. Below is a sample&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://192.168.1.193:81/tilecache/tilecache.py?LAYERS=australia_3857&amp;FORMAT=jpg&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;STYLES=&amp;EXCEPTIONS=application%2Fvnd.ogc.se_inimage&amp;SRS=EPSG%3A3857&amp;BBOX=16123932.497377,-4539747.9811239,16143500.376618,-4520180.1018829&amp;WIDTH=256&amp;HEIGHT=256</pre></div></div>

<p>But it seems, route-me is not supplying the bbox values accurately, as the decimal values is truncated (BBOX=16828376.000000,-4006523.000000,16833268.000000,-4001631.000000) from our previous request(3). </p>
<p>After changing the wmsParameter values to create a tilecache request, I noticed that route-me is not displaying the tiles correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//Testing for Windows:TileCache - ?</span>
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>arrayValues <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;australia_3857&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;png&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;EPSG:3857&quot;</span>,<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>; <span style="color: #11740a; font-style: italic;">//for WIndows</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//TileCache URL Parameters:</span>
<span style="color: #400080;">NSArray</span> <span style="color: #002200;">*</span>arrayKeys <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;LAYERS&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;FORMAT&quot;</span>, <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SRS&quot;</span>, <span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>5. The workaround is to use &#8220;double&#8221; instead of &#8220;floats&#8221; in the RMGenericMercatorWMSSource. You can download the zip from <a href="/wordpress/wp-content/uploads/2010/01/RMGenericMercatorWMSSource.zip" title="RMGenericMercatorWMSSource.zip">RMGenericMercatorWMSSource.zip</a>. I have modified &#8220;initialResolution&#8221; and &#8220;originShift&#8221; to both use <em>&#8220;double&#8221;</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">typedef</span> <span style="color: #a61390;">struct</span> <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">double</span> x;
	<span style="color: #a61390;">double</span> y;
<span style="color: #002200;">&#125;</span> CGDoublePoint;
&nbsp;
<span style="color: #a61390;">typedef</span> <span style="color: #a61390;">struct</span> <span style="color: #002200;">&#123;</span> 
	CGDoublePoint ul; 
	CGDoublePoint lr; 
<span style="color: #002200;">&#125;</span> CGXYRect;</pre></div></div>

<p>Afterwards, I copied the maxResolution and bbox (tilecache) and specified it for the initialResoultion and originShift respectively.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;RMGenericMercatorWMSSource.h&quot;</span>
&nbsp;
CGFloat DegreesToRadians<span style="color: #002200;">&#40;</span>CGFloat degrees<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><span style="color: #a61390;">return</span> degrees <span style="color: #002200;">*</span> M_PI <span style="color: #002200;">/</span> <span style="color: #2400d9;">180</span>;<span style="color: #002200;">&#125;</span>; 
CGFloat RadiansToDegrees<span style="color: #002200;">&#40;</span>CGFloat radians<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span><span style="color: #a61390;">return</span> radians <span style="color: #002200;">*</span> <span style="color: #2400d9;">180</span><span style="color: #002200;">/</span> M_PI;<span style="color: #002200;">&#125;</span>; 
&nbsp;
<span style="color: #a61390;">@implementation</span> RMGenericMercatorWMSSource
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">id</span><span style="color: #002200;">&#41;</span> initWithBaseUrl<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>baseUrl parameters<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>params
<span style="color: #002200;">&#123;</span> 
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">!</span><span style="color: #002200;">&#91;</span>super init<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> 
		<span style="color: #a61390;">return</span> <span style="color: #a61390;">nil</span>; 
&nbsp;
	<span style="color: #11740a; font-style: italic;">// 156543.03392804062 for sideLength 256 pixels </span>
	<span style="color: #11740a; font-style: italic;">// initialResolution = 2 * M_PI * 6378137 / [self tileSideLength];</span>
	<span style="color: #11740a; font-style: italic;">// specify here whatever the resolution is from tilecache.</span>
	initialResolution <span style="color: #002200;">=</span> <span style="color: #2400d9;">156543.033928041</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// 20037508.342789244 </span>
	<span style="color: #11740a; font-style: italic;">//originShift = 2 * M_PI * 6378137 / 2;</span>
	<span style="color: #11740a; font-style: italic;">//originShift = 20037508.342789244f;</span>
	<span style="color: #11740a; font-style: italic;">// specify here whatever the bbox is from tilecache.</span>
	originShift <span style="color: #002200;">=</span> <span style="color: #2400d9;">20037508.32</span>;
&nbsp;
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;test initialResolution:%f originShift:%f&quot;</span>, initialResolution, originShift<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// setup default parameters</span>
	<span style="color: #11740a; font-style: italic;">// use official EPSG:3857 by default, user can override to 900913 if needed.</span>
	wmsParameters <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableDictionary</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;EPSG:3857&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;image/png&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;GetMap&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;1.1.1&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;WMS&quot;</span>,<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span> 
											  forKeys<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSArray</span> alloc<span style="color: #002200;">&#93;</span> initWithObjects<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SRS&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;FORMAT&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;REQUEST&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;VERSION&quot;</span>,<span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;SERVICE&quot;</span>,<span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>wmsParameters addEntriesFromDictionary<span style="color: #002200;">:</span>params<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// build WMS request URL template</span>
	urlTemplate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithString<span style="color: #002200;">:</span>baseUrl<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSEnumerator</span> <span style="color: #002200;">*</span>e <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>wmsParameters keyEnumerator<span style="color: #002200;">&#93;</span>;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>key;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>delimiter <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&quot;</span>;
	<span style="color: #a61390;">while</span> <span style="color: #002200;">&#40;</span>key <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>e nextObject<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		urlTemplate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>urlTemplate stringByAppendingFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@%@=%@&quot;</span>,
					   delimiter,
					   <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>key uppercaseString<span style="color: #002200;">&#93;</span> stringByAddingPercentEscapesUsingEncoding<span style="color: #002200;">:</span>NSASCIIStringEncoding<span style="color: #002200;">&#93;</span>, 
					   <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>wmsParameters objectForKey<span style="color: #002200;">:</span>key<span style="color: #002200;">&#93;</span> stringByAddingPercentEscapesUsingEncoding<span style="color: #002200;">:</span>NSASCIIStringEncoding<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
		delimiter <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&amp;&quot;</span>;
	<span style="color: #002200;">&#125;</span>
	<span style="color: #a61390;">int</span> sideLength <span style="color: #002200;">=</span>  <span style="color: #002200;">&#91;</span>self tileSideLength<span style="color: #002200;">&#93;</span>;
	urlTemplate <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>urlTemplate stringByAppendingFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&amp;WIDTH=%d&amp;HEIGHT=%d&quot;</span>,sideLength,sideLength<span style="color: #002200;">&#93;</span> retain<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> self;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// implement in subclass?</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> uniqueTilecacheKey
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;AbstractMercatorWMSSource&quot;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>shortName
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Generic WMS Source&quot;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>longDescription
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Generic WMS Source&quot;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>shortAttribution
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Generic WMS Source&quot;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>longAttribution
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Generic WMS Source&quot;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">float</span><span style="color: #002200;">&#41;</span> minZoom
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> 1.0f;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">float</span><span style="color: #002200;">&#41;</span> maxZoom
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> 19.0f;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">// Converts given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:3857 </span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>CGPoint<span style="color: #002200;">&#41;</span> LatLonToMeters<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>CLLocationCoordinate2D<span style="color: #002200;">&#41;</span> latlon 
<span style="color: #002200;">&#123;</span> 
	CGPoint meters; 
	meters.x <span style="color: #002200;">=</span> latlon.longitude <span style="color: #002200;">*</span> originShift <span style="color: #002200;">/</span> <span style="color: #2400d9;">180</span>; 
	meters.y <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">log</span><span style="color: #002200;">&#40;</span> <span style="color: #a61390;">tan</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span><span style="color: #2400d9;">90.0</span> <span style="color: #002200;">+</span> latlon.latitude<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> M_PI <span style="color: #002200;">/</span> <span style="color: #2400d9;">360.0</span> <span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">/</span> <span style="color: #002200;">&#40;</span>M_PI <span style="color: #002200;">/</span> <span style="color: #2400d9;">180.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> originShift <span style="color: #002200;">/</span> <span style="color: #2400d9;">180</span>; 
	<span style="color: #a61390;">return</span> meters; 
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//Converts XY point from Spherical Mercator EPSG:3857 to lat/lon in WGS84 Datum </span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>CLLocationCoordinate2D<span style="color: #002200;">&#41;</span> MetersToLatLon<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>CGPoint<span style="color: #002200;">&#41;</span> meters 
<span style="color: #002200;">&#123;</span> 
	CLLocationCoordinate2D latlon; 
	latlon.longitude <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>meters.x <span style="color: #002200;">/</span> originShift<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #2400d9;">180.0</span>; 
	latlon.latitude <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>meters.y <span style="color: #002200;">/</span> originShift<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> <span style="color: #2400d9;">180.0</span>; 
	<span style="color: #11740a; font-style: italic;">//latlon.latitude = - 180 / M_PI * (2 * atan( exp( latlon.latitude * M_PI / 180.0)) - M_PI / 2.0); </span>
	latlon.latitude <span style="color: #002200;">=</span> <span style="color: #2400d9;">180</span> <span style="color: #002200;">/</span> M_PI <span style="color: #002200;">*</span> <span style="color: #002200;">&#40;</span><span style="color: #2400d9;">2</span> <span style="color: #002200;">*</span> <span style="color: #a61390;">atan</span><span style="color: #002200;">&#40;</span> <span style="color: #a61390;">exp</span><span style="color: #002200;">&#40;</span> latlon.latitude <span style="color: #002200;">*</span> M_PI <span style="color: #002200;">/</span> <span style="color: #2400d9;">180.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">-</span> M_PI <span style="color: #002200;">/</span> <span style="color: #2400d9;">2.0</span><span style="color: #002200;">&#41;</span>; 
	<span style="color: #a61390;">return</span> latlon; 
<span style="color: #002200;">&#125;</span> 
&nbsp;
<span style="color: #11740a; font-style: italic;">// Converts pixel coordinates in given zoom level of pyramid to EPSG:3857 </span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>CGDoublePoint<span style="color: #002200;">&#41;</span> PixelsToMeters<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> px PixelY<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>py atZoom<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span>zoom 
<span style="color: #002200;">&#123;</span> 
	<span style="color: #a61390;">double</span> resolution <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self ResolutionAtZoom<span style="color: #002200;">:</span> zoom<span style="color: #002200;">&#93;</span>; 
	CGDoublePoint meters; 
	<span style="color: #a61390;">double</span> x <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>px <span style="color: #002200;">*</span> resolution <span style="color: #002200;">-</span> originShift<span style="color: #002200;">&#41;</span>; 
	<span style="color: #a61390;">double</span> y <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>py <span style="color: #002200;">*</span> resolution <span style="color: #002200;">-</span> originShift<span style="color: #002200;">&#41;</span>; 
&nbsp;
	meters.x <span style="color: #002200;">=</span> x;
	meters.y <span style="color: #002200;">=</span> y;
&nbsp;
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;px: %d py: %d resolution: %f originShift: %f x: %f y: %f&quot;</span>, px, py, resolution, originShift, x, y<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> meters; 
<span style="color: #002200;">&#125;</span> 
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> tileURL<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>RMTile<span style="color: #002200;">&#41;</span> tile 
<span style="color: #002200;">&#123;</span> 
	<span style="color: #11740a; font-style: italic;">//RMLatLongBounds tileBounds = [self TileLatLonBounds:tile];</span>
	<span style="color: #11740a; font-style: italic;">// Get BBOX coordinates in meters</span>
	CGXYRect tileBounds <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self TileBounds<span style="color: #002200;">:</span>tile<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>urlTemplate stringByAppendingFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&amp;BBOX=%f,%f,%f,%f&quot;</span>,
					 tileBounds.ul.x,
					 tileBounds.lr.y,
					 tileBounds.lr.x,
					 tileBounds.ul.y<span style="color: #002200;">&#93;</span>;
&nbsp;
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Tile %d,%d,%d yields %@&quot;</span>,tile.zoom, tile.x, tile.y, url<span style="color: #002200;">&#41;</span>; 
&nbsp;
	<span style="color: #a61390;">return</span> url; 
<span style="color: #002200;">&#125;</span> 
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//Returns bounds of the given tile in EPSG:3857 coordinates </span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span>CGXYRect<span style="color: #002200;">&#41;</span>  TileBounds<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>RMTile<span style="color: #002200;">&#41;</span> tile 
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">int</span> sideLength <span style="color: #002200;">=</span>  <span style="color: #002200;">&#91;</span>self tileSideLength<span style="color: #002200;">&#93;</span>;
&nbsp;
	<span style="color: #a61390;">int</span> zoom <span style="color: #002200;">=</span> tile.zoom;
	<span style="color: #a61390;">long</span> twoToZoom <span style="color: #002200;">=</span> <span style="color: #a61390;">pow</span><span style="color: #002200;">&#40;</span><span style="color: #2400d9;">2</span>,zoom<span style="color: #002200;">&#41;</span>;
	CGXYRect tileBounds; 
	tileBounds.ul <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self PixelsToMeters<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span>tile.x <span style="color: #002200;">*</span> sideLength<span style="color: #002200;">&#41;</span> 
								  PixelY<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>twoToZoom<span style="color: #002200;">-</span>tile.y<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> sideLength<span style="color: #002200;">&#41;</span> 
								  atZoom<span style="color: #002200;">:</span> zoom <span style="color: #002200;">&#93;</span>; 
	tileBounds.lr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self PixelsToMeters<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>tile.x<span style="color: #002200;">+</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> sideLength<span style="color: #002200;">&#41;</span> 
								  PixelY<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#40;</span>twoToZoom<span style="color: #002200;">-</span>tile.y<span style="color: #002200;">-</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> sideLength<span style="color: #002200;">&#41;</span> 
								  atZoom<span style="color: #002200;">:</span> zoom<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> tileBounds; 
<span style="color: #002200;">&#125;</span> 
&nbsp;
<span style="color: #11740a; font-style: italic;">//Resolution (meters/pixel) for given zoom level (measured at Equator) </span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">double</span><span style="color: #002200;">&#41;</span> ResolutionAtZoom <span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> zoom 
<span style="color: #002200;">&#123;</span> 
	<span style="color: #a61390;">return</span> initialResolution <span style="color: #002200;">/</span> <span style="color: #a61390;">pow</span><span style="color: #002200;">&#40;</span><span style="color: #2400d9;">2</span>,zoom<span style="color: #002200;">&#41;</span>; 
<span style="color: #002200;">&#125;</span> 
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>6. Download <a href="/wordpress/wp-content/uploads/2010/01/TileCache_RouteMe.zip" title="TileCache_RouteMe.zip">TileCache_RouteMe.zip</a> Note: You need a valid mapserver and tilecache running.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2010/01/iphone-note-20integrating-mapservertilecache-to-routeme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Mapserver on MacOSX (by source)</title>
		<link>/wordpress/2008/07/installing-mapserver-on-macosx-by-source/</link>
		<comments>/wordpress/2008/07/installing-mapserver-on-macosx-by-source/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 02:03:16 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[leopard]]></category>

		<guid isPermaLink="false">/wordpress/?p=195</guid>
		<description><![CDATA[Just noticed that William of kyngchaos has updated the mapserver binary for MacOSX. But right now, I need to tile these images bought from GeoEye, so I need TIFF support. Below is a summary of getting Mapserver installed by source. Note that I have the necessary GEOS, GDAL from kyngchaos as well from this ealier [...]]]></description>
			<content:encoded><![CDATA[<p>Just noticed that <a href="http://www.kyngchaos.com/wiki/software:mapserver">William of kyngchaos has updated the mapserver binary</a> for MacOSX.</p>
<p>But right now, I need to tile these images bought from GeoEye, so I need TIFF support. Below is a summary of getting Mapserver installed by source. Note that I have the necessary GEOS, GDAL from kyngchaos as well from this ealier post.</p>
<p>1. Download the ff files:<br />
<code>-rw-r--r--@ 1 rupert  admin   564313 Jul 26 10:32 agg-2.5.tar.gz<br />
-rw-r--r--@ 1 rupert  admin  1345700 Jul 26 10:22 gd-2.0.35.tar.gz<br />
-rw-r--r--@ 1 rupert  admin   613261 Jul 26 10:22 jpegsrc.v6b.tar.gz<br />
-rw-r--r--@ 1 rupert  admin   796551 Jul 26 10:22 libpng-1.2.29.tar.gz<br />
-rw-r--r--@ 1 rupert  admin  1948751 Jul 26 09:55 mapserver-5.2.0.tar.gz<br />
-rw-r--r--@ 1 rupert  admin  1336295 Jul 26 11:11 tiff-3.8.2.tar.gz</code></p>
<p>2. Install in the ff order:</p>
<p>- <a href="http://www.sfr-fresh.com/unix/misc/jpegsrc.v6b.tar.gz">jpegsrc</a><br />
- <a href="http://libpng.sourceforge.net/">libpng</a><br />
- <a href="http://www.libgd.org/Downloads">gd</a> (if you have trouble installing gd, then follow this pdf:<a href='/wordpress/wp-content/uploads/2008/07/installing_gd2_on_os_x_server.pdf'>installing_gd2_on_os_x_server</a>)<br />
- <a href="http://www.antigrain.com/agg-2.5.tar.gz">agg</a> (<em>make</em> only)<br />
- <a href="http://www.libtiff.org/">tiff</a><br />
- mapserver</p>
<p>3. For mapserver, please install using the ff configure switches:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure \
<span style="color: #660033;">--with-agg</span>=<span style="color: #000000; font-weight: bold;">/</span>myhome<span style="color: #000000; font-weight: bold;">/</span>rupert<span style="color: #000000; font-weight: bold;">/</span>mapserver<span style="color: #000000; font-weight: bold;">/</span>agg-<span style="color: #000000;">2.5</span> \
<span style="color: #660033;">--with-jpeg</span> \
<span style="color: #660033;">--with-gd</span> \
<span style="color: #660033;">--with-freetype</span> \
<span style="color: #660033;">--with-png</span> \
<span style="color: #660033;">--with-ogr</span> \
<span style="color: #660033;">--with-proj</span> \
<span style="color: #660033;">--with-gd</span> \
<span style="color: #660033;">--with-httpd</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>httpd \
<span style="color: #660033;">--with-tiff</span> \
<span style="color: #660033;">--with-wfs</span> \
<span style="color: #660033;">--with-wcs</span> \
<span style="color: #660033;">--with-sos</span> \
<span style="color: #660033;">--with-wmsclient</span> \
<span style="color: #660033;">--with-wfsclient</span> \
<span style="color: #660033;">--with-tiff</span> \
<span style="color: #660033;">--with-gdal</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gdal<span style="color: #000000; font-weight: bold;">/</span>gdal-config \
<span style="color: #660033;">--with-geos</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>geos-config \
<span style="color: #660033;">--with-postgis</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>pgsql<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pg_config</pre></div></div>

<p>4. Mapserver output</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rupert:mapserver-5.2.0 rupert$ .<span style="color: #000000; font-weight: bold;">/</span>mapserv <span style="color: #660033;">-v</span>
MapServer version 5.2.0 <span style="color: #007800;">OUTPUT</span>=GIF <span style="color: #007800;">OUTPUT</span>=PNG <span style="color: #007800;">OUTPUT</span>=JPEG <span style="color: #007800;">OUTPUT</span>=WBMP <span style="color: #007800;">OUTPUT</span>=SVG <span style="color: #007800;">SUPPORTS</span>=PROJ <span style="color: #007800;">SUPPORTS</span>=AGG <span style="color: #007800;">SUPPORTS</span>=FREETYPE <span style="color: #007800;">SUPPORTS</span>=ICONV <span style="color: #007800;">SUPPORTS</span>=WMS_SERVER <span style="color: #007800;">SUPPORTS</span>=WMS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WFS_SERVER <span style="color: #007800;">SUPPORTS</span>=WFS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WCS_SERVER <span style="color: #007800;">SUPPORTS</span>=SOS_SERVER <span style="color: #007800;">SUPPORTS</span>=GEOS <span style="color: #007800;">INPUT</span>=TIFF <span style="color: #007800;">INPUT</span>=EPPL7 <span style="color: #007800;">INPUT</span>=POSTGIS <span style="color: #007800;">INPUT</span>=OGR <span style="color: #007800;">INPUT</span>=GDAL <span style="color: #007800;">INPUT</span>=SHAPEFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/07/installing-mapserver-on-macosx-by-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Mapserver on MacOSX Leopard (the easy way)</title>
		<link>/wordpress/2008/05/installing-mapserver-on-macosx-leopard-the-easy-way/</link>
		<comments>/wordpress/2008/05/installing-mapserver-on-macosx-leopard-the-easy-way/#comments</comments>
		<pubDate>Tue, 06 May 2008 13:01:09 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[leopard]]></category>

		<guid isPermaLink="false">/wordpress/?p=178</guid>
		<description><![CDATA[The easiest way to install mapserver on your Leopard is by downloading and installing dmg files from www.kyngchaos.com (courtesy of William Kyngesburye). These binaries were also noted from Mapserver&#8217;s Download Page. 1. Download the ff binaries in order (please note the version numbers at the time of writing): 1. UnixImageIO_Framework-1.0.22a.dmg 2. FreeType_Framework-2.3.5-3.dmg 3. GEOS_Framework-3.0.0-2.dmg 4. [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way to install mapserver on your Leopard is by downloading and installing dmg files from <a href="http://http://www.kyngchaos.com/wiki/software:mapserver">www.kyngchaos.com (courtesy of William Kyngesburye)</a>. These binaries were also noted from <a href="http://mapserver.gis.umn.edu/download/current">Mapserver&#8217;s Download Page.</a></p>
<p>1. Download the ff binaries in order (please note the version numbers at the time of writing):</p>
<p>1. <a href="http://www.kyngchaos.com/files/software/unixport/UnixImageIO_Framework-1.0.22a.dmg">UnixImageIO_Framework-1.0.22a.dmg</a><br />
2. <a href="http://www.kyngchaos.com/files/software/unixport/FreeType_Framework-2.3.5-3.dmg">FreeType_Framework-2.3.5-3.dmg</a><br />
3. <a href="http://www.kyngchaos.com/files/software/unixport/GEOS_Framework-3.0.0-2.dmg">GEOS_Framework-3.0.0-2.dmg</a><br />
4. <a href="http://www.kyngchaos.com/files/software/unixport/PROJ_Framework-4.6.0-1.dmg">PROJ_Framework-4.6.0-1.dmg</a><br />
5. <a href="http://www.kyngchaos.com/files/software/unixport/SQLite3_Framework-3.5.7-1.dmg">SQLite3_Framework-3.5.7-1.dmg</a><br />
6. <a href="http://www.kyngchaos.com/files/software/unixport/MapServer-5.0.2-2.dmg">MapServer-5.0.2-2.dmg</a></p>
<p>2. Once installed, you can copy the mapserv binaries to your apache cgi-bin</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>WebServer<span style="color: #000000; font-weight: bold;">/</span>CGI-Executables<span style="color: #000000; font-weight: bold;">/</span>mapserv <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>3. Check the mapserv output</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rupert:~ rupert$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>mapserv <span style="color: #660033;">-v</span>
MapServer version 5.0.2 <span style="color: #007800;">OUTPUT</span>=GIF <span style="color: #007800;">OUTPUT</span>=PNG <span style="color: #007800;">OUTPUT</span>=JPEG <span style="color: #007800;">OUTPUT</span>=WBMP <span style="color: #007800;">OUTPUT</span>=SWF <span style="color: #007800;">OUTPUT</span>=SVG <span style="color: #007800;">SUPPORTS</span>=PROJ <span style="color: #007800;">SUPPORTS</span>=AGG <span style="color: #007800;">SUPPORTS</span>=FREETYPE <span style="color: #007800;">SUPPORTS</span>=WMS_SERVER <span style="color: #007800;">SUPPORTS</span>=WMS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WFS_SERVER <span style="color: #007800;">SUPPORTS</span>=WFS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WCS_SERVER <span style="color: #007800;">SUPPORTS</span>=SOS_SERVER <span style="color: #007800;">SUPPORTS</span>=FASTCGI <span style="color: #007800;">SUPPORTS</span>=GEOS <span style="color: #007800;">INPUT</span>=EPPL7 <span style="color: #007800;">INPUT</span>=POSTGIS <span style="color: #007800;">INPUT</span>=OGR <span style="color: #007800;">INPUT</span>=GDAL <span style="color: #007800;">INPUT</span>=SHAPEFILE</pre></div></div>

<p>This is actually the first time I was able to install mapserver NOT BY SOURCE and still achieve the same binaries that I wanted (with AGG support). Full credit should be given to William.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/05/installing-mapserver-on-macosx-leopard-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using TileCache, OpenLayers, Mapserver for Projection 900913</title>
		<link>/wordpress/2008/04/using-tilecache-openlayers-mapserver-for-projection-900913/</link>
		<comments>/wordpress/2008/04/using-tilecache-openlayers-mapserver-for-projection-900913/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 01:50:12 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[tilecache]]></category>

		<guid isPermaLink="false">http://www.gisnotes.com/wordpress/?p=166</guid>
		<description><![CDATA[I had a few problems with TileCache the other week which I am eager to blog about, since I knew for sure that later on, I might encounter the same. I don&#8217;t have the exact errors with me right now, so I&#8217;m jotting this down from my head&#8230; Classic Resolutions problem. Use extent_type=loose Can not [...]]]></description>
			<content:encoded><![CDATA[<p>I had a few problems with <a href="www.tilecache.org">TileCache</a> the other week which I am eager to blog about, since I knew for sure that later on, I might encounter the same. I don&#8217;t have the exact errors with me right now, so I&#8217;m jotting this down from my head&#8230;</p>
<ol>
<li>Classic Resolutions problem. Use extent_type=loose</li>
<li>Can not set image type</li>
</ol>
<p>UPDATED (JAN 11, 2010): Classic Resolutions problem:</p>
<p>How are resolutions calculated? Assuming we have:</p>
<p>Original:<br />
	Lower Left (LL) or minx, miny: 12453557, -5434940<br />
	Upper Right (UR) or max, maxy: 16980842, -1180729</p>
<p>maxResolution = (max &#8211; minx)/tilesize = (16980842 &#8211; 12453557)/512 = 8842.353<br />
	where tilesize = 512.</p>
<p>Therefore, we can set/guess for max so that we have maxResolution as a whole number.</p>
<p>Adjusted:<br />
	minx, miny: 12453557, -5434940<br />
	maxx, maxy: 16980661, -1180729</p>
<p>gives a maxResolution (whole number) of 8842.</p>
<p>Now, you can use 8842 in both the TileCache.cfg and OpenLayers Javascript.<span id="more-166"></span><br />
<strong>A. Google BaseLayer + Road WMS Overlay = Validation approach before we proceed to TC.</strong></p>
<p>1. OpenLayers (OL) Code: <a href="http://www.gisnotes.com/platform/docs/examples/GoogleWMSRoads.cfm">http://www.gisnotes.com/platform/docs/examples/GoogleWMSRoads.cfm</a></p>
<p>2. Map File Configuration: <code>/home/map/beijing/new/beijing_google_roads</code></p>
<p>Well the above files are not exactly for TC, but it is a good demonstration that we could overlay our custom layers (WMS) on top of Google as the base layer. For a more detailed explanation regarding Google + OL, please read my previous <a href="/wordpress/index.php/2007/12/22/openlayers-google-spherical-mercator-example/">gisnote</a>. Also, this is a good test to see if our <a href="">Mapserver <em>mapfile</em> configuration</a> is correct. I do suggest not to proceed with OL + TC not unless you have validated the mapfile through OL (Google + WMS).</p>
<p><strong>B. Google900913 Tilecache as baselayer</strong></p>
<p>Ok.. so here it is..</p>
<p>1. OpenLayers Code: <a href="http://www.gisnotes.com/platform/docs/examples/TilecacheGoogle900913Base.cfm">http://www.gisnotes.com/platform/docs/examples/TilecacheGoogle900913Base.cfm</a></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">        window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
                        projection<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> OpenLayers.<span style="color: #660066;">Projection</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;EPSG:900913&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                        units<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;m&quot;</span><span style="color: #339933;">,</span>
&nbsp;
                        <span style="color: #006600; font-style: italic;">//maxResolution: 156543.0339,</span>
                        resolutions <span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">156543.03390000001</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">78271.516950000005</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">39135.758475000002</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">19567.879237500001</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9783.9396187500006</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4891.9698093750003</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2445.9849046875001</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1222.9924523437501</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">611.49622617187504</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">305.74811308593752</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">152.87405654296876</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">76.43702827148438</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">38.21851413574219</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">19.109257067871095</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">9.5546285339355475</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4.7773142669677737</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2.3886571334838869</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1.1943285667419434</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.59716428337097172</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0.29858214168548586</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
                        <span style="color: #006600; font-style: italic;">//zoom: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] @ numZoomLevels: 20</span>
                        numZoomLevels<span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>
                        <span style="color: #006600; font-style: italic;">//maxExtent: new OpenLayers.Bounds(12823075.86334, 4800551.12375, 13101918.14248, 5021301.26141)</span>
                        <span style="color: #006600; font-style: italic;">//maxExtent: new OpenLayers.Bounds(12823075, 4800551, 13101918, 5021301)</span>
                        <span style="color: #006600; font-style: italic;">//maxExtent: new OpenLayers.Bounds(12848138, 4785083, 13080212, 5021118.5)</span>
                        maxExtent<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> OpenLayers.<span style="color: #660066;">Bounds</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">20037508</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">20037508</span><span style="color: #339933;">,</span><span style="color: #CC0000;">20037508</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">20037508.34</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
            OpenLayers.<span style="color: #660066;">IMAGE_RELOAD_ATTEMPTS</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span>
            OpenLayers.<span style="color: #660066;">Util</span>.<span style="color: #660066;">onImageLoadErrorColor</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;transparent&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            map <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> OpenLayers.<span style="color: #660066;">Map</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mapdiv'</span><span style="color: #339933;">,</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #003366; font-weight: bold;">var</span> serverURL <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;/tilecache/tilecache.py&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #006600; font-style: italic;">// start custom layer here</span>
            <span style="color: #003366; font-weight: bold;">var</span> layer_obj <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> OpenLayers.<span style="color: #660066;">Layer</span>.<span style="color: #660066;">WMS</span><span style="color: #009900;">&#40;</span>
                <span style="color: #3366CC;">&quot;Beijing&quot;</span><span style="color: #339933;">,</span>
                serverURL<span style="color: #339933;">,</span>
                <span style="color: #009900;">&#123;</span>
                    layers<span style="color: #339933;">:</span> <span style="color: #3366CC;">'beijing_900913'</span><span style="color: #339933;">,</span>
                    map<span style="color: #339933;">:</span> <span style="color: #3366CC;">'/home/map/beijing/new/beijing_900913/beijing.map'</span><span style="color: #339933;">,</span>
                    format<span style="color: #339933;">:</span> <span style="color: #3366CC;">'image/jpg'</span><span style="color: #339933;">,</span>
                    <span style="color: #3366CC;">'transparent'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'off'</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            layer_obj.<span style="color: #660066;">setIsBaseLayer</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            layer_obj.<span style="color: #660066;">setVisibility</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            map.<span style="color: #660066;">addLayer</span><span style="color: #009900;">&#40;</span>layer_obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>2. TileCache Configuration: /wwwroot/tilecache/tilecache.cfg</p>

<div class="wp_syntax"><div class="code"><pre class="cnf" style="font-family:monospace;">[beijing_900913]
type=WMSLayer
url=http://127.0.0.1/cgi-bin/mapserv?map=/home/map/beijing/new/beijing_900913/beijing.map
layers=beijing_900913
metatile=true
extension=jpg
levels=20
resolutions=156543.03390000001, 78271.516950000005, 39135.758475000002, 19567.879237500001, 9783.9396187500006, 4891.9698093750003, 2445.9849046875001, 1222.9924523437501, 611.49622617187504, 305.74811308593752, 152.87405654296876, 76.43702827148438, 38.21851413574219, 19.109257067871095, 9.5546285339355475, 4.7773142669677737, 2.3886571334838869, 1.1943285667419434, 0.59716428337097172, 0.29858214168548586
srs=EPSG:900913
bbox=-20037508, -20037508, 20037508, 20037508.34
#maxResolution=156543.0339
extent_type=loose
debug=on</pre></div></div>

<p>You can either set resolutions or maxResolutions. I always wanted to be explicit, so setting the <strong>resolutions</strong> is my preference.</p>
<p>3. MapFile Configuration: <code>/home/map/beijing/new/beijing_900913/beijing.map</code><br />
I have a long mapfile, and using <a href="http://mapserver.gis.umn.edu/docs/reference/mapfile/Include">includes</a> helped a lot, see my previous <a href="/wordpress/index.php/2007/08/19/103/">gisnote</a>.  For debugging your mapfile, read this <a href="/wordpress/index.php/2007/08/24/mapserver-debug-output/">post.</a></p>
<p><strong>Always Remember&#8230;I believe when they made TC, I presume they always tested on WGS84(lonlat), this means if you don&#8217;t set anything explicit, it would <em>implicitly</em> set settings in WGS84(lon/lat)&#8230;</strong></p>
<ul>
<li>Ensure that you have the vector data in the necessary projection, in my case it&#8217;s 900913.</li>
<p><br/> </p>
<li>Ensure that the <em>resolutions</em> from OL (B.1) is reflected in TC configuration (B.2).</li>
<p><br/></p>
<li>Ensure that the <em>maxextents</em> from OL (B.1) is reflected in TC configuration (B.2) as <em>bbox</em>.</li>
<p><br/>
</ul>
<p><strong>C. Still can&#8217;t get it running?</strong></p>
<p>1. Narrow down the error.</p>
<p>2. <strong>tail -f /var/log/apache2/error.log</strong> and <strong>access.log</strong> is your bestfriend. It&#8217;s a good starting point to trace down what went wrong.  If you can&#8217;t see it from Apache&#8217;s error.log then ensure that <a href="/wordpress/index.php/2007/07/25/installing-tilecache/">python debugging is turned on.</a></p>
<p>3. Sometimes TC <strong>[a]</strong> gives you an obvious error or <strong>[b]</strong> its just a link to the mapserv request. </p>
<p>Examples of <strong>[a]</strong>:</p>
<ul>
<li><em>Classic Resolution problem stated above. </em>- If you followed my final notes above, then this should not happen. If you&#8217;ve set up things correctly but it&#8217;s still broken and you want to pull your hair out, then do a clean test stated below in D.</li>
<li><em>Cannot set image type</em> &#8211; Check the extensions from the mapfile and TC config. Are they both in jpg&#8217;s?</li>
</ul>
<p>The latter <strong>[b]</strong> is harder to debug. Most likely its a mapserver mapfile mishap and the easiest way to hunt this down is only thru your error.log (note: you need mapserver to have a debug=true when you compiled it, that&#8217;s another story.)</p>
<p><strong>D. Doing a clean test as always</strong><br />
1. Always disable any caching when testing. Disable cache from your browser, for FF I use the webdeveloper toolbar. It&#8217;s as easy as Disable -> Disable Cache.</p>
<p>2. Stop/Start Apache. Hoping Python get&#8217;s a clean start as well. If you found any pyc (python compiled) under TC source directory&#8230; then stop Apache; remove the pycs; start Apache.</p>
<p>3. Seeing the same images? Always remove the image caches! rm -Rf /data/tilecache/beijing_900913</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/04/using-tilecache-openlayers-mapserver-for-projection-900913/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Mapserver on Debian (reprise)</title>
		<link>/wordpress/2008/03/installing-mapserver-on-debian-reprise/</link>
		<comments>/wordpress/2008/03/installing-mapserver-on-debian-reprise/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 11:31:43 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mapserver]]></category>

		<guid isPermaLink="false">http://www.gisnotes.com/wordpress/index.php/2008/03/28/installing-mapserver-on-debian-reprise/</guid>
		<description><![CDATA[As noted from my previous blog post regarding Mapserver on Debian, you don&#8217;t get AGG with Mapserver when installing directly from Debian packages. Thus, it would be better to install Mapserver by source. However, debian still helps because it would install all the necessary libraries needed for compiling mapserver. ./configure \ --with-agg \ --with-jpeg \ [...]]]></description>
			<content:encoded><![CDATA[<p>As noted from my <a href="/wordpress/index.php/2007/08/01/debian-howto-installing-mapserver/">previous blog post regarding Mapserver on Debian</a>, you don&#8217;t get AGG with Mapserver when installing directly from Debian packages. Thus, it would be better to <a href="http://mapserver.gis.umn.edu/download/current">install Mapserver by source.</a> However, debian still helps because it would install all the necessary libraries needed for compiling mapserver.<span id="more-165"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure \
<span style="color: #660033;">--with-agg</span> \
<span style="color: #660033;">--with-jpeg</span> \
<span style="color: #660033;">--with-gd</span> \
<span style="color: #660033;">--with-freetype</span> \
<span style="color: #660033;">--with-png</span> \
<span style="color: #660033;">--with-ogr</span> \
<span style="color: #660033;">--with-proj</span> \
<span style="color: #660033;">--with-gdal</span> \
<span style="color: #660033;">--with-httpd</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 \
<span style="color: #660033;">--with-tiff</span> \
<span style="color: #660033;">--with-wfs</span> \
<span style="color: #660033;">--with-wcs</span> \
<span style="color: #660033;">--with-threads</span> \
<span style="color: #660033;">--with-wmsclient</span> \
<span style="color: #660033;">--with-wfsclient</span> \
<span style="color: #660033;">--with-geos</span> \
<span style="color: #660033;">--with-postgis</span> \
<span style="color: #660033;">--enable-debug</span></pre></div></div>

<p>When I started installing yesterday, I did not know which packages/libraries are installed in my box. I dove off immediately by running my configure.sh above and received an error: <font color="red"><code>Could not find gd.h or libgd.a/libgd.so in /usr/local..</code></font></p>
<p>The best way to figure out if you&#8217;re ready is reading thru the <em>configure</em> output.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">checking <span style="color: #000000; font-weight: bold;">for</span> gcc... <span style="color: #c20cb9; font-weight: bold;">gcc</span>
checking <span style="color: #000000; font-weight: bold;">for</span> C compiler default output <span style="color: #c20cb9; font-weight: bold;">file</span> name... a.out
checking whether the C compiler works... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking whether we are cross compiling... no
checking <span style="color: #000000; font-weight: bold;">for</span> suffix of executables...
checking <span style="color: #000000; font-weight: bold;">for</span> suffix of object files... o
checking whether we are using the GNU C compiler... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking whether <span style="color: #c20cb9; font-weight: bold;">gcc</span> accepts -g... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> option to accept ANSI C... none needed
checking <span style="color: #000000; font-weight: bold;">for</span> g++... <span style="color: #c20cb9; font-weight: bold;">g++</span>
checking whether we are using the GNU C++ compiler... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking whether <span style="color: #c20cb9; font-weight: bold;">g++</span> accepts -g... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> ranlib... ranlib
checking <span style="color: #000000; font-weight: bold;">for</span> flex... no
checking <span style="color: #000000; font-weight: bold;">for</span> lex... no
checking <span style="color: #000000; font-weight: bold;">for</span> yywrap <span style="color: #000000; font-weight: bold;">in</span> -lfl... no
checking <span style="color: #000000; font-weight: bold;">for</span> yywrap <span style="color: #000000; font-weight: bold;">in</span> -ll... no
checking <span style="color: #000000; font-weight: bold;">for</span> bison... no
checking <span style="color: #000000; font-weight: bold;">for</span> byacc... no
checking <span style="color: #000000; font-weight: bold;">if</span> compiler supports -R... no
checking <span style="color: #000000; font-weight: bold;">if</span> compiler supports -Wl,-rpath,... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> exp <span style="color: #000000; font-weight: bold;">in</span> -lm... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> __gxx_personality_v0 <span style="color: #000000; font-weight: bold;">in</span> -lstdc++... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking how to run the C preprocessor... <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-E</span>
checking <span style="color: #000000; font-weight: bold;">for</span> egrep... <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-E</span>
checking <span style="color: #000000; font-weight: bold;">for</span> ANSI C header files... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> strcasecmp... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> strncasecmp... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> strdup... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> strlcat... no
checking <span style="color: #000000; font-weight: bold;">for</span> vsnprintf... <span style="color: #c20cb9; font-weight: bold;">yes</span>
MapServer Version from mapserver.h: <span style="color: #ff0000;">'5.0.2'</span>
configure: checking where FreeType 2.x is installed...
checking <span style="color: #000000; font-weight: bold;">for</span> freetype-config... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>freetype-config
        using libfreetype from <span style="color: #660033;">-lfreetype</span> <span style="color: #660033;">-lz</span>
checking <span style="color: #000000; font-weight: bold;">for</span> FT_Init_FreeType <span style="color: #000000; font-weight: bold;">in</span> -lfreetype... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libfreetype <span style="color: #660033;">-lfreetype</span> from system libs.
configure: checking where Zlib is installed...
checking <span style="color: #000000; font-weight: bold;">for</span> zlibVersion <span style="color: #000000; font-weight: bold;">in</span> -lz... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libz from system libs <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_ZLIB<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
configure: checking where PNG is installed...
checking <span style="color: #000000; font-weight: bold;">for</span> png_init_io <span style="color: #000000; font-weight: bold;">in</span> -lpng... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libpng from system libs.
configure: checking whether we should include JPEG support...
checking <span style="color: #000000; font-weight: bold;">for</span> jpeg_read_header <span style="color: #000000; font-weight: bold;">in</span> -ljpeg... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libjpeg from system libs.
configure: checking where libXpm is installed...
checking <span style="color: #000000; font-weight: bold;">for</span> XpmFreeXpmImage <span style="color: #000000; font-weight: bold;">in</span> -lXpm... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libXpm from system libs.
configure: checking where libiconv is installed...
checking <span style="color: #000000; font-weight: bold;">for</span> iconv_open <span style="color: #000000; font-weight: bold;">in</span> -lc... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> libiconv_open <span style="color: #000000; font-weight: bold;">in</span> -liconv... no
        using libiconv from system libs.
        libiconv found. Enabling internationalization <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_ICONV<span style="color: #7a0874; font-weight: bold;">&#41;</span>
configure: checking <span style="color: #000000; font-weight: bold;">for</span> GD 2.0.16 or higher...
checking <span style="color: #000000; font-weight: bold;">for</span> gdFontCacheSetup <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libgd 2.0.16 <span style="color: #7a0874; font-weight: bold;">&#40;</span>or higher<span style="color: #7a0874; font-weight: bold;">&#41;</span> from system libs <span style="color: #7a0874; font-weight: bold;">&#40;</span>-L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lgd</span> <span style="color: #660033;">-ljpeg</span> <span style="color: #660033;">-lfreetype</span> <span style="color: #660033;">-lpng</span> <span style="color: #660033;">-lz</span> <span style="color: #660033;">-lXpm</span> <span style="color: #660033;">-lX11</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>.
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageCreate <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageGif <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImagePng <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageJpeg <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageWBMP <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageStringFT <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageOpenPolygon <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdImageGifPtr <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> gdFontGetTiny <span style="color: #000000; font-weight: bold;">in</span> -lgd... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using GD <span style="color: #7a0874; font-weight: bold;">&#40;</span> -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS<span style="color: #7a0874; font-weight: bold;">&#41;</span> from system libs.
configure: checking whether we should include PDF support...
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_setlinewidth <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_setrgbcolor <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_moveto <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_curveto <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_show_xy <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
checking <span style="color: #000000; font-weight: bold;">for</span> PDF_load_font <span style="color: #000000; font-weight: bold;">in</span> -lpdf... no
        libpdf not found or too old... PDF support not included.
checking <span style="color: #000000; font-weight: bold;">if</span> AGG support requested... looking <span style="color: #000000; font-weight: bold;">for</span> agg libs <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>usr
using libagg from <span style="color: #000000; font-weight: bold;">/</span>usr
using libaggfontfreetype from <span style="color: #000000; font-weight: bold;">/</span>usr
configure: checking whether we should include EPPL7 support...
        including EPPL7 support.
configure: checking whether we should include PROJ.4 support...
checking <span style="color: #000000; font-weight: bold;">for</span> pj_init <span style="color: #000000; font-weight: bold;">in</span> -lproj... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> pj_transform <span style="color: #000000; font-weight: bold;">in</span> -lproj... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using PROJ.4 from system libs.
configure: checking whether we should include thread safe support...
checking <span style="color: #000000; font-weight: bold;">for</span> pthread_create <span style="color: #000000; font-weight: bold;">in</span> -lpthread... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using <span style="color: #660033;">-lpthread</span> from system libs.
configure: checking whether we should include ESRI SDE support...
        ESRI SDE support not requested.
checking <span style="color: #000000; font-weight: bold;">if</span> GEOS support requested... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> geos-config... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>geos-config
checking <span style="color: #000000; font-weight: bold;">for</span> GEOS version <span style="color: #000000; font-weight: bold;">&amp;</span>gt;= 2.2.2... yes. Found version 2.2.3
configure: checking whether we should include OGR support...
checking <span style="color: #000000; font-weight: bold;">for</span> gdal-config... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gdal-config
        OGR enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_OGR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
checking <span style="color: #000000; font-weight: bold;">if</span> GDAL support requested... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking checking ms JPEG output... no we, have GDAL available.
configure: checking whether we should include TIFF support...
checking <span style="color: #000000; font-weight: bold;">for</span> TIFFOpen <span style="color: #000000; font-weight: bold;">in</span> -ltiff... <span style="color: #c20cb9; font-weight: bold;">yes</span>
        using libtiff from system libs.
checking <span style="color: #000000; font-weight: bold;">if</span> PostGIS support requested... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> pg_config... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pg_config
<span style="color: #c20cb9; font-weight: bold;">yes</span>, user supplied pg_config
checking <span style="color: #000000; font-weight: bold;">if</span> MyGIS support requested... no
checking <span style="color: #000000; font-weight: bold;">if</span> OracleSpatial support requested... no
checking <span style="color: #000000; font-weight: bold;">if</span> MING<span style="color: #000000; font-weight: bold;">/</span>Flash support requested... no
configure: checking whether we should include WMS Server support...
        OGC WMS compatibility enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_WMS_SVR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
configure: checking whether we should include WFS Server support...
        OGC WFS Server support enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_WFS_SVR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
configure: checking whether we should include WCS Server support...
        OGC WCS Server support enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_WCS_SVR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
configure: checking whether we should include WMS Client Connections support...
configure: checking whether we should include WFS Client Connections support...
configure: checking whether we should include OGC SOS Server support...
configure: checking <span style="color: #000000; font-weight: bold;">for</span> curl-config...
checking <span style="color: #000000; font-weight: bold;">for</span> curl-config... <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>curl-config
        found libcurl version 7.18.0
        OGC WMS Client Connections enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_WMS_LYR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
        OGC WFS Client Connections enabled <span style="color: #7a0874; font-weight: bold;">&#40;</span>-DUSE_WFS_LYR<span style="color: #7a0874; font-weight: bold;">&#41;</span>.
configure: checking <span style="color: #000000; font-weight: bold;">for</span> xml2-config...
configure: checking whether FastCGI support should be enabled...
        FastCGI support not enabled.
configure: checking HTTPD server <span style="color: #7a0874; font-weight: bold;">&#40;</span>Apache<span style="color: #7a0874; font-weight: bold;">&#41;</span> version...
        using user-supplied httpd <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 version is Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.8 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2002008</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.
        Your system is apparently running Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.8.  Setting stderr to non-blocking <span style="color: #000000; font-weight: bold;">for</span> msDebug<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> due to Apache 2.x bug <span style="color: #7a0874; font-weight: bold;">&#40;</span>see MapServer bug <span style="color: #000000;">458</span> or Apache bug <span style="color: #000000;">22030</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.
Compiling with fast MS_NINT
checking compiler warnings... basic
configure: checking whether we should <span style="color: #7a0874; font-weight: bold;">enable</span> debug features...
        Enabling debug features: <span style="color: #660033;">-g</span> <span style="color: #000000; font-weight: bold;">in</span> CFLAGS.
configure: checking <span style="color: #000000; font-weight: bold;">for</span> PHP<span style="color: #000000; font-weight: bold;">/</span>MapScript module options...
        PHP<span style="color: #000000; font-weight: bold;">/</span>MapScript module not configured.
checking <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-shared</span> ... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #660033;">--enable-runpath</span> requested... no
checking <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #660033;">--with-java-include-os-name</span> specified... no, autodetected linux
configure: creating .<span style="color: #000000; font-weight: bold;">/</span>config.status
config.status: creating Makefile
config.status: creating mapscript<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>Makefile
config.status: creating mapscript<span style="color: #000000; font-weight: bold;">/</span>csharp<span style="color: #000000; font-weight: bold;">/</span>Makefile
&nbsp;
MapServer is now configured <span style="color: #000000; font-weight: bold;">for</span>
&nbsp;
 <span style="color: #660033;">--------------</span> Compiler Info <span style="color: #660033;">-------------</span>
  C compiler:                <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-g</span> <span style="color: #660033;">-O2</span> <span style="color: #660033;">-fPIC</span> <span style="color: #660033;">-Wall</span>
  C++ compiler:              <span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-g</span> <span style="color: #660033;">-O2</span> <span style="color: #660033;">-fPIC</span> <span style="color: #660033;">-Wall</span>
  Debug:                     <span style="color: #660033;">-g</span>  -DNEED_NONBLOCKING_STDERR
  Generic NINT:
  Threading support:         -DUSE_THREAD
&nbsp;
 <span style="color: #660033;">--------------</span> Renderer Settings <span style="color: #660033;">---------</span>
  zlib support:              -DUSE_ZLIB
  png support:
  jpeg support:
  iconv support:             -DUSE_ICONV
  AGG support:               -DUSE_AGG
  AGG Freetype support:      <span style="color: #660033;">-laggfontfreetype</span>
  Ming<span style="color: #7a0874; font-weight: bold;">&#40;</span>flash<span style="color: #7a0874; font-weight: bold;">&#41;</span> support:
  PDFLib support:
&nbsp;
 <span style="color: #660033;">--------------</span> Data Format Drivers <span style="color: #660033;">-------</span>
  native tiff support:       -DUSE_TIFF
  PostGIS support:           -DUSE_POSTGIS
  Proj.4 support:            -DUSE_PROJ
  EPPL7 support:             -DUSE_EPPL
  ArcSDE support:
  OGR support:               -DUSE_OGR
  GDAL support:              -DUSE_GDAL
  GEOS support:              -DUSE_GEOS
  Oracle Spatial support:
  FastCGI support:
&nbsp;
 <span style="color: #660033;">--------------</span> OGC Services <span style="color: #660033;">--------------</span>
  WMS Server:                -DUSE_WMS_SVR
  WMS Client:                -DUSE_WMS_LYR
  WFS Server:                -DUSE_WFS_SVR
  WFS Client:                -DUSE_WMS_LYR
  WCS Server:                -DUSE_WCS_SVR
  SOS Server:
&nbsp;
 <span style="color: #660033;">--------------</span> MapScript <span style="color: #660033;">-----------------</span>
  PHP MapScript:             no</pre></div></div>

<p>I was able to weed out the problem above by checking on the libraries noted with &#8220;yes&#8221; above if they are installed or not. To overcome this, I needed to install the ff debian packages on &#8216;lenny(testing)&#8217;:</p>
<p><code>libagg-dev libgd2-xpm libgd2-xpm-dev libtiff4 libtiff4-dev libpng libpng-dev libxpm4 libxpm4-dev libfreetype6-dev libapache2-mod-python python-imaging </code></p>
<p>Results:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">debsexy:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #666666; font-style: italic;"># ./mapserv -v</span>
MapServer version 5.0.2 <span style="color: #007800;">OUTPUT</span>=GIF <span style="color: #007800;">OUTPUT</span>=PNG <span style="color: #007800;">OUTPUT</span>=JPEG <span style="color: #007800;">OUTPUT</span>=WBMP <span style="color: #007800;">OUTPUT</span>=SVG <span style="color: #007800;">SUPPORTS</span>=PROJ <span style="color: #007800;">SUPPORTS</span>=AGG <span style="color: #007800;">SUPPORTS</span>=FREETYPE <span style="color: #007800;">SUPPORTS</span>=WMS_SERVER <span style="color: #007800;">SUPPORTS</span>=WMS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WFS_SERVER <span style="color: #007800;">SUPPORTS</span>=WFS_CLIENT <span style="color: #007800;">SUPPORTS</span>=WCS_SERVER <span style="color: #007800;">SUPPORTS</span>=THREADS <span style="color: #007800;">SUPPORTS</span>=GEOS <span style="color: #007800;">INPUT</span>=TIFF <span style="color: #007800;">INPUT</span>=EPPL7 <span style="color: #007800;">INPUT</span>=POSTGIS <span style="color: #007800;">INPUT</span>=OGR <span style="color: #007800;">INPUT</span>=GDAL <span style="color: #007800;">INPUT</span>=SHAPEFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/03/installing-mapserver-on-debian-reprise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Parameters to Mapserver</title>
		<link>/wordpress/2008/01/passing-parameters-to-mapserver/</link>
		<comments>/wordpress/2008/01/passing-parameters-to-mapserver/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 22:27:19 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>

		<guid isPermaLink="false">/wordpress/?p=131</guid>
		<description><![CDATA[I was bitten 4 hours searching for this in the mailing list. I have a postgis layer defined in mapserver map file as follows: LAYER NAME &#34;pois&#34; STATUS DEFAULT GROUP &#34;pois&#34; TYPE POINT &#160; CONNECTIONTYPE postgis PROCESSING &#34;CLOSE_CONNECTION=DEFER&#34; CONNECTION &#34;user=lbs password=xtlme15n dbname=beijing_stat host=192.168.1.211 port=5432&#34; #DATA &#34;the_geom from (SELECT poi_id, the_geom FROM poi WHERE new_block_id = [...]]]></description>
			<content:encoded><![CDATA[<p>I was bitten 4 hours searching for this in the mailing list. I have a postgis layer defined in mapserver map file as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">LAYER
        NAME &quot;pois&quot;
        STATUS DEFAULT
		GROUP &quot;pois&quot;
        TYPE POINT
&nbsp;
		CONNECTIONTYPE postgis
		PROCESSING &quot;CLOSE_CONNECTION=DEFER&quot;
		CONNECTION &quot;user=lbs password=xtlme15n dbname=beijing_stat host=192.168.1.211 port=5432&quot;
		#DATA &quot;the_geom from (SELECT poi_id, the_geom FROM poi WHERE new_block_id = 7) as foo USING UNIQUE poi_id USING SRID=4326&quot;
		DATA &quot;the_geom from poi as foo USING UNIQUE poi_id USING SRID=4326&quot;
&nbsp;
		FILTER &quot;new_block_id=%myid%&quot;
&nbsp;
		CLASS
			NAME &quot;block-pois&quot;
    		        STYLE
				SYMBOL &quot;circle&quot;
     			        COLOR 255 0 0
				SIZE 10
   			END
  		END
END</pre></div></div>

<p>Traditionally, I could append and change the FILTER attribute by passing it to the Mapserver CGI as follows:<br />
<code>map.pois.filter=new_block_id%3D700</code>.</p>
<p>Apparently, this changed with Mapserver 5.0. Please see <a href="http://trac.osgeo.org/mapserver/browser/branches/branch-5-0/mapserver/MIGRATION_GUIDE.TXT">MapServer 4.10 to 5.0 Migration Guide</a>.  Thanks to this mailing list <a href="http://www.nabble.com/Changing-map-file-parameters-via-URL-td12932745.html#a12972957">thread</a>, it turned out that <strong>we need to pass a value to a custom variable set in the mapfile for <em>security reasons</em></strong>. Hope this one, goes in to the docs. I was hoping to comment out in the Mapserver Documentation but registration is holding me off with a &#8216;Connection Refused&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2008/01/passing-parameters-to-mapserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapserver Debug Output</title>
		<link>/wordpress/2007/08/mapserver-debug-output/</link>
		<comments>/wordpress/2007/08/mapserver-debug-output/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 11:41:39 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">/wordpress/?p=107</guid>
		<description><![CDATA[Grabbing the latest ms4w-2.2.6, I was now able to get debugging output by specifying below in my mapfile. CONFIG MS_ERRORFILE "stderr" This would log all requests to your Apache error log. I can now play with different debugging modes as described from RFC28. Here is a simple output of my error.log with a DEBUG 2 [...]]]></description>
			<content:encoded><![CDATA[<p>Grabbing the latest <a href="http://dl.maptools.org/dl/ms4w/">ms4w-2.2.6</a>, I was now able to get debugging output by specifying below in my mapfile.</p>
<p><code><br />
CONFIG MS_ERRORFILE "stderr"<br />
</code></p>
<p>This would log all requests to your Apache error log. I can now play with different debugging modes as described from <a href="http://mapserver.gis.umn.edu/development/rfc/ms-rfc-28">RFC28</a>. Here is a simple output of my error.log with a <strong><em>DEBUG 2</em></strong> set..</p>
<p><code><br />
[error] [client 127.0.0.1] CGI Request 1 on process 4136<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 0 (district), 0.172s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 1 (water_200k), 0.187s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 2 (greens_200k), 0.454s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 6 (roads_150_01), 0.906s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 9 (roads_270_01), 0.515s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 10 (roads_180_01), 0.563s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 11 (roads_280_01), 0.531s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 12 (roads_400_01), 0.516s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 13 (roads_140_03), 0.547s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 14 (roads_140_04), 1.297s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 15 (roads_141_02), 0.703s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 16 (roads_150_02), 0.890s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 17 (roads_boundary_160_170_270), 0.953s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 18 (roads_160_02), 0.829s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 19 (roads_170_02), 0.640s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 20 (roads_270_02), 0.531s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 22 (roads_180_02), 0.563s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 23 (roads_280_02), 0.516s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 24 (roads_400_02), 0.531s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 26 (subway), 0.109s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 27 (subwaystops), 0.125s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 28 (subway_transfer_stops), 0.110s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 29 (district_boundary), 0.156s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 33 (400_280_180_170_160_150_labels_01), 4.859s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 35 (subwaystops_labels), 0.125s<br />
[error] [client 127.0.0.1] msDrawMap(): Layer 36 (district_labels), 0.125s<br />
[error] [client 127.0.0.1] msDrawMap(): Drawing Label Cache, 5.860s<br />
[error] [client 127.0.0.1] msDrawMap() total time: 23.329s<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/08/mapserver-debug-output/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Playing with Mapserver AGG Rendering&#8230;</title>
		<link>/wordpress/2007/08/103/</link>
		<comments>/wordpress/2007/08/103/#comments</comments>
		<pubDate>Sun, 19 Aug 2007 13:38:12 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>

		<guid isPermaLink="false">/wordpress/?p=103</guid>
		<description><![CDATA[Summary One of the upcoming power features of Mapserver 5.0 is its AGG Rendering engine. Above is an example image of the AGG rendering capabilities of Mapserver. Below is a list of my experiences with Mapserer 5.0 AGG Slower than GD ofcourse, but cartographic quality is really impressive&#8230; You need to have SUPPORT=AGG to be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/08/cybersoft_map_agg.png" title="cybersoft_map_agg.png"><img src="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/08/cybersoft_map_agg.png" alt="cybersoft_map_agg.png" /></a></p>
<p><strong>Summary</strong><br />
One of the upcoming power features of Mapserver 5.0 is its AGG Rendering engine. Above is an example image of the AGG rendering capabilities of Mapserver. Below is a list of my experiences with Mapserer 5.0 AGG</p>
<ul>
<li>Slower than GD ofcourse, but cartographic quality is really impressive&#8230;</li>
<li>You need to have SUPPORT=AGG to be able to use AGG. So far, I was not able to compile mapserver source with AGG, however using <a href="http://mapserver.gis.umn.edu/download/beta/">mapserver-beta-3 for linux</a> and <a href="http://www.maptools.org/ms4w/index.phtml?page=downloads.html">ms4w betas</a> worked fine.</li>
<li>Layer Transparency. I was not able to get transparency for my roads overlaying on top of my basemap. Tbonfort from IRC suggested I use RGBA for the outputformat, but it still breaks. Hope Im not missing anything important here&#8230;</li>
</ul>
<p><strong>The Mapfile</strong><br />
Currently, the mapfile ( <em>map_all_agg.map</em> ) contains 2,587 lines! The lengthy mapfile consists of the ff: <em>districts or political boundaries, water bodies, greens or open spaces, roads, subway lines, subway stops</em>. The roads is classified into 12 categories ( <em>Expressway, Class-1, Class-2, Class-3, Class-4, Major Road, Main, Secondary, Minor, CommunityRoad(w/name), CommunityRoad, ParkRoads</em>). <em>Class1-4</em> is a classification for Roads outside the 5th Ring Road of Beijing. While <em>Major Roads &#8211; Minor Roads</em> is a classification inside the 5th Ring.  The roads were drawn as a line layer and not as a polygon.</p>
<p>How to achieve the overlapping of road intersections?<br />
The technique is to seperate the road boundary layer from the actual road line. A mixture of <em>widths</em> and <em>color management</em> was employed to achieve the effect. Essentially, we started with the ff:</p>
<p>1.  road boundary layer<br />
2.  road layer</p>
<p>Further , trial and error resulted in refining the road boundary layer with different minscales and maxscales. The same was adapted with the road layer. Download <a href="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/08/map_all_agg.txt" title="map_all_agg.txt">map_all_agg.txt</a>.  My next iteration, would be to refactor some of the road layers if possible.</p>
<p>A couple of notes to myself, we could speed things up by trying out the ff:</p>
<ul>
<li>Using SHPTREE</li>
<li>Simplifying the geometry as you change scales</li>
</ul>
<p><strong>Testing Methodology</strong><br />
1. Use Firefox and install firebug.<br />
2. Download YSlow from Yahoo.<br />
3. View load times using <em><strong>&#8220;net&#8221;</strong></em> tab<br />
<img src="http://www.gisnotes.com/wordpress/wp-content/uploads/2007/08/firebug-1.png" alt="firebug-1.png" /></p>
<p><strong><a href="http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ShpTree">Using SHPTREE</a></strong><br />
1. The utility specifies indexes as it slices the shapefile into quadrants as specified from its definition. To run shptree, do the ff:<br />
<code><br />
$ shptree roads.shp<br />
creating index of new  LSB format<br />
</code></p>
<p>2. It would generate a <em>roads.qix</em>. No changes need to be made with the mapfile. Mapserver loads the shapefile without the extension.</p>
<p>3. Testing&#8230; Significant speed improvements were made as shown below:</p>
<blockquote>
<ul>
<li>Before: 29.44 secs</li>
<li>After:    5.91 secs</li>
</ul>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/08/103/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Upgrading MS4W</title>
		<link>/wordpress/2007/08/upgrading-ms4w/</link>
		<comments>/wordpress/2007/08/upgrading-ms4w/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 17:22:40 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>

		<guid isPermaLink="false">/wordpress/?p=99</guid>
		<description><![CDATA[Here&#8217;s a quick overview of how I upgraded my custom MS4W binded with ColdFusion.. 1. Extract the new ms4w_new.zip to E:\ms4w_new 2. diff E:\ms4w_new\Apache\conf\httpd.conf E:\ms4w\Apache\conf\httpd.conf If the changes is minimal, then proceed. 3. Uninstall ColdFusion connector from Apache. D:\CFusionMX\bin\connectors\Remove_ALL_connectors.bat 4. Uninstall Apache from services.msc. Run E:\ms4w\apache-uninstall.bat 5. Move mv E:\ms4w E:\ms4w_old mv E:\ms4w_new E:\ms4w 6. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick overview of how I upgraded my custom MS4W binded with ColdFusion..</p>
<p>1. Extract the new ms4w_new.zip to E:\ms4w_new</p>
<p>2. diff E:\ms4w_new\Apache\conf\httpd.conf E:\ms4w\Apache\conf\httpd.conf</p>
<p>If the changes is minimal, then proceed.</p>
<p>3. Uninstall ColdFusion connector from Apache.<br />
<code><br />
D:\CFusionMX\bin\connectors\Remove_ALL_connectors.bat<br />
</code></p>
<p>4. Uninstall Apache from services.msc. Run<br />
<code><br />
E:\ms4w\apache-uninstall.bat<br />
</code></p>
<p>5. Move<br />
<code><br />
mv E:\ms4w E:\ms4w_old<br />
mv E:\ms4w_new E:\ms4w<br />
</code></p>
<p>6. Install Apache as a windows services to services.msc<br />
<code><br />
E:\ms4w\apache-install.bat<br />
</code></p>
<p>7. Bind ColdFusion again to Apache<br />
<code><br />
D:\CFusionMX\bin\connectors\Apache_connector.bat<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/08/upgrading-ms4w/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian Howto: Installing Mapserver</title>
		<link>/wordpress/2007/08/debian-howto-installing-mapserver/</link>
		<comments>/wordpress/2007/08/debian-howto-installing-mapserver/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 22:51:04 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mapserver]]></category>

		<guid isPermaLink="false">/wordpress/?p=85</guid>
		<description><![CDATA[By default, we can install mapserver using etch stable from a debian mirror using apt-get. Final results were almost close as expected, however, I need mapserver with TIFF support to be able to display my satellite images. Thus, recompilation is necessary. Below is the binary version difference for both installation procedures. Nevertheless, it is worth [...]]]></description>
			<content:encoded><![CDATA[<p>By default, we can install mapserver using <em>etch</em> stable from a debian mirror using <em><strong>apt-get</strong></em>. Final results were almost close as expected, however, I need mapserver with TIFF support to be able to display my satellite images. Thus, recompilation is necessary. Below is the binary version difference for both installation procedures.</p>
<p>Nevertheless, it is worth noting that &#8216;apt-get&#8217; significantly boost the installation of mapserver. I highly suggest to install mapserver using apt-get and use source compilation only if necessary.</p>
<p>a) mapserver installed using apt-get</p>
<p><code><br />
rupert-debian:/usr/lib/cgi-bin# ./mapserv -v<br />
MapServer version 4.10.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE DEBUG=MSDEBUG<br />
</code></p>
<p>Installation instructions for a:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">1. <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">g++</span> libgd2-xpm libgd2-xpm-dev libcurl3 zlib1g-dev libgd-dev libtiff4 libtiff4-dev  libapache2-mod-python python-imaging  
&nbsp;
2. <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-cgi php5-common php5-curl php5-dev php5-gd php5-mysql php5-pgsql php5-sqlite php5-xsl libapache2-mod-php5
&nbsp;
3. <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> python2.5 python2.5-dev python2.5-examples
&nbsp;
4. <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-client-<span style="color: #000000;">5.0</span> mysql-server-<span style="color: #000000;">5.0</span> mytop mysql-admin mysql-admin-common libmysqlclient15-dev libdbd-mysql-perl libdbd-mysql-ruby mtop
&nbsp;
5. <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> postgresql-common postgresql-<span style="color: #000000;">8.2</span> postgresql-client-<span style="color: #000000;">8.2</span> postgresql-contrib-<span style="color: #000000;">8.2</span> postgresql-<span style="color: #000000;">8.2</span>-plr postgresql-<span style="color: #000000;">8.2</span>-plruby postgresql-<span style="color: #000000;">8.2</span>-postgis postgresql-plperl-<span style="color: #000000;">8.2</span> postgresql-plpython-<span style="color: #000000;">8.2</span> postgresql-pltcl-<span style="color: #000000;">8.2</span> libpq4 
&nbsp;
6.  <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> gdal-bin cgi-mapserver mapserver-bin mapserver-doc perl-mapscript php5-mapscript python-mapscript</pre></div></div>

<p>b. mapserver compiled</p>
<p><code><br />
rupert-debian:/usr/lib/cgi-bin# ./mapserv_default -v<br />
MapServer version 4.10.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE DEBUG=MSDEBUG<br />
</code></p>
<p>Installation instructions for b:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#tar -zxvf geos-3.0.0rc4</span>
<span style="color: #666666; font-style: italic;">#./configure</span>
<span style="color: #666666; font-style: italic;">#make</span>
<span style="color: #666666; font-style: italic;">#make install</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#modify /etc/apt/sources.list and uncomment testing</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.geekbone.org<span style="color: #000000; font-weight: bold;">/</span>debian testing main
deb-src  http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.geekbone.org<span style="color: #000000; font-weight: bold;">/</span>debian testing main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.geekbone.org<span style="color: #000000; font-weight: bold;">/</span>debian etch main
deb-src  http:<span style="color: #000000; font-weight: bold;">//</span>mirrors.geekbone.org<span style="color: #000000; font-weight: bold;">/</span>debian etch main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> etch<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> etch<span style="color: #000000; font-weight: bold;">/</span>updates main contrib
&nbsp;
<span style="color: #666666; font-style: italic;">#apt-get update</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#apt-get install postgresql-8.2-postgis</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#tar -zxvf mapserver-4.10.2.tar.gz</span>
<span style="color: #666666; font-style: italic;">#./configure \</span>
<span style="color: #660033;">--with-jpeg</span> \
<span style="color: #660033;">--with-gd</span> \
<span style="color: #660033;">--with-freetype</span> \
<span style="color: #660033;">--with-png</span> \
<span style="color: #660033;">--with-ogr</span> \
<span style="color: #660033;">--with-proj</span> \
<span style="color: #660033;">--with-gdal</span> \
<span style="color: #660033;">--with-httpd</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 \
<span style="color: #660033;">--with-tiff</span> \
<span style="color: #660033;">--with-wfs</span> \
<span style="color: #660033;">--with-wcs</span> \
<span style="color: #660033;">--with-threads</span> \
<span style="color: #660033;">--with-wmsclient</span> \
<span style="color: #660033;">--with-wfsclient</span> \
<span style="color: #660033;">--with-geos</span> \
<span style="color: #660033;">--with-postgis</span> \
<span style="color: #660033;">--enable-debug</span>
<span style="color: #666666; font-style: italic;">#make</span>
<span style="color: #666666; font-style: italic;">#make install</span>
<span style="color: #666666; font-style: italic;">#cp -Rf mapserv /usr/local/cgi-bin/</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/08/debian-howto-installing-mapserver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing Mapserver on RedHat/CentOS Linux</title>
		<link>/wordpress/2007/07/installing-mapserver/</link>
		<comments>/wordpress/2007/07/installing-mapserver/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 10:59:57 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">/wordpress/?p=77</guid>
		<description><![CDATA[Tested on: CentOS 5.0, 4.1 vim /etc/ld.so.conf include /usr/lib64 include /usr/local/lib include /usr/lib Prerequisites: rpm -ivh $CENTOS/bzip2-devel-1.0.3-3.x86_64.rpm rpm -ivh $CENTOS/libidn-0.6.5-1.1.x86_64.rpm rpm -ivh $CENTOS/curl-7.15.5-2.el5.x86_64.rpm rpm -ivh $CENTOS/pkgconfig-0.21-1.fc6.x86_64.rpm rpm -ivh $CENTOS/libidn-devel-0.6.5-1.1.x86_64.rpm rpm -ivh $CENTOS/e2fsprogs-devel-1.39-10.el5.x86_64.rpm rpm -ivh $CENTOS/krb5-devel-1.6.1-17.el5.x86_64.rpm rpm -ivh $CENTOS/zlib-devel-1.2.3-3.x86_64.rpm rpm -ivh $CENTOS/openssl-devel-0.9.8b-8.3.el5_0.2.x86_64.rpm rpm -ivh $CENTOS/flex-2.5.4a-41.fc6.x86_64.rpm rpm -ivh $CENTOS/libstdc++-devel-4.1.2-14.el5.x86_64.rpm rpm -ivh $CENTOS/libxml2-devel-2.6.26-2.1.2.x86_64.rpm rpm -ivh $CENTOS/libxslt-devel-1.1.17-2.x86_64.rpm rpm -ivh [...]]]></description>
			<content:encoded><![CDATA[<p>Tested on: CentOS 5.0, 4.1<br />
vim /etc/ld.so.conf<br />
include /usr/lib64<br />
include /usr/local/lib<br />
include /usr/lib</p>
<p>Prerequisites:<br />
rpm -ivh $CENTOS/bzip2-devel-1.0.3-3.x86_64.rpm<br />
rpm -ivh $CENTOS/libidn-0.6.5-1.1.x86_64.rpm<br />
rpm -ivh $CENTOS/curl-7.15.5-2.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/pkgconfig-0.21-1.fc6.x86_64.rpm<br />
rpm -ivh $CENTOS/libidn-devel-0.6.5-1.1.x86_64.rpm<br />
rpm -ivh $CENTOS/e2fsprogs-devel-1.39-10.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/krb5-devel-1.6.1-17.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/zlib-devel-1.2.3-3.x86_64.rpm<br />
rpm -ivh $CENTOS/openssl-devel-0.9.8b-8.3.el5_0.2.x86_64.rpm<br />
rpm -ivh $CENTOS/flex-2.5.4a-41.fc6.x86_64.rpm<br />
rpm -ivh $CENTOS/libstdc++-devel-4.1.2-14.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/libxml2-devel-2.6.26-2.1.2.x86_64.rpm<br />
rpm -ivh $CENTOS/libxslt-devel-1.1.17-2.x86_64.rpm<br />
rpm -ivh $CENTOS/nmap-4.11-1.1.x86_64.rpm<br />
rpm -ivh $CENTOS/swig-1.3.29-2.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/apr-1.2.7-11.x86_64.rpm<br />
rpm -ivh $CENTOS/apr-util-1.2.7-6.x86_64.rpm<br />
rpm -ivh $CENTOS/neon-0.25.5-5.1.x86_64.rpm<br />
rpm -ivh $CENTOS/perl-URI-1.35-3.noarch.rpm<br />
rpm -ivh $CENTOS/subversion-1.4.2-2.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/libtool-ltdl-1.5.22-6.1.x86_64.rpm<br />
rpm -ivh $CENTOS/libtool-1.5.22-6.1.x86_64.rpm<br />
rpm -ivh $CENTOS/libtool-ltdl-devel-1.5.22-6.1.x86_64.rpm<br />
rpm -ivh $CENTOS/guile-1.8.0-8.20060831cvs.x86_64.rpm<br />
rpm -ivh $CENTOS/libX11-devel-1.0.3-8.0.1.el5.x86_64.rpm $CENTOS/libXau-devel-1.0.1-3.1.x86_64.rpm $CENTOS/xorg-x11-proto-devel-7.1-9.el5.centos.x86_64.rpm $CENTOS/mesa-libGL-devel-6.5.1-7.5.el5.x86_64.rpm $CENTOS/libXdmcp-devel-1.0.1-2.1.x86_64.rpm<br />
rpm -ivh $CENTOS/libjpeg-devel-6b-37.x86_64.rpm<br />
rpm -ivh $CENTOS/libpng-1.2.10-7.0.2.x86_64.rpm<br />
rpm -ivh $CENTOS/freetype-2.2.1-19.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/freetype-devel-2.2.1-19.el5.x86_64.rpm<br />
rpm -ivh $CENTOS/gd-devel-2.0.33-9.3.fc6.x86_64.rpm $CENTOS/fontconfig-devel-2.4.1-6.el5.x86_64.rpm $CENTOS/libXpm-devel-3.5.5-3.x86_64.rpm $CENTOS/libpng-devel-1.2.10-7.0.2.x86_64.rpm $CENTOS/gd-2.0.33-9.3.fc6.x86_64.rpm</p>
<p>1. Install proj4<br />
-tar -zxvf proj-4.4.9.tar.gz<br />
-./configure<br />
-make<br />
-make install</p>
<p>2. Install geos<br />
-bzip2 -d geos-3.0.0.tar.bz2<br />
-tar -xvf geos-3.0.0.tar<br />
-./configure &#8211;enable-python<br />
-make<br />
-make install</p>
<p>3. install postgres and postgis<br />
rpm -ivh postgresql-libs-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-devel-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-server-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-contrib-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-plperl-8.3.1-1PGDG.rhel5.x86_64.rpm<br />
rpm -ivh postgresql-plpython-8.3.1-1PGDG.rhel5.x86_64.rpm </p>
<p># tar -zxvf postgis-1.3.3.tar.gz<br />
# cd postgis-1.3.3<br />
# ./configure &#8211;with-pgsql=/usr/bin/pg_config<br />
#  make<br />
#  make install</p>
<p>If you need to put the postgres data for mapserver, then:<br />
initdb -E utf8 -D /var/lib/pgsql/data</p>
<p>3. install gdal<br />
./configure &#8211;with-png &#8211;with-libtiff  &#8211;with-static-proj4=/usr/local/bin &#8211;with-python &#8211;with-perl &#8211;with-geos &#8211;with-pg=/usr/bin/pg_config</p>
<p><em>Note: If there is an error regarding libxpat.so because of 64 bit libraries, then edit GDALmake.opt and change /usr/lib to /usr/lib64</em><br />
<a href="http://www.nabble.com/GDAL-v1.5.1-compile-error-on-RHEL5.-td17428872.html">http://www.nabble.com/GDAL-v1.5.1-compile-error-on-RHEL5.-td17428872.html</a></p>
<p>GDAL is now configured for i686-pc-linux-gnu</p>
<p>Installation directory:    /usr/local<br />
C compiler:                gcc -O2<br />
C++ compiler:              g++ -O2</p>
<p>LIBTOOL support:           yes</p>
<p>LIBZ support:              external<br />
GRASS support:             no<br />
CFITSIO support:           no<br />
PCRaster support:          internal<br />
NETCDF support:            no<br />
LIBPNG support:            external<br />
LIBTIFF support:           external<br />
LIBGEOTIFF support:        internal<br />
LIBJPEG support:           external<br />
LIBGIF support:            external<br />
OGDI support:              no<br />
HDF4 support:              no<br />
HDF5 support:              no<br />
KAKADU support:            no<br />
JASPER support:            no<br />
ECW support:               no<br />
MrSID support:             no<br />
CURL support (wcs):        yes<br />
POSTGRESQL support:        yes<br />
MySQL support:             yes<br />
XERCES support:            no<br />
ODBC support:              no<br />
PGEO support:              no<br />
OCI support:               no<br />
SDE support:               no<br />
DODS support:              no<br />
SQLite support:            no<br />
DWGdirect support          no<br />
PANORAMA GIS support:      no<br />
INFORMIX DataBlade support:no<br />
GEOS support:              yes</p>
<p>Statically link PROJ.4:    yes</p>
<p>Traditional Python:        yes<br />
NG SWIG Bindings:          perl</p>
<p>enable OGR building:       yes</p>
<p>make<br />
make install</p>
<p>4. Remove any existing apache from rpm then install apache2 by source.<br />
rpm -e httpd-2.2.3-11.el5.centos gnome-user-share-0.10-6.el5.x86_64<br />
./configure &#8211;prefix=/usr/local/apache2 &#8211;enable-rewrite &#8211;enable-so &#8211;with-mpm=prefork<br />
make<br />
make install</p>
<p>5. rpm -ivh alsa-lib-devel-1.0.14-1.rc4.el5.x86_64.rpm esound-0.2.36-3.x86_64.rpm esound-devel-0.2.36-3.x86_64.rpm audiofile-0.2.6-5.x86_64.rpm mesa-libGLU-6.5.1-7.5.el5.x86_64.rpm mesa-libGLU-devel-6.5.1-7.5.el5.x86_64.rpm libXext-1.0.1-2.1.x86_64.rpm libXext-devel-1.0.1-2.1.x86_64.rpm libXrandr-devel-1.1.1-3.1.x86_64.rpm libXrender-devel-0.9.1-3.1.x86_64.rpm libXt-devel-1.0.2-3.1.fc6.x86_64.rpm audiofile-devel-0.2.6-5.x86_64.rpm libSM-devel-1.0.1-3.1.x86_64.rpm libICE-devel-1.0.1-2.1.x86_64.rpm</p>
<p>6. rpm -ivh SDL-1.2.10-8.el5.x86_64.rpm SDL-devel-1.2.10-8.el5.x86_64.rpm</p>
<p>7. Dont use agg-2.4! PLEASE read this post from <a href="http://trac.osgeo.org/mapserver/ticket/2224">mapserver trac ticket.</a> Instead, download the packages form http://dag.wieers.com/rpm/packages/agg/</p>
<p>Note: For 64-bit packages:<br />
- http://dag.wieers.com/rpm/packages/agg/agg-2.5-1.el5.rf.x86_64.rpm<br />
- http://dag.wieers.com/rpm/packages/agg/agg-devel-2.5-1.el5.rf.x86_64.rpm</p>
<p>8. install mapserver. This assumes you have PHP, APACHE, POSTGRES, POSTGIS,<br />
MYSQL already installed.</p>
<p>./configure \<br />
&#8211;with-agg \<br />
&#8211;with-jpeg \<br />
&#8211;with-gd \<br />
&#8211;with-freetype \<br />
&#8211;with-png \<br />
&#8211;with-ogr \<br />
&#8211;with-proj \<br />
&#8211;with-gdal \<br />
&#8211;with-httpd=/usr/local/apache2/bin/httpd \<br />
&#8211;with-tiff \<br />
&#8211;with-wfs \<br />
&#8211;with-wcs \<br />
&#8211;with-sos \<br />
&#8211;with-wmsclient  \<br />
&#8211;with-wfsclient  \<br />
&#8211;with-geos=/usr/local/bin/geos-config \<br />
&#8211;with-gdal=/usr/local/bin/gdal-config \<br />
&#8211;with-postgis=/usr/bin/pg_config </p>
<p>-make<br />
-make install</p>
<p>9. Post Install Considerations:<br />
ln -s /usr/local/lib/libproj.so.0 /usr/lib/libproj.so.0<br />
ln -s /usr/local/lib/libgdal.so.1 /usr/lib/libgdal.so.1<br />
ln -s /usr/local/lib/libgeos_c.so.1 /usr/lib/libgeos_c.so.1<br />
ldconfig</p>
<p>10. cp -rf mapserv /usr/local/apache2/cgi-bin/<br />
check mapserv<br />
./mapserv -v<br />
MapServer version 5.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE</p>
<p>11. cp the ff:<br />
cp legend scalebar shp2img shp2pdf shptree shptreetst shptreevis sortshp<br />
tile4ms /usr/local/apache2/cgi-bin/</p>
<p>12. cp $mapserver_install_dir/mapscript/php3/php_mapscript.so /usr/local/apache2/modules/</p>
<p>######################################<br />
11. edit httpd.conf<br />
setenv LD_LIBRARY_PATH /usr/local/lib</p>
<p>12. vi /etc/ld.so.conf<br />
Add the following lines:<br />
/usr/local/include<br />
/usr/local/lib<br />
run:<br />
13 ldconfig</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/07/installing-mapserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing TileCache on RedHat/CentOS</title>
		<link>/wordpress/2007/07/installing-tilecache/</link>
		<comments>/wordpress/2007/07/installing-tilecache/#comments</comments>
		<pubDate>Wed, 25 Jul 2007 10:36:45 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">/wordpress/?p=79</guid>
		<description><![CDATA[1. Install Apache ./configure &#8211;prefix=/usr/local/apache2 &#8211;enable-so &#8211;enable-rewrite &#8211;with-mpm=prefork make make install rm -Rf /usr/local/apache2/htdocs/* 2. Install mod_python-3.3.1 ./configure --with-apxs=/usr/local/apache2/bin/apxs make make install 3. Install Python Imaging Library (PIL) &#8211; Imaging-1.1.6 python setup.py install Note: To check if PIL was successfully installed: #python selftest.py ***Test Failed*** 1 failures. *** 1 tests of 57 failed. 47 ln [...]]]></description>
			<content:encoded><![CDATA[<p>1. Install Apache<br />
./configure &#8211;prefix=/usr/local/apache2 &#8211;enable-so &#8211;enable-rewrite &#8211;with-mpm=prefork<br />
make<br />
make install<br />
rm -Rf /usr/local/apache2/htdocs/*</p>
<p>2. Install mod_python-3.3.1<br />
<code><br />
./configure --with-apxs=/usr/local/apache2/bin/apxs<br />
make<br />
make install<br />
</code></p>
<p>3. Install Python Imaging Library (PIL) &#8211; Imaging-1.1.6<br />
<code><br />
python setup.py install<br />
</code></p>
<p>Note: To check if PIL was successfully installed:<br />
#python selftest.py<br />
***Test Failed*** 1 failures.<br />
*** 1 tests of 57 failed.</p>
<p>   47  ln -s /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so<br />
   48  ldconfig<br />
   49  python setup.py install<br />
   51  python selftest.py<br />
   54  rm -rf Imaging-1.1.6<br />
   55  tar -zxvf Imaging-1.1.6.tar.gz<br />
   56  cd Imaging-1.1.6<br />
   58  python selftest.py -> still fails<br />
   59  python setup.py install<br />
   60  python selftest.py -> ok</p>
<p>4. Check if mod_python was sucessfully installed.<br />
<a href="http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking">http://www.dscpl.com.au/wiki/ModPython/Articles/GettingModPythonWorking</a></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#91;</span>root@rupert-centos pytest<span style="color: black;">&#93;</span><span style="color: #808080; font-style: italic;"># python</span>
Python 2.4.3 <span style="color: black;">&#40;</span><span style="color: #808080; font-style: italic;">#1, Mar 14 2007, 18:51:08)</span>
<span style="color: black;">&#91;</span>GCC 4.1.1 <span style="color: #ff4500;">20070105</span> <span style="color: black;">&#40;</span>Red Hat 4.1.1-<span style="color: #ff4500;">52</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span> on linux2
Type <span style="color: #483d8b;">&quot;help&quot;</span>, <span style="color: #483d8b;">&quot;copyright&quot;</span>, <span style="color: #483d8b;">&quot;credits&quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #483d8b;">&quot;license&quot;</span> <span style="color: #ff7700;font-weight:bold;">for</span> more information.
<span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff7700;font-weight:bold;">import</span> mod_python
<span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;</span> mod_python.<span style="color: black;">version</span>
<span style="color: #483d8b;">'3.3.1'</span>
<span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;</span></pre></div></div>

<p>4. Edit httpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">&lt;directory&gt;
 AddHandler python-program .py
 PythonHandler TileCache.Service
 PythonOption TileCacheConfig /usr/local/apache2/htdocs/tilecache/tilecache.cfg
 PythonDebug On
 PythonPath &quot;sys.path + ['/usr/local/apache2/htdocs/tilecache/']&quot;
&lt;/directory&gt;
&nbsp;
&lt;directory&gt;
 AddHandler mod_python .py
 PythonHandler test
 PythonDebug On
&lt;/directory&gt;</pre></div></div>

<blockquote><p>Note: This syntax will work for all versions of mod_python. In version 3.0 and later, the name of the mod_python handler reference has actually been changed and thus it is now preferred to use &#8220;mod_python&#8221; instead of &#8220;python-program&#8221;. The old name though is still supported and will be used here to avoid confusion for those using version 2.7.</p></blockquote>
<p>5. Test your python</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> mod_python <span style="color: #ff7700;font-weight:bold;">import</span> apache
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> handler<span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span>:
      req.<span style="color: black;">log_error</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'handler'</span><span style="color: black;">&#41;</span>
      req.<span style="color: black;">content_type</span> = <span style="color: #483d8b;">'text/plain'</span>
      req.<span style="color: black;">send_http_header</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      req.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'mptest.py<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">return</span> apache.<span style="color: black;">OK</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/07/installing-tilecache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing Mapinfo Raster JPEG Images using GDAL</title>
		<link>/wordpress/2007/06/processing-mapinfo-raster-jpeg-images-using-gdal/</link>
		<comments>/wordpress/2007/06/processing-mapinfo-raster-jpeg-images-using-gdal/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 12:25:30 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[GDAL/OGR]]></category>
		<category><![CDATA[mapserver]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[gdal]]></category>
		<category><![CDATA[mapinfo]]></category>
		<category><![CDATA[raster]]></category>

		<guid isPermaLink="false">/wordpress/?p=59</guid>
		<description><![CDATA[I have a couple of sat images (raw jpegs) from Google that I want to use with Openlayers/Mapserver. The raw jpegs were registered using Mapinfo via GCP (Ground Control Points). Mapinfo Raster JPEG Images example: rupert@rupert-winxp /e/home/map/beijing/new/satimages$ ll -rw-r&#8211;r&#8211; 1 rupert None 358 Jan 30 03:23 2NE1.TAB -rw-r&#8211;r&#8211; 1 rupert None 7.1M Jan 30 02:38 [...]]]></description>
			<content:encoded><![CDATA[<p>I have a couple of sat images (raw jpegs) from Google that I want to use with Openlayers/Mapserver.  The raw jpegs were registered using Mapinfo via GCP (Ground Control Points).</p>
<p>Mapinfo Raster JPEG Images example:</p>
<p>rupert@rupert-winxp /e/home/map/beijing/new/satimages$ ll<br />
-rw-r&#8211;r&#8211; 1 rupert None  358 Jan 30 03:23 2NE1.TAB<br />
-rw-r&#8211;r&#8211; 1 rupert None 7.1M Jan 30 02:38 2NE1.jpg<br />
-rw-r&#8211;r&#8211; 1 rupert None  356 Feb  1 18:56 2NE2a.TAB<br />
-rw-r&#8211;r&#8211; 1 rupert None 3.8M Feb  1 08:57 2NE2a.jpg</p>
<p>You cannot fully reference 2NE1.TAB as a Mapserver Layer. I tried to use 2NE1.jpg, but the problem its not georeferenced.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rupert@rupert-winxp /e/home/map/beijing/new/satimages
$ gdalinfo 2NE1.jpg
Driver: JPEG/JPEG JFIF
Size is 8650, 6744
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 6744.0)
Upper Right ( 8650.0,    0.0)
Lower Right ( 8650.0, 6744.0)
Center      ( 4325.0, 3372.0)
Band 1 Block=8650x1 Type=Byte, ColorInterp=Red
Band 2 Block=8650x1 Type=Byte, ColorInterp=Green
Band 3 Block=8650x1 Type=Byte, ColorInterp=Blue</pre></div></div>

<p>The georeference coordinates of 2NE1.jpg, just like an ESRI World File, is found in 2NE1.TAB&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rupert@rupert-winxp /e/home/map/beijing/new/satimages
$ cat 2NE1.TAB
!table
!version 300
!charset WindowsLatin1
&nbsp;
Definition Table
  File &quot;2ne1.jpg&quot;
  Type &quot;RASTER&quot;
  (116.38575,39.906105) (349,6619) Label &quot;Pt 1&quot;,
  (116.390072,39.93201) (1160,317) Label &quot;Pt 2&quot;,
  (116.42786,39.932296) (8210,253) Label &quot;Pt 3&quot;,
  (116.4295878,39.90722318) (8522,6358) Label &quot;Pt 4&quot;
  CoordSys Earth Projection 1, 0
  Units &quot;degree&quot;</pre></div></div>

<p>I found hurting myself in trying to create an ESRI world file from the current MAPINFO Raster TABS. So, I decided to go for GeoTIFF since its native in Mapserver. Using GDAL utilities my only problem is how to put a coordinate system and reference to the raster.</p>
<p>On windows, you could use <a href="http://fwtools.maptools.org">Frank&#8217;s FWTools.</a> For Linux, compile GDAL by source with python would be extremely helpful later on.  For installation of GDAL on Linux, we can use <a href="http://mapserver.gis.umn.edu/docs/howto/verboselinuxinstall/">Mapserver&#8217;s Verbose Installation in Linux Guide.</a></p>
<p><strong><a href="http://www.gdal.org/">GDAL</a> &#8211; the saviour!</strong>.</p>
<p><a href="http://www.gdal.org/gdal_utilities.html">GDAL utilities</a> is extremely helpful in reprojection, scaling, image mosaics, etc.  For now, we will use <a href="http://www.gdal.org/gdal_translate.html">gdal_translate</a> and <a href="http://www.gdal.org/gdalwarp.html">gdal_warp</a>.  Please RTFM the utilities.</p>
<p>1. Using gdal_translate to specify the gcp&#8217;s registered in Mapinfo.</p>
<blockquote><p>     <strong>gdal_translate -gcp pixel line easting northing</strong><br />
Add the indicated ground control point to the output dataset. This option may be provided multiple times to provide a set of GCPs.</p></blockquote>
<p><code><br />
<strong><br />
$ gdal_translate -gcp 349 6619 116.38575 39.906105 -gcp 1160 317 116.390072 39.93201 -gcp 8210 253 116.42786 39.932296 -gcp 8522 6358 116.4295878 39.90722318 -of GTiff 2NE1.jpg 2NE1translated.tif<br />
</strong><br />
Input file size is 8650, 6744<br />
0...10...20...30...40...50...60...70...80...90...100 - done.<br />
</code></p>
<p>Note: even if we specify the gcp&#8217;s, gdal_translate would not specify the corner coordinates of the tiff.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rupert@rupert-winxp /e/home/map/beijing/new/satimages
$ gdalinfo 2NE1translated.tif
Driver: GTiff/GeoTIFF
Size is 8650, 6744
Coordinate System is `'
GCP Projection =
GCP[  0]: Id=1, Info=
          (349,6619) -&amp;gt; (116.38575,39.906105,0)
GCP[  1]: Id=2, Info=
          (1160,317) -&amp;gt; (116.390072,39.93201,0)
GCP[  2]: Id=3, Info=
          (8210,253) -&amp;gt; (116.42786,39.932296,0)
GCP[  3]: Id=4, Info=
          (8522,6358) -&amp;gt; (116.4295878,39.90722318,0)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 6744.0)
Upper Right ( 8650.0,    0.0)
Lower Right ( 8650.0, 6744.0)
Center      ( 4325.0, 3372.0)
Band 1 Block=8650x1 Type=Byte, ColorInterp=Red
Band 2 Block=8650x1 Type=Byte, ColorInterp=Green
Band 3 Block=8650x1 Type=Byte, ColorInterp=Blue</pre></div></div>

<p>2. Use gdalwarp to reproject using the gcp and specify the coordinates.</p>
<blockquote><p>The gdalwarp utility is an image mosaicing, reprojection and warping utility. The program can reproject to any supported projection, and can also apply GCPs stored with the image if the image is &#8220;raw&#8221; with control information.</p></blockquote>
<p><code><br />
<strong>$ gdalwarp -s_srs epsg:4326 -t_srs epsg:4326 2NE1translated.tif warped.tif</strong><br />
Creating output file that is 9422P x 5631L.<br />
Processing input file 2NE1translated.tif.<br />
:0...10...20...30...40...5050...60...70...80...90...<br />
</code></p>
<p>Let&#8217;s check after gdalwarp using gdalinfo&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ gdalinfo warped.tif
Driver: GTiff/GeoTIFF
Size is 9422, 5631
Coordinate System is:
GEOGCS[&quot;WGS 84&quot;,
    DATUM[&quot;WGS_1984&quot;,
        SPHEROID[&quot;WGS 84&quot;,6378137,298.2572235630016,
            AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]],
        AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]],
    PRIMEM[&quot;Greenwich&quot;,0],
    UNIT[&quot;degree&quot;,0.0174532925199433],
    AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]
Origin = (116.383841930499160,39.933342296341991)
Pixel Size = (0.000004927579869,-0.000004927579869)
Metadata:
  AREA_OR_POINT=Area
Corner Coordinates:
Upper Left  ( 116.3838419,  39.9333423) (116d23'1.83&quot;E, 39d56'0.03&quot;N)
Lower Left  ( 116.3838419,  39.9055951) (116d23'1.83&quot;E, 39d54'20.14&quot;N)
Upper Right ( 116.4302696,  39.9333423) (116d25'48.97&quot;E, 39d56'0.03&quot;N)
Lower Right ( 116.4302696,  39.9055951) (116d25'48.97&quot;E, 39d54'20.14&quot;N)
Center      ( 116.4070558,  39.9194687) (116d24'25.40&quot;E, 39d55'10.09&quot;N)
Band 1 Block=9422x1 Type=Byte, ColorInterp=Red
Band 2 Block=9422x1 Type=Byte, ColorInterp=Green
Band 3 Block=9422x1 Type=Byte, ColorInterp=Blue</pre></div></div>

<p>Sweet. Now, all we need to do is display the raster images in Mapserver/OpenLayers.</p>
<p><a href="http://mapserver.gis.umn.edu/docs/howto/raster_data">Specifying a raster image in Mapserver</a></p>
<blockquote><p> LAYER<br />
NAME &#8220;2NE1&#8243;<br />
DATA &#8220;satimages/2NE1.tif&#8221;<br />
TYPE RASTER<br />
STATUS DEFAULT<br />
END</p>
<p>LAYER<br />
NAME &#8220;2NE2&#8243;<br />
DATA &#8220;satimages/2NE2a.tif&#8221;<br />
TYPE RASTER<br />
STATUS DEFAULT<br />
END</p></blockquote>
<p>Here is the end result&#8230;<br />
<img src="/wordpress/images/gdal_warp.jpg" />.</p>
<p>Lessons learned, I tried to specify coordinate extents using gdal_translate -a_ullr ulx uly lrx lry.  Specifying the coordinates was subjective by just looking at the cursor location of the registered image in Mapinfo. <em>It is still best to use the GCP&#8217;s. Simply put, we need to be accurate in specifying corner coordinates in raster images to project them accurately.</em></p>
<p><img src="/wordpress/images/gdal_merge.jpg" />.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/06/processing-mapinfo-raster-jpeg-images-using-gdal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transparent Overlays in TileCache</title>
		<link>/wordpress/2007/03/transparent-overlays-in-tilecache/</link>
		<comments>/wordpress/2007/03/transparent-overlays-in-tilecache/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 17:21:53 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[openlayers]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">/wordpress/?p=44</guid>
		<description><![CDATA[From the tilecache mailing list&#8230;. Hi Everyone, Really appreciate all the replies&#8230; 1. Installed Imaging-1.1.6.tar.gz (PIL). &#91;root@rupert-linux ~&#93;# python Python 2.3.4 &#40;#1, Mar 10 2006, 06:12:09) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type &#34;help&#34;, &#34;copyright&#34;, &#34;credits&#34; or &#34;license&#34; for more information. &#38;gt;&#38;gt;&#38;gt; import sys &#38;gt;&#38;gt;&#38;gt; print sys.path &#91;'', '/usr/lib/python23.zip', '/usr/lib/python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', '/usr/lib/python2.3/lib-dynload', [...]]]></description>
			<content:encoded><![CDATA[<p>From the tilecache mailing list&#8230;.</p>
<p>Hi Everyone,</p>
<p>Really appreciate all the replies&#8230;</p>
<p>1. Installed Imaging-1.1.6.tar.gz (PIL).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>rupert-linux ~<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python</span>
Python 2.3.4 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #666666; font-style: italic;">#1, Mar 10 2006, 06:12:09) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; import sys
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; print sys.path
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">'/usr/lib/python23.zip'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/plat-linux2'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/lib-tk'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/lib-dynload'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/site-packages'</span>,
<span style="color: #ff0000;">'/usr/lib/python2.3/site-packages/PIL'</span>,
<span style="color: #ff0000;">'/usr/lib/python2.3/site-packages/gtk-2.0'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;</pre></div></div>

<p>2. Modified test1.cfm</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;">     41         var options = {
     42                         controls: [new OpenLayers.Control.MouseDefaults()]
     43                       };
     44
     45         map = new OpenLayers.Map( $('map'), options);
     46
     47         var layer_base = new OpenLayers.Layer.WMS(
     48                     &quot;Base Layer&quot;,
     49                     &quot;<span style="color: #0000FF;">#request.mapserv_tile#</span>&quot;,
     50                     {
     51                         map: '/home/map/beijing/new/wms.map',
     52                         layers: '<span style="color: #0000FF;">#request.basemap_tile#</span>',
     53                         format: 'image/png', 'transparent': 'false'
     54                     }
     55                     );
     56
     57         var layer_road = new OpenLayers.Layer.WMS(
     58                     &quot;Road Layer&quot;,
     59                     &quot;<span style="color: #0000FF;">#request.mapserv_tile#</span>&quot;,
     60                     {
     61                         map: '/home/map/beijing/new/wms.map',
     62                         layers: '<span style="color: #0000FF;">#request.roads_tile#</span>',
     63                         format: 'image/png', 'transparent': 'true'
     64                     },
     65                     {
     66                         reproject: false
     67                     }
     68                     );
     69
     70         map.addLayer(layer_base);
     71         layer_base.setIsBaseLayer(true);
     72
     73         layer_road.setIsBaseLayer(false);
     74         map.addLayer(layer_road);</pre></div></div>

<p>3. tilecache.cfg. Commented metaTile=true http://222.128.19.19/tilecache/tilecache.cfg</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">     <span style="color: #000000;">47</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>basemap<span style="color: #7a0874; font-weight: bold;">&#93;</span>
     <span style="color: #000000;">48</span> <span style="color: #007800;"><span style="color: #7a0874; font-weight: bold;">type</span></span>=WMSLayer
     <span style="color: #000000;">49</span> <span style="color: #007800;">url</span>=http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>mapserv?<span style="color: #007800;">map</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>map<span style="color: #000000; font-weight: bold;">/</span>beijing<span style="color: #000000; font-weight: bold;">/</span>new<span style="color: #000000; font-weight: bold;">/</span>wms.map
     <span style="color: #000000;">50</span> <span style="color: #007800;">layers</span>=district,greens,major_river,minor_river
     <span style="color: #000000;">51</span> <span style="color: #666666; font-style: italic;">#bbox=-180,-90,180,90</span>
     <span style="color: #000000;">52</span> <span style="color: #666666; font-style: italic;">#metaTile=true</span>
     <span style="color: #000000;">53</span> <span style="color: #007800;">extension</span>=png
     <span style="color: #000000;">54</span>
     <span style="color: #000000;">55</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>roads<span style="color: #7a0874; font-weight: bold;">&#93;</span>
     <span style="color: #000000;">56</span> <span style="color: #007800;"><span style="color: #7a0874; font-weight: bold;">type</span></span>=WMSLayer
     <span style="color: #000000;">57</span> <span style="color: #007800;">url</span>=http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>mapserv?<span style="color: #007800;">map</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>map<span style="color: #000000; font-weight: bold;">/</span>beijing<span style="color: #000000; font-weight: bold;">/</span>new<span style="color: #000000; font-weight: bold;">/</span>wms.map
     <span style="color: #000000;">58</span> <span style="color: #666666; font-style: italic;">#layers=road4,road4label,road3,road3label,road2,road2label,road1,road1label,road11,road11label</span>
     <span style="color: #000000;">59</span> <span style="color: #666666; font-style: italic;">#bbox=116.1737,39.8211,116.5640,40.0799</span>
     <span style="color: #000000;">60</span> <span style="color: #666666; font-style: italic;">#maxresolution=1.40625</span>
     <span style="color: #000000;">61</span> <span style="color: #666666; font-style: italic;">#bbox=-180,-90,180,90</span>
     <span style="color: #000000;">62</span> <span style="color: #007800;">layers</span>=road1,road1label,road11,road11label
     <span style="color: #000000;">63</span> <span style="color: #007800;">extension</span>=png
     <span style="color: #000000;">64</span> <span style="color: #666666; font-style: italic;">#metaTile=true</span></pre></div></div>

<p>4. Modified wms.map http://222.128.19.19/tilecache/wms.map</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">OUTPUTFORMAT
     NAME png
     DRIVER <span style="color: #ff0000;">&quot;GD/PNG&quot;</span>
     MIMETYPE <span style="color: #ff0000;">&quot;image/png&quot;</span>
     IMAGEMODE RGB
     EXTENSION <span style="color: #ff0000;">&quot;png&quot;</span>
     FORMATOPTION <span style="color: #ff0000;">&quot;INTERLACE=OFF&quot;</span>
END</pre></div></div>

<p>5. Checked access_log. &#8220;transparent=true&#8221; exists&#8230;<br />
<code><br />
192.168.1.150 - - [30/Mar/2007:13:46:26 +0800] "GET /tilecache/tilecache.py?MAP=%2Fhome%2Fmap%2Fbeijing%2Fnew%2Fwms.map&amp;LAYERS=r<br />
oads&amp;FORMAT=image%2Fpng&amp;TRANSPARENT=true&amp;SERVICE=WMS&amp;VERSION=1.1.1&amp;REQUEST=G<br />
etMap&amp;STYLES=&amp;EXCEPTIONS=application%2Fvnd.ogc.se_inimage&amp;SRS=EPSG%3A4326&amp;BB<br />
OX=116.334229%2C39.891357%<br />
2C116.345215%2C39.902344&amp;WIDTH=256&amp;HEIGHT=256 HTTP/1.1" 200 14580<br />
</code></p>
<p>Now, this is really weird. I have &#8220;transparent&#8221;: true in test1.cfm all the time. That didn&#8217;t worked.</p>
<p>For every test iteration i made, I always tried clearing the cache, removing the python compiled scripts, then restarting Apache just to get a clean state..</p>
<p><code><br />
rm -Rf /usr/local/apache2/htdocs/tmp/*<br />
rm /wwwroot/tilecache/TileCache/*.pyc<br />
/etc/init.d/httpd restart<br />
</code></p>
<p>Then I tried appending &#8220;transparent=true&#8221; to tilecache.cfg based on Eric&#8217;s suggestion&#8230;<br />
That worked. Now I wonder why&#8230; Nevertheless, its working now. Again many thanks to everyone&#8230;</p>
<p>Rupert</p>
<p>On Fri, Mar 30, 2007 at 01:57:43PM +0800, Rupert de Guzman Jr wrote:<br />
&gt; Hi Everyone,<br />
&gt;<br />
&gt; Really appreciate all the replies&#8230;<br />
&gt; Then I tried appending &#8220;transparent=true&#8221; to tilecache.cfg based on<br />
&gt; Eric&#8217;s suggestion&#8230;<br />
&gt; That worked. Now I wonder why&#8230; Nevertheless, its working now. Again<br />
&gt; many thanks to everyone&#8230;</p>
<p>TileCache pays almost no attention to the URL: Only the BBOX and the layername matter. Anything else is simply ignored: so your transparency being set in OpenLayers actually has 0 affect.</p>
<p>The reason for this is that TileCache can only store one copy of an image. If the URL parameters modified the content, you could get an inconsistent cache.</p>
<p>This is &#8216;by design&#8217;, insofar as there is no obvious solution (other than to complain more loudly when TC Gets parameters it isn&#8217;t expecting, which is an outstanding FIXME in the code). The lack of error message is not by design, and I&#8217;m sorry you got bit by the poorly documented behavior.</p>
<p>Regards,<br />
&#8211;<br />
Christopher Schmidt<br />
MetaCarta</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/03/transparent-overlays-in-tilecache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting python_path on Unix</title>
		<link>/wordpress/2007/03/setting-python_path-on-unix/</link>
		<comments>/wordpress/2007/03/setting-python_path-on-unix/#comments</comments>
		<pubDate>Thu, 29 Mar 2007 13:17:54 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">/wordpress/?p=43</guid>
		<description><![CDATA[At the time of this writing.. download mod_python-3.3.1.tgz ./configure &#8211;with-apxs=/usr/local/apache2/bin/apxs make make install You need to pass the PYTHONPATH to apache.. AddHandler python-program .py PythonHandler TileCache.Service PythonOption TileCacheConfig /usr/local/apache2/htdocs/tilecache/tilecache.cfg PythonDebug On PythonPath &#8220;sys.path + ['/usr/local/apache2/htdocs/tilecache/']&#8221; In your bash shells, you could also check the PYTHONPATH&#8230; &#91;root@rupert-linux views&#93;# python Python 2.3.4 &#40;#1, Mar 10 2006, 06:12:09) [...]]]></description>
			<content:encoded><![CDATA[<p>At the time of this writing.. download mod_python-3.3.1.tgz</p>
<p>./configure &#8211;with-apxs=/usr/local/apache2/bin/apxs<br />
make<br />
make install</p>
<p>You need to pass the PYTHONPATH to apache..<br />
<directory><br />
AddHandler python-program .py<br />
PythonHandler TileCache.Service<br />
PythonOption TileCacheConfig /usr/local/apache2/htdocs/tilecache/tilecache.cfg<br />
PythonDebug On<br />
PythonPath &#8220;sys.path + ['/usr/local/apache2/htdocs/tilecache/']&#8221;<br />
</directory></p>
<p>In your bash shells, you could also check the PYTHONPATH&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #000000; font-weight: bold;">@</span>rupert-linux views<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #666666; font-style: italic;"># python</span>
Python 2.3.4 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #666666; font-style: italic;">#1, Mar 10 2006, 06:12:09)</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 3.4.5 <span style="color: #000000;">20051201</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 3.4.5-<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; import sys
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; print sys.path
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">''</span>, <span style="color: #ff0000;">'/usr/lib/python23.zip'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/plat-linux2'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/lib-tk'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/lib-dynload'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/site-packages'</span>, <span style="color: #ff0000;">'/usr/lib/python2.3/site-packages/gtk-2.0'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/03/setting-python_path-on-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TileCache Experiment</title>
		<link>/wordpress/2007/02/tilecache-experiment/</link>
		<comments>/wordpress/2007/02/tilecache-experiment/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 00:55:48 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[openlayers]]></category>

		<guid isPermaLink="false">/wordpress/?p=36</guid>
		<description><![CDATA[I am now able to do tilecache using TileCache1.3 from metacarta. Base from archives (archive-user.txt) From crschmidt at metacarta.com Wed Nov 22 17:54:29 2006 From: crschmidt at metacarta.com (Christopher Schmidt) Date: Wed, 22 Nov 2006 17:54:29 -0500 Subject: [OpenLayers-Users] TileCache - Tiling issues In-Reply-To: &#38;lt;4564D326.6020607@refractions.net&#38;gt; References: &#38;lt;4564D326.6020607@refractions.net&#38;gt; Message-ID: &#38;lt;20061122225429.GA18180@metacarta.com&#38;gt; &#160; On Wed, Nov 22, 2006 [...]]]></description>
			<content:encoded><![CDATA[<p>I am now able to do tilecache using TileCache1.3 from metacarta. Base from archives (archive-user.txt)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">From crschmidt at metacarta.com  Wed Nov 22 17:54:29 2006
From: crschmidt at metacarta.com (Christopher Schmidt)
Date: Wed, 22 Nov 2006 17:54:29 -0500
Subject: [OpenLayers-Users] TileCache - Tiling issues
In-Reply-To: &amp;lt;4564D326.6020607@refractions.net&amp;gt;
References: &amp;lt;4564D326.6020607@refractions.net&amp;gt;
Message-ID: &amp;lt;20061122225429.GA18180@metacarta.com&amp;gt;
&nbsp;
On Wed, Nov 22, 2006 at 02:45:58PM -0800, Ben Brehmer wrote:
&amp;gt; Hello everyone,
&amp;gt;
&amp;gt; I have setup a basic OpenLayers application with TileCache doing the
&amp;gt; server-side caching. I was wondering if there is a way to pre-cache all
&amp;gt; the tiles (besides panning/zooming everywhere on the map)? I know in
&amp;gt; kamap there is a script that can be run to pre-cache all the tiles. Is
&amp;gt; there something similair for TileCache?
&nbsp;
In the TileCache directory, there is a 'Client.py' script. To pre-cache
your data, use it in the following manner:
&nbsp;
python Client.py &quot;http://example.com/tilecachelocation/tilecache.cgi?&quot;
&quot;layername&quot; startzoomlevel endzoomlevel [BBOX]
&nbsp;
Something like:
&nbsp;
python Client.py &quot;http://labs.metacarta.com/wms-c/Basic.py?&quot; &quot;basic&quot; 0 16
&nbsp;
Is what we used to precache all of the Vmap0 data in the MetaCarta VMap0
layer.
&nbsp;
&amp;gt; Also, I have attached two jpegs. Each has part of a symbol or label
&amp;gt; chopped off. I believe that the &quot;chopping&quot; occurs at the edge of a tile.
&amp;gt; Has anyone ever experience something like this in OpenLayers?
&nbsp;
This is based on your Mapserver setup, rather than something specific in
OpenLayers. Using WMS would result in the same visual result. Labels can
have this prevented using the &quot;PARTIALS OFF&quot; on your label layer, if
you're using Mapserver. I'm not aware of a way to prevent this in symbol
generation. 
&nbsp;
We are currently working on ka-map style rendering to add to TileCache,
to help people not run into this issue. No timeframe available yet on
when that'll be released. 
&nbsp;
Regards,
--
Christopher Schmidt
MetaCarta</pre></div></div>

<p>1.  TileCache Configuration: tilecache.cfg</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[cache]
type=DiskCache
base=E:\\usr\\local\\apache2\\htdocs\\tmp\\
&nbsp;
[basemap]
type=WMSLayer
url=http://127.0.0.1/cgi-bin/mapserv.exe?map=/home/basemap/wmstest_longlat.map
layers=district,greens,major_river,minor_river
extension=png
&nbsp;
[roads]
type=WMSLayer
url=http://127.0.0.1/cgi-bin/mapserv.exe?map=/home/basemap/wmstest_longlat.map
layers=road4,road4label,road3,road3label,road2,road2label,road1,road1label,road11,road11label
extension=png</pre></div></div>

<p>2. Calling CFM Script: Test.cfm</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;">    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> request.mapserv<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;http://127.0.0.1/tilecache/tilecache.py&quot;</span><span style="color: #0000FF;">&gt;</span></span> 
&nbsp;
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">script</span> <span style="color: #0000FF;">src</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;/OpenLayers-2.2/lib/OpenLayers.js&quot;</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">script</span><span style="color: #0000FF;">&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">script</span> <span style="color: #0000FF;">type</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;text/javascript&quot;</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">script</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #808080; font-style: italic;">&lt;!--&lt;br /--&gt;</span>        //var lon = 116.3842;
        //var lat = 39.9150;
        var lon = 116.3846;
        var lat = 39.9202;
        var zoom = 16;
        var map, markers;
&nbsp;
        function init(){
      	    map = new OpenLayers.Map( $('map'), { maxResolution: 'auto'});
&nbsp;
	    var layer_base = new OpenLayers.Layer.WMS(
					&quot;Base Layer&quot;,
					&quot;<span style="color: #0000FF;">#request.mapserv#</span>&quot;,
					{
						layers: 'basemap',
						format: 'png', 'transparent': 'off'
					}
					);
&nbsp;
                map.addLayer(layer_base);
	   layer_base.setIsBaseLayer(true);	
&nbsp;
               ...more code here...
&nbsp;
       }
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfset</span><span style="color: #0000FF;">&gt;</span></span></pre></div></div>

<p>I want to fine tune this script since I am getting odd tiles like duplicate tiles or tiles shown of different scale on the same scale.</p>
<p>3. Precaching:<br />
/d/Python24/python.exe Client.py &#8220;http://127.0.0.1/tilecache/tilecache.py&#8221; &#8220;roads&#8221; 14 16 116.35397,39.88984,116.42988,39.91918</p>
<p>I need to understand the &#8220;cache hit&#8221; or &#8220;cache miss&#8221; during execution.</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/02/tilecache-experiment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TileCache for Windows Revisited</title>
		<link>/wordpress/2007/01/tilecache13/</link>
		<comments>/wordpress/2007/01/tilecache13/#comments</comments>
		<pubDate>Wed, 17 Jan 2007 03:50:27 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[tilecache]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_python]]></category>

		<guid isPermaLink="false">/wordpress/?p=22</guid>
		<description><![CDATA[1. Downloaded TileCache1.8 from http://www.tilecache.org/ 2. Get the current releases of python and mod_python. http://www.python.org/download/releases/2.5/ http://httpd.apache.org/modules/python-download.cgi -&#62; click on win32 binaries. Get the mod_python-3.3.1.win32-py2.5-Apache2.2.exe if your Apache is running on 2.2. http://www.pythonware.com/products/pil/ http://effbot.org/downloads/PIL-1.1.6.win32-py2.5.exe 3. Install python2.5 4. Install mod_python and python_imaging. 5. Edit httpd.conf LoadModule python_module modules/mod_python.so &#160; &#60;directory&#62; AddHandler python-program .py PythonHandler test PythonDebug [...]]]></description>
			<content:encoded><![CDATA[<p>1. Downloaded TileCache1.8 from <a href="http://www.tilecache.org/">http://www.tilecache.org/</a></p>
<p>2. Get the current releases of python and mod_python.<br />
<a href="http://www.python.org/download/releases/2.5/">http://www.python.org/download/releases/2.5/</a></p>
<p><a href="http://httpd.apache.org/modules/python-download.cgi">http://httpd.apache.org/modules/python-download.cgi</a> -&gt; click on win32 binaries. Get the mod_python-3.3.1.win32-py2.5-Apache2.2.exe  if your Apache is running on 2.2.</p>
<p><a href="http://www.pythonware.com/products/pil/">http://www.pythonware.com/products/pil/</a></p>
<p>http://effbot.org/downloads/PIL-1.1.6.win32-py2.5.exe</p>
<p>3. Install python2.5</p>
<p>4. Install mod_python and python_imaging.</p>
<p>5. Edit httpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LoadModule python_module modules<span style="color: #000000; font-weight: bold;">/</span>mod_python.so
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
AddHandler python-program .py
PythonHandler <span style="color: #7a0874; font-weight: bold;">test</span>
PythonDebug On
<span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
	AddHandler python-program .py .cgi
	PythonHandler TileCache.Service
	PythonOption TileCacheConfig <span style="color: #000000; font-weight: bold;">/</span>wwwroot<span style="color: #000000; font-weight: bold;">/</span>tilecache<span style="color: #000000; font-weight: bold;">/</span>tilecache.cfg
	PythonDebug On
<span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
ScriptInterpreterSource Registry
SetEnv PYTHONUNBUFFERED <span style="color: #000000;">1</span>
PassEnv PYTHONPATH</pre></div></div>

<p>6. run regedit. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.4\PythonPath. Append &#8220;E:\wwwroot\tilecache&#8221; to PYTHONPATH</p>
<p>D:\Python24\Lib;D:\Python24\DLLs;D:\Python24\Lib\lib-tk;E:\wwwroot\tilecache;</p>
<p>7. Put D:\Python24 in your WINDOWS PATH</p>
<p>8. Test if apache could read python by http://127.0.0.1/pytest/test.py</p>
<p>9. http://127.0.0.1/tilecache/test1.cfm</p>
<p>10. tilecache_seed.py &#8220;http://127.0.0.1/tilecache/tilecache.py&#8221; roads 12 17 &#8220;116.28229,39.85291,116.48657,39.98783&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/01/tilecache13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing MS4W, Python2.4, ColdFusion6.1</title>
		<link>/wordpress/2007/01/installing-ms4w-python24-coldfusion61/</link>
		<comments>/wordpress/2007/01/installing-ms4w-python24-coldfusion61/#comments</comments>
		<pubDate>Tue, 16 Jan 2007 23:55:12 +0000</pubDate>
		<dc:creator>rupert</dc:creator>
				<category><![CDATA[mapserver]]></category>
		<category><![CDATA[ms4w]]></category>
		<category><![CDATA[cf]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">/wordpress/?p=21</guid>
		<description><![CDATA[For Windows: A. Installing MS4W 1. Download ms4w2.2 from maptools.org 2. Extract ms4w2.2 into your root drive (E:\) 3. Run E:\ms4w\apache-install.bat. This would install apache2.2 as a service. 4. Edit E:\ms4w\Apache\conf\httpd.conf to reflect your webroot in &#8220;DocumentRoot&#8221; (E:\wwwroot\) 149 DocumentRoot &#34;/wwwroot&#34; ... .... 177 &#60;directory&#62; # # Possible values for the Options directive are &#34;None&#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>For Windows:</p>
<p><strong>A.  Installing MS4W</strong><br />
1. Download ms4w2.2 from <a href="http://www.maptools.org/ms4w/index.phtml?page=downloads.html">maptools.org</a></p>
<p>2. Extract ms4w2.2 into your root drive (E:\)</p>
<p>3. Run E:\ms4w\apache-install.bat. This would install apache2.2 as a service.</p>
<p>4. Edit E:\ms4w\Apache\conf\httpd.conf to reflect your webroot in &#8220;DocumentRoot&#8221; (E:\wwwroot\)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">149</span> DocumentRoot <span style="color: #ff0000;">&quot;/wwwroot&quot;</span>
...
....
<span style="color: #000000;">177</span> <span style="color: #000000; font-weight: bold;">&lt;</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Possible values for the Options directive are &quot;None&quot;, &quot;All&quot;,</span>
    <span style="color: #666666; font-style: italic;"># or any combination of:</span>
    <span style="color: #666666; font-style: italic;">#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;</span>
    <span style="color: #666666; font-style: italic;"># doesn't give it to you.</span>
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># The Options directive is both complicated and important.  Please see</span>
    <span style="color: #666666; font-style: italic;"># http://httpd.apache.org/docs/2.2/mod/core.html#options</span>
    <span style="color: #666666; font-style: italic;"># for more information.</span>
    <span style="color: #666666; font-style: italic;">#</span>
    Options Indexes FollowSymLinks
&nbsp;
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># AllowOverride controls what directives may be placed in .htaccess files.</span>
    <span style="color: #666666; font-style: italic;"># It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords:</span>
    <span style="color: #666666; font-style: italic;">#   Options FileInfo AuthConfig Limit</span>
    <span style="color: #666666; font-style: italic;">#</span>
    AllowOverride None
&nbsp;
    <span style="color: #666666; font-style: italic;">#</span>
    <span style="color: #666666; font-style: italic;"># Controls who can get stuff from this server.</span>
    <span style="color: #666666; font-style: italic;">#</span>
    Order allow,deny
    Allow from all
<span style="color: #000000;">205</span> <span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
....
....
<span style="color: #000000;">212</span> DirectoryIndex index.html index.html.var index.php index.phtml index.php3 index.cfm
....
....</pre></div></div>

<p>5. Test apache, navigate to &#8220;http://127.0.0.1/&#8221;.</p>
<p><strong>B. Configuring Apache2.2 with ColdFusion6.1</strong><br />
6. Since Apache2.2 was released after CF6.1 and CF7.0 then, it would only bind with Apache2.0.x. We need a new wsconfig.jar that would bind with Apache2.2.x. Read more about the technote:<br />
<a href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8001e97">http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8001e97</a></p>
<p>Alternatively, you could download wsconfig.jar from <a href="http://www.adobe.com/support/coldfusion/ts/documents/8001e97/wsconfig.zip">http://www.adobe.com/support/coldfusion/ts/documents/8001e97/wsconfig.zip</a></p>
<p>7. Backup your existing wsconfig.jar to wsconfig.jar.bak. Replace the wsconfig.jar.</p>
<p>8. Restart ColdFusion.</p>
<p>9. Remove existing connectors from D:\CFusionMX\bin\connectors\Remove_ALL_connectors.bat</p>
<p>10. Execute D:\CFusionMX\bin\connectors\Apache_connector.bat</p>

<div class="wp_syntax"><div class="code"><pre class="winbatch" style="font-family:monospace;"><span style="color: #66cc66;">@</span>echo <span style="color: #0080FF; font-weight: bold;">off</span>
echo WARNING<span style="color: #66cc66;">!</span>  This will install the ColdFusion MX Apache Connector.
echo Press Control<span style="color: #66cc66;">+</span>C <span style="color: #800080;">to</span> abort.
<span style="color: #0000FF;">pause</span>
SETLOCAL
PATH=..\..\runtime\jre\bin<span style="color: #008000; font-style: italic;">;%PATH%</span>
java <span style="color: #66cc66;">-</span>jar ..\..\runtime\lib\wsconfig.jar  <span style="color: #66cc66;">-</span>ws apache <span style="color: #66cc66;">-</span>bin <span style="color: #ff0000;">&quot;e:\\ms4w\Apache\bin\httpd.exe&quot;</span> <span style="color: #66cc66;">-</span>dir <span style="color: #ff0000;">&quot;e:\\ms4w\apache\conf&quot;</span> <span style="color: #66cc66;">-</span>map .cfm,.cfc,.cfml <span style="color: #66cc66;">-</span>coldfusion <span style="color: #66cc66;">-</span>v
ENDLOCAL</pre></div></div>

<p>11. Restart Apache and ColdFusion. Browse to <a href="http://127.0.0.1/cfide/administrator/index.cfm">http://127.0.0.1/cfide/administrator/index.cfm</a></p>
<p><strong>C. Installing Python2.4</strong><br />
1. Read Reference document from <a href="http://www.maptools.org/ms4w/index.phtml?page=README_INSTALL.html">maptools.org install site</a></p>
<p>2. Download Python2.4 from <a href="http://www.python.org/ftp/python/2.4/python-2.4.msi">http://www.python.org/ftp/python/2.4/python-2.4.msi</a>. Download mod_python from <a href="http://www.eng.lsu.edu/mirrors/apache/httpd/modpython/win/3.3.0b/mod_python-3.3.0b.win32-py2.4-Apache2.2.exe">mod_python-3.3.0b.win32-py2.4-Apache2.2.exe</a></p>
<p>3. Install Python2.4 in your root drive. (D:\)</p>
<p>4. Install mod_python-3.3.0b.win32-py2.4-Apache2.2.exe</p>
<p>5. Edit your Windows Environment Variables (System Variable: PATH) to include &#8220;D:\Python23&#8243;</p>
<p>6. Edit E:\ms4w\Apache\conf\httpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#For Python</span>
LoadModule python_module modules<span style="color: #000000; font-weight: bold;">/</span>mod_python.so
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
	AddHandler python-program .py
	PythonHandler <span style="color: #7a0874; font-weight: bold;">test</span>
	PythonDebug On
<span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
ScriptInterpreterSource Registry
SetEnv PYTHONUNBUFFERED <span style="color: #000000;">1</span>
PassEnv PYTHONPATH</pre></div></div>

<p>7. Restart Apache and test from <a href="http://127.0.0.1/pytest/test.py">http://127.0.0.1/pytest/test.py</a>. If you see a &#8220;Hello World&#8221; web page from python then you are good to go. Sample python test page &#8220;test.py&#8221;:<br />
E:\wwwroot\pytest\test.py</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> mod_python <span style="color: #ff7700;font-weight:bold;">import</span> apache
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> handler<span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span>:
	req.<span style="color: black;">content_type</span> = <span style="color: #483d8b;">'text/plain'</span>
	req.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello World!&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> apache.<span style="color: black;">OK</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>/wordpress/2007/01/installing-ms4w-python24-coldfusion61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

