<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=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        mso-fareast-language:EN-GB;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks for the response.  However, I am not in control of the WMS maps supplied.  I certainly cannot insist that the customer re-projects his entire WMS contents.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I am looking for a way to make the client (openLayers) adjust the projection (to its native spherical Mercator) prior to display?  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Incidentally, WorldWind has no problem displaying maps from the very same WMS and displaying a square OS grid.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Richard Greenwood [mailto:richard.greenwood@gmail.com] <br><b>Sent:</b> 25 May 2013 16:03<br><b>To:</b> Smart, Gary<br><b>Cc:</b> OpenLayers<br><b>Subject:</b> [External] Re: [OpenLayers-Users] EPSG:4326 WMS map aspect ratio<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>I would suggest that you use an appropriate map projection for your area of interest. That's what projections are for. Ideally you project all your data and save it in that projection, although it is possible to reproject on the server, or on the client.<o:p></o:p></p></div><p class=MsoNormal>Rich<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Wed, May 22, 2013 at 7:59 AM, Smart, Gary <<a href="mailto:Gary.Smart@utas.utc.com" target="_blank">Gary.Smart@utas.utc.com</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I really would like to display the contents of my local WMS in a form which the users are used to (i.e. square OS grids, rather than the ‘squashed’ appearance which comes from mapping the EPSG:4326 onto a flat-Earth projection in high latitudes).  I have found numerous examples of’ how to resolve this problem’, but none seem to have any effect on the distortion OR they result in no map being displayed at all.  I cannot connect directly to map servers on the web (spherical Mercator), because my system is an isolated network and the maps are supplied by the customer.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Salient extracts from the js code follow:<o:p></o:p></p><pre style='background:white'><span style='background:#F0F0F0'>        var map, options = { </span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             projection: new OpenLayers.Projection('EPSG:4326'), </span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             //displayProjection: new OpenLayers.Projection(‘EPSG:3574’),</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             //units: ‘m’,</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             //maxResolution: 156543.0339,</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             //maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                             zoom: 14</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>                           };</span><o:p></o:p></pre><pre style='background:white'><span style='background:#F0F0F0'>        map = new OpenLayers.Map('map', options);</span><o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>        <span style='color:blue'>var</span> my50kLayer = <span style='color:blue'>new</span> OpenLayers.Layer.WMS( <span style='color:maroon'>"OpenLayers WMS"</span>, </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                   <span style='color:maroon'>"<a href="http://expdev2/cgi-bin/wms?" target="_blank">http://expdev2/cgi-bin/wms?</a>"</span>, </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                   {</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                     layers: <span style='color:maroon'>'UK_ASRP_1to50000'</span>,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                     format: <span style='color:maroon'>'image/png'</span>,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                     <span style='color:green'>//transparent: 'true',</span></span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                    continuousWorld: true,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                     attribution: <span style='color:maroon'>"OS 1:50K"</span>,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;background:white'><span style='font-size:10.0pt;font-family:"Courier New";background:#F0F0F0'>                                                   }); </span><o:p></o:p></p><pre style='background:white'><span style='background:#F0F0F0'>        map.addLayers([my50kLayer]);</span><o:p></o:p></pre><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>As the code exists above, the displayed map works fine (apart from the squished grid rectangles).  Having adapted the ‘measure example’ from the OpenLayers examples page, I can measure from the map, and if the geodesic selection is made, the measurements are clearly correct (1Km across both dimensions of the OS grid).  With geodesic selection not clicked, the measurement across the map is approximately 1.5Km.  So the transforms and projections are clearly in sync.  But how do I stretch the maps in the ‘y’ direction so they appear equant (not squished vertically)?<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Adding the displayProjection seems to do nothing.  Using any of the other options with my WMS, results in a blank map.<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I have also plagiarised the polar-projections example from the OpenLayers example site, and replace the buttons with the following projections:<o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>var projectionOptions = </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>    {</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        'EPSG:4326':</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        {</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>            projection: new OpenLayers.Projection('EPSG:4326')</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        },</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        'EPSG:3857':</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        {</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>            projection: new OpenLayers.Projection('EPSG:3857'),</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>            maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>            maxResolution: 5505054 / 128,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>            numZoomLevels: 18</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>        }</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>    }; // end projectionOptions array</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>And I have applied the projections as per the example code (i.e. setProjection function was copied and is being called).  However, pressing EPSG:3857 button results in a blank map, and pressing EPSG:4326 after that, also results in a blank map (albeit with a white pair of tiles in the middle)!</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>Can anyone tell me whether it is possible to display a square grid for OS maps coming from an EPSG:4326 WMS?</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-autospace:none'><span style='font-family:"Courier New"'>Thank you.</span><o:p></o:p></p></div></div></div><p class=MsoNormal> <o:p></o:p></p></div></div></body></html>