<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.Shkpostityyli17
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">I do not quite believe that your output pixels are non-square. I rather think that what you see are views of the native
4326 pixels reprojected into 3857. In Scotland (7536002 N in epsg:3857) projecting data from 4326 to 3857 is making quite a big stretch in Nort-South direction. With your test GetMap request the pixel size in output is about 2.33 millimeters which must mean
heavy oversampling.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">Peter Schmitt wrote:<br>
[mapserver-users] Non-square pixels when re-projecting on the fly<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">>Hi,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">>I have a GeoTIFF in EPSG:4326. I want to re-project on the fly to 3857. The imagery looks good, but one thing confuses me: Pixels aren't square when zoomed in very far with OpenLayers.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Here's my setup (see full mapfile & OpenLayers config at the end):<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">When the PROJECTION block of the mapfile is set to 4326, I get square pixels: <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><a href="http://i.imgur.com/jDQrxKH.png"><span lang="EN-US">http://i.imgur.com/jDQrxKH.png</span></a><span lang="EN-US"><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">where the WMS request looks something like:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><a href="http://localhost:8080/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=image_4326&MAP=/mapfile-4326.map&WIDTH=256&HEIGHT=256&CRS=EPSG%3A4326&STYLES=&BBOX=55.8872526884079%2C-2.8125375509262085%2C55.88725805282593%2C-2.8125321865081787"><span lang="EN-US">http://localhost:8080/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&LAYERS=image_4326&MAP=/mapfile-4326.map&WIDTH=256&HEIGHT=256&CRS=EPSG%3A4326&STYLES=&BBOX=55.8872526884079%2C-2.8125375509262085%2C55.88725805282593%2C-2.8125321865081787</span></a><span lang="EN-US"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">When the PROJECTION block of the mapfile is set to 3857 and I change the OpenLayers view to have projection: 'EPSG:3857' and set the center to coordinates in meters, I get rectangular pixels:<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><a href="http://i.imgur.com/bw4pNPX.png"><span lang="EN-US">http://i.imgur.com/bw4pNPX.png</span></a><span lang="EN-US"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">where the WMS request looks something like:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><a href="http://localhost:8080/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2FpngLAYERS=image_3857&MAP=/mapfile-3857.map&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&STYLES=&BBOX=-313090.24800606444%2C7536002.4584995285%2C-313089.65084178094%2C7536003.055663812"><span lang="EN-US">http://localhost:8080/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2FpngLAYERS=image_3857&MAP=/mapfile-3857.map&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&STYLES=&BBOX=-313090.24800606444%2C7536002.4584995285%2C-313089.65084178094%2C7536003.055663812</span></a><span lang="EN-US"><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Side-note for anyone finding this thread in the future... When I re-project a layer with a tileindex, I occasionally get banding at certain zoom levels unless I add this to my LAYER: `PROCESSING "RESAMPLE=AVERAGE"`<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Thanks,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Pete<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">### Mapserver mapfile-4326.map<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">MAP<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> OUTPUTFORMAT<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> NAME png24<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> DRIVER "AGG/PNG"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> MIMETYPE "image/png"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> IMAGEMODE RGB<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> EXTENSION "png"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> IMAGETYPE PNG24<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> IMAGECOLOR 255 255 255<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> PROJECTION<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "init=epsg:4326"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> NAME "mosaic_wms_server"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> WEB<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> METADATA<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_title" "mosaics"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_onlineresource" "</span><a href="http://localhost:8080/?MAP=/mapfile-4326.map"><span lang="EN-US">http://localhost:8080/?MAP=/mapfile-4326.map</span></a><span lang="EN-US">"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_srs" "EPSG:4326"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_enable_request" "*"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "wms_feature_info_mime_type" "text/html"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> MAXSIZE 4096<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> LAYER<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> NAME "image_4326"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> METADATA<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_title" "image stored in 4326"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "ows_srs" "EPSG:4326 EPSG:3857"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> DATA "/path/to/image.tif"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> STATUS OFF<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> TYPE RASTER<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> PROJECTION<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> "+init=epsg:4326"<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> END<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">END<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">### OpenLayers-3 configuration for 4326: <o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">var map = new ol.Map({<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> layers: [<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> new ol.layer.Tile({<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> title: 'Test 4326',<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> source: new ol.source.TileWMS({<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> url: '</span><a href="http://localhost:8080/mapserv"><span lang="EN-US">http://localhost:8080/mapserv</span></a><span lang="EN-US">',<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> params: {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> 'LAYERS': 'image_4326',<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> 'MAP': '/mapfile-4326.map'<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> })<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> })<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> ],<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> target: 'map',<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> view: new ol.View({projection: "EPSG:4326", center: [-2.8126,55.8868],zoom: 20})<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">});<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>