<?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>spatial nodes &#187; Geoserver</title>
	<atom:link href="http://blog.minst.net/tag/geoserver/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.minst.net</link>
	<description>Thoughts of a lost soul</description>
	<lastBuildDate>Mon, 23 Jan 2012 16:33:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Perceived WCS inaccuracy</title>
		<link>http://blog.minst.net/2009/12/09/perceived-wcs-inaccuracy</link>
		<comments>http://blog.minst.net/2009/12/09/perceived-wcs-inaccuracy#comments</comments>
		<pubDate>Wed, 09 Dec 2009 12:03:56 +0000</pubDate>
		<dc:creator>stvn</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Deegree]]></category>
		<category><![CDATA[Geoserver]]></category>
		<category><![CDATA[Mapserver]]></category>
		<category><![CDATA[WCS]]></category>

		<guid isPermaLink="false">http://blog.minst.net/?p=178</guid>
		<description><![CDATA[Working with WCS I discovered a small but noticable shift of data in all three major OSS WCS applications: Geoserver 2.0 (SNAPSHOT downloaded 8 december 10.19UTC) Mapserver 5.6.0 (MS4W Base installer v3.0 Beta 7 + MapServer 5.6.0 release Upgrade) Deegree 2.3rc1 (Apache Tomcat 5.5.28) To find out what the problem exactly was I&#8217;ve done some [...]]]></description>
			<content:encoded><![CDATA[<p>Working with WCS I discovered a small but noticable shift of data in all three major OSS WCS applications:</p>
<ul>
<li> Geoserver 2.0 (SNAPSHOT downloaded 8 december 10.19UTC)</li>
<li> Mapserver 5.6.0 (MS4W Base installer v3.0 Beta 7 + MapServer 5.6.0 release Upgrade)</li>
<li> Deegree 2.3rc1 (Apache Tomcat 5.5.28)</li>
</ul>
<p>To find out what the problem exactly was I&#8217;ve done some testing. I&#8217;ve taken a GeoTiff and configured all three the WCS applications to serve it. Gdalinfo gives us the following <a title="gdalinfo" href="http://blog.minst.net/wp-content/uploads/2009/12/gdalinfo.txt" target="_blank">information</a>, basically it is a GeoTIFF in epsg:3035 with a native resolution of 100m/pixel.</p>
<p><span id="more-178"></span></p>
<p>My test sequence was:</p>
<ol>
<li>request the full extent in native resolution</li>
<li>request the full extent in a 10th of the resolution</li>
<li>request the full extent with the same size as the original data (256&#215;256)</li>
<li>request part of the data in native resolution</li>
<li>request part of the data in non-native, non-multiple resolution</li>
</ol>
<p>I&#8217;m not going to show all the results here, because that would result in an unhealthy long document <img src='http://blog.minst.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>To verify the results I loaded the original GeoTiff in Quantum GIS and highlighted a specific feature to show the possible offset of the different results.</p>
<blockquote>
<pre><!--
		@page { size: 8.5in 11in; margin: 0.79in }
		P { margin-bottom: 0.08in }
--></pre>
</blockquote>
<div id="attachment_179" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/basicdata.png" rel="lightbox[178]"><img class="size-full wp-image-179" title="basicdata" src="http://blog.minst.net/wp-content/uploads/2009/12/basicdata.png" alt="Corine GeoTiff" width="590" height="548" /></a><p class="wp-caption-text">Corine GeoTiff</p></div>
<h3>1  request the full extent in native resolution:</h3>
<p>deegree: http://localhost:8080/deegree-wcs1/services?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=100&amp;resy=100&amp;format=GeoTIFF gives a three band(!) GeoTiff of 262,674 bytes with a shift of around 40m:</p>
<div id="attachment_181" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/deegreefull.png" rel="lightbox[178]"><img class="alignnone size-full wp-image-180" title="deegreefull" src="http://blog.minst.net/wp-content/uploads/2009/12/deegreefull.png" alt="deegreefull" width="590" height="548" /></a><p class="wp-caption-text">Deegree result</p></div>
<p>MapServer: http://localhost/cgi-bin/mapserver56/mapserv.exe?map=maps/corine.map&amp;service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=100&amp;resy=100&amp;format=GTiff gives a three band(!) GeoTiff of 197,477 bytes without a shift:</p>
<div id="attachment_182" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/mapserverfull.png" rel="lightbox[178]"><img class="size-full wp-image-182" title="mapserverfull" src="http://blog.minst.net/wp-content/uploads/2009/12/mapserverfull.png" alt="Mapserver result" width="590" height="548" /></a><p class="wp-caption-text">Mapserver result</p></div>
<p>GeoServer: http://localhsot:8081/geoserver/ows?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=corine_merge_gtiff_proj_121_108&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=100&amp;resy=100&amp;format=GeoTiff gives a single band GeoTiff of 8,848 bytes with a shift of  around 50m:</p>
<p style="margin-bottom: 0in;">
<div id="attachment_183" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/geoserverfull.png" rel="lightbox[178]"><img class="size-full wp-image-183" title="geoserverfull" src="http://blog.minst.net/wp-content/uploads/2009/12/geoserverfull.png" alt="Geoserver result" width="590" height="548" /></a><p class="wp-caption-text">Geoserver result</p></div>
<h3>Note:</h3>
<p>Deegree both shifts the data and returns a multi-band image; Mapserver doesn&#8217;t shift the data, but returns a multi-band image; Geoserver shifts the data 1/2 a pixel (50m), but does give a single band image.</p>
<h3>2. request the full extent in a 10th of the resolution</h3>
<p>deegree: http://localhost:8080/deegree-wcs1/services?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=10&amp;resy=10&amp;format=GeoTIFF produces a 26,237,726 multi band GeoTiff which shifts the data the other way than the first request:</p>
<div id="attachment_184" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/deegreetenth.png" rel="lightbox[178]"><img class="size-full wp-image-184" title="deegreetenth" src="http://blog.minst.net/wp-content/uploads/2009/12/deegreetenth.png" alt="Deegree result on a tenth of the resolution" width="590" height="548" /></a><p class="wp-caption-text">Deegree result on a tenth of the resolution</p></div>
<p>Mapserver: <!-- 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } -->http://localhost/cgi-bin/mapserver56/mapserv.exe?map=maps/corine.map&amp;service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=10&amp;resy=10&amp;format=GTiff produces a multi-band GeoTiff of 19,681,941 bytes with no shift.</p>
<p>Geoserver: http://localhost:8081/geoserver/ows?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=corine_merge_gtiff_proj_121_108&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;resx=10&amp;resy=10&amp;format=GeoTiff gives a single band GeoTiff of 158,802 bytes with a shift of around 50m, though there is a small difference with the previous result.</p>
<h3>Note:</h3>
<p>Mapserver and Geoserver both produce a bigger result  (as expected) with the same location as the previous request. Deegree shifts the data differently than previously and also produces a bigger result.</p>
<p style="margin-bottom: 0in;">
<h3>3. request the full extent with the same size as the original data (256&#215;256)</h3>
<p><!-- 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-bottom: 0in;">geoserver: http://localhost:8081/geoserver/ows?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=corine_merge_gtiff_proj_121_108&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;width=256&amp;height=256&amp;format=GeoTiff produces exactly the same image as in the first request.</p>
<p style="margin-bottom: 0in;">mapserver: http://localhost/cgi-bin/mapserver56/mapserv.exe?map=maps/corine.map&amp;service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;width=256&amp;height=256&amp;format=GTiff produces exactly the same image as in the first request.</p>
<p style="margin-bottom: 0in;">deegree: http://localhost:8080/deegree-wcs1/services?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;crs=EPSG:3035&amp;BBOX=3539200,3402400,3564800,3428000&amp;width=256&amp;height=256&amp;format=GeoTIFF produces a slightly smaller image than the first request (262,674 bytes) with no shift!.</p>
<p style="margin-bottom: 0in;">
<div id="attachment_189" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/deegreefixedsize.png" rel="lightbox[178]"><img class="size-full wp-image-189" title="deegreefixedsize" src="http://blog.minst.net/wp-content/uploads/2009/12/deegreefixedsize.png" alt="Deegree result with width en height" width="590" height="548" /></a><p class="wp-caption-text">Deegree result with width en height</p></div>
<h3>Note:</h3>
<p>Since the request is a different way of describing the same data one would expect that you get the same results. Mapserver and Geoserver do so, Deegree does not, somehow using resx and resy in the request results in shifted data.</p>
<h3>4. request part of the data in native resolution</h3>
<p>deegree: http://localhost:8080/deegree-wcs1/services?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;resx=100&amp;resy=100&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200&amp;format=GeoTIFF has the correct left-top location but the size of the pixels is wrong, producing a shift of the data which increases as you go right/down:</p>
<div id="attachment_185" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/deegreepart.png" rel="lightbox[178]"><img class="size-full wp-image-185" title="deegreepart" src="http://blog.minst.net/wp-content/uploads/2009/12/deegreepart.png" alt="Deegree result for a part request" width="590" height="548" /></a><p class="wp-caption-text">Deegree result for a part request</p></div>
<p>geoserver: http://localhost:8081/geoserver/ows?service=WCS&amp;request=GetCoverage&amp;format=GeoTiff&amp;version=1.0.0&amp;coverage=geodan:Corine&amp;resx=100&amp;resy=100&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200 produces an image with almost exactly the same shift as the first request.<br />
mapserver: http://localhost/cgi-bin/mapserver56/mapserv.exe?map=maps/corine.map&amp;service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;resx=100&amp;resy=100&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200&amp;format=GTiff produces an image with almost exactly the same location as the first request.</p>
<h3>Note:</h3>
<p>Mapserver and Geoserver shift (or not) the data similar to the first request, Deegree has once again a different shift than any of the previous ones.</p>
<h3>5. request part of the data in non-native, non-multiple resolution</h3>
<p>deegree: http://localhost:8080/deegree-wcs1/services?service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;resx=30.0&amp;resy=30.0&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200&amp;format=GeoTIFF shifts data:</p>
<p><a href="http://blog.minst.net/wp-content/uploads/2009/12/deegreepartnonnative.png" rel="lightbox[178]"><img class="size-full wp-image-186" title="deegreepartnonnative" src="http://blog.minst.net/wp-content/uploads/2009/12/deegreepartnonnative.png" alt="Deegree result for non native, non multiple=" height="548" /></a></p>
<p>geoserver: http://localhost:8081/geoserver/ows?service=WCS&amp;request=GetCoverage&amp;format=GeoTiff&amp;version=1.0.0&amp;coverage=geodan:Corine&amp;resx=30.0&amp;resy=30.0&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200 shifts data and adds a black border to the left and top of the result:</p>
<div id="attachment_187" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/geoserverpartnonnative.png" rel="lightbox[178]"><img class="size-full wp-image-187" title="geoserverpartnonnative" src="http://blog.minst.net/wp-content/uploads/2009/12/geoserverpartnonnative.png" alt="Geoserver result for non-native, non-multiple resolution" width="590" height="548" /></a><p class="wp-caption-text">Geoserver result for non-native, non-multiple resolution</p></div>
<p>mapserver: http://localhost/cgi-bin/mapserver56/mapserv.exe?map=maps/corine.map&amp;service=WCS&amp;version=1.0.0&amp;request=GetCoverage&amp;coverage=Corine&amp;resx=30.0&amp;resy=30.0&amp;crs=EPSG:3035&amp;BBOX=3550000,3413200,3554000,3417200&amp;format=GTiff shifts data:</p>
<div id="attachment_188" class="wp-caption alignnone" style="width: 600px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/mapserverpartnonnative.png" rel="lightbox[178]"><img class="size-full wp-image-188" title="mapserverpartnonnative" src="http://blog.minst.net/wp-content/uploads/2009/12/mapserverpartnonnative.png" alt="Mapserver result for non-native, non-multiple resolution" width="590" height="548" /></a><p class="wp-caption-text">Mapserver result for non-native, non-multiple resolution</p></div>
<h3>Note:</h3>
<p>This request was my initial prompt to find out why all WCS applications shift the data in the results. However this is a false conclusion. What&#8217;s happening here is that the service has to extract 30m wide pixels from 100m wide source data, since 100 divided by 30 isn&#8217;t a whole number it will add the remaining 10m in an adjacent pixel. If you overlay the result and the source data you get a pixel problem, data of source pixel 2 will most likely end up in result pixel b, which is partly over source pixel 1, resulting in a data shift:</p>
<div id="attachment_190" class="wp-caption alignnone" style="width: 311px"><a href="http://blog.minst.net/wp-content/uploads/2009/12/pixelproblem.png" rel="lightbox[178]"><img class="size-full wp-image-190" title="pixelproblem" src="http://blog.minst.net/wp-content/uploads/2009/12/pixelproblem.png" alt="Overlapping 100m with 30m" width="301" height="229" /></a><p class="wp-caption-text">Overlapping 100m with 30m</p></div>
<h2>Conclusion:</h2>
<p>Geoserver has a <span style="text-decoration: line-through;">bug </span>feature which offsets all the results by half a pixel,<span style="text-decoration: line-through;"> this is a known issue with the definition of the location of a pixel</span>. Added to this there&#8217;s the no-data border which appears with non-native, non-multiple requests.<span style="text-decoration: line-through;"> I presume that will be gone once the pixel issue is resolved.</span> (update: apparently I&#8217;ve misunderstood the Geoserver developers; there&#8217;s an issue between pixel placement according to standards and real world implementations, where Geoserver adheres to the standard).</p>
<p>Mapserver doesn&#8217;t offset the data unless it is physically impossible (non-native, non-multiple resolutions, extents which don&#8217;t snap to source data) but produces<span style="text-decoration: line-through;"> a multi-band</span> (this was a configuration issue, thanks to FrankW for spotting this &#8211; proper config is IMAGEMODE BYTE) geotiff where the source data is single band.</p>
<p>Deegree has a bug which offsets some of the results, but I don&#8217;t know what causes it and although it is resolution-related I don&#8217;t see a pattern. It also produces a multi-band geotiff instead of a single band.</p>
<p style="margin-bottom: 0in;">Configuration files and source data can be found <a href="http://dl.dropbox.com/u/175548/data.zip">here</a>.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;"><!-- 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } --></p>
<p style="margin-top: 0.17in; page-break-before: always; page-break-after: avoid;"><span style="font-family: Arial,sans-serif;"><span style="font-size: medium;">Geoserver 2.0 SNAPSHOT downloaded 8 december 10.19 UTC </span></span></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.minst.net/2009/12/09/perceived-wcs-inaccuracy/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

