<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>Here's my setup (see full mapfile & OpenLayers config at the end):</div><div><br></div><div>When the PROJECTION block of the mapfile is set to 4326, I get square pixels: </div><div><div><a href="http://i.imgur.com/jDQrxKH.png">http://i.imgur.com/jDQrxKH.png</a></div></div><div><br></div><div>where the WMS request looks something like:</div><div><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">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</a><br></div><div><br></div><div><div><br></div></div><div>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:</div><div><div><a href="http://i.imgur.com/bw4pNPX.png">http://i.imgur.com/bw4pNPX.png</a><br></div></div><div><div><br></div><div>where the WMS request looks something like:</div><div><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">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</a><br></div></div><div><br></div><div>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"`</div><div><br></div><div>Thanks,</div><div>Pete</div><div><br></div><div>### Mapserver mapfile-4326.map</div><div><div>MAP</div><div>        OUTPUTFORMAT</div><div>                NAME png24</div><div>                DRIVER "AGG/PNG"</div><div>                MIMETYPE "image/png"</div><div>                IMAGEMODE RGB</div><div>                EXTENSION "png"</div><div>        END</div><div><br></div><div>        IMAGETYPE PNG24</div><div>        IMAGECOLOR 255 255 255</div><div><br></div><div>        PROJECTION</div><div>                "init=epsg:4326"</div><div>        END</div><div><br></div><div>        NAME "mosaic_wms_server"</div><div><br></div><div>        WEB</div><div>                METADATA</div><div>                        "ows_title" "mosaics"</div><div>                        "ows_onlineresource" "<a href="http://localhost:8080/?MAP=/mapfile-4326.map">http://localhost:8080/?MAP=/mapfile-4326.map</a>"</div><div>                        "ows_srs" "EPSG:4326"</div><div>                        "ows_enable_request" "*"</div><div>                        "wms_feature_info_mime_type" "text/html"</div><div>                END</div><div>        END</div><div><br></div><div>        MAXSIZE 4096</div><div><br></div><div>        LAYER</div><div>                NAME            "image_4326"</div><div>                METADATA</div><div>                        "ows_title"     "image stored in 4326"</div><div>                        "ows_srs"       "EPSG:4326 EPSG:3857"</div><div>                END</div><div>                DATA       "/path/to/image.tif"</div><div>                STATUS          OFF</div><div>                TYPE            RASTER</div><div>                PROJECTION</div><div>                        "+init=epsg:4326"</div><div>                END</div><div>        END<br></div><div>END</div></div><div><br></div><div>### OpenLayers-3 configuration for 4326: <br><br></div><div><div>var map = new ol.Map({</div><div>    layers: [</div><div>        new ol.layer.Tile({</div><div>            title: 'Test 4326',</div><div>            source: new ol.source.TileWMS({</div><div>                url: '<a href="http://localhost:8080/mapserv">http://localhost:8080/mapserv</a>',</div><div>                params: {</div><div>                    'LAYERS': 'image_4326',</div><div>                    'MAP': '/mapfile-4326.map'</div><div>                }</div><div>            })</div><div>        })</div><div>    ],</div><div>    target: 'map',</div><div>    view: new ol.View({projection: "EPSG:4326", center: [-2.8126,55.8868],zoom: 20})</div><div>});</div></div><div><div>
</div></div></div>