<div dir="ltr">On Thu, May 30, 2013 at 9:52 AM, Smart, Gary <span dir="ltr"><<a href="mailto:Gary.Smart@utas.utc.com" target="_blank">Gary.Smart@utas.utc.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><div><p class="">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks for the response.  However, I am not in control of the WMS maps supplied.  </span></p></div></div></blockquote><div><br></div><div style>
Have you issued a getcapabilities request against the server and verified that only epsg:4326 is available? A request would look something like:</div><div style><a href="http://maps.greenwoodmap.com/cgi-bin/mapserv?map=MAP_22_MAIN6&service=WMS&version=1.3.0&request=GetCapabilities">http://www.youserver.com/wms?service=WMS&version=1.3.0&request=GetCapabilities</a><br>
</div>and would return an xml document. Available coordinate systems would appear between <CRS> </CRS> tags.<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I certainly cannot insist that the customer re-projects his entire WMS contents.</span></p>
</div></div></blockquote><div style>The customer is always right, but we can try to educate them.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I am looking for a way to make the client (openLayers) adjust the projection (to its native spherical Mercator) prior to display? </span></p>
</div></div></blockquote><div><br></div><div style>You are asking OpenLayers to reproject raster data and that's not something that OpenLayers can do. Maybe someone else knows of a kluge that would make it look better.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB" link="blue" vlink="purple"><div>
<p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> <u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Incidentally, WorldWind has no problem displaying maps from the very same WMS and displaying a square OS grid.</span></p>
</div></div></blockquote><div style>I am not familiar with WorldWind but I have seen other desktop GIS software that will do some undefined projection of lat/long data to make it look nicer on screen. And that sounds like what you're looking for. Still, in my mind, the "right" way to do it is to use an appropriate local coordinate system. That's what they are there for.</div>
<div style><br></div><div style>Good luck,</div><div style>Rich</div><div style><br></div><div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p><p class=""><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> </span><b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif">From:</span></b><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif"> Richard Greenwood [mailto:<a href="mailto:richard.greenwood@gmail.com" target="_blank">richard.greenwood@gmail.com</a>] </span></p>
<p class=""><span lang="EN-US" style="font-size:10pt;font-family:Tahoma,sans-serif"><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<u></u><u></u></span></p>
<p class=""><u></u> <u></u></p><div><div><p class="" style="margin-bottom:12pt">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.<u></u><u></u></p>
</div><p class="">Rich<u></u><u></u></p></div><div><p class="" style="margin-bottom:12pt"><u></u> <u></u></p><div><p class="">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:<u></u><u></u></p>
<div><div><p class="">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.<u></u><u></u></p>
<p class=""> <u></u><u></u></p><p class="">Salient extracts from the js code follow:<u></u><u></u></p><pre style="background-color:white"><span style="background-color:rgb(240,240,240)">        var map, options = { </span><u></u><u></u></pre>
<pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                             projection: new OpenLayers.Projection('EPSG:4326'), </span><u></u><u></u></pre><pre style="background-color:white">
<span style="background-color:rgb(240,240,240)">                             //displayProjection: new OpenLayers.Projection(‘EPSG:3574’),</span><u></u><u></u></pre><pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                             //units: ‘m’,</span><u></u><u></u></pre>
<pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                             //maxResolution: 156543.0339,</span><u></u><u></u></pre><pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                             //maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)</span><u></u><u></u></pre>
<pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                             zoom: 14</span><u></u><u></u></pre><pre style="background-color:white"><span style="background-color:rgb(240,240,240)">                           };</span><u></u><u></u></pre>
<pre style="background-color:white"><span style="background-color:rgb(240,240,240)">        map = new OpenLayers.Map('map', options);</span><u></u><u></u></pre><p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)"> </span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">        <span style="color:blue">var</span> my50kLayer = <span style="color:blue">new</span> OpenLayers.Layer.WMS( <span style="color:maroon">"OpenLayers WMS"</span>, </span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                   <span style="color:maroon">"<a href="http://expdev2/cgi-bin/wms?" target="_blank">http://expdev2/cgi-bin/wms?</a>"</span>, </span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                   {</span><u></u><u></u></p><p class="" style="background-color:white">
<span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                     layers: <span style="color:maroon">'UK_ASRP_1to50000'</span>,</span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                     format: <span style="color:maroon">'image/png'</span>,</span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                     <span style="color:green">//transparent: 'true',</span></span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                    continuousWorld: true,</span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                     attribution: <span style="color:maroon">"OS 1:50K"</span>,</span><u></u><u></u></p>
<p class="" style="background-color:white"><span style="font-size:10pt;font-family:'Courier New';background-color:rgb(240,240,240)">                                                   }); </span><u></u><u></u></p><pre style="background-color:white">
<span style="background-color:rgb(240,240,240)">        map.addLayers([my50kLayer]);</span><u></u><u></u></pre><p class=""> <u></u><u></u></p><p class="">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)?<u></u><u></u></p>
<p class=""> <u></u><u></u></p><p class="">Adding the displayProjection seems to do nothing.  Using any of the other options with my WMS, results in a blank map.<u></u><u></u></p><p class=""> <u></u><u></u></p><p class="">
I have also plagiarised the polar-projections example from the OpenLayers example site, and replace the buttons with the following projections:<u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">var projectionOptions = </span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">    {</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        'EPSG:4326':</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        {</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">            projection: new OpenLayers.Projection('EPSG:4326')</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        },</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        'EPSG:3857':</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        {</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">            projection: new OpenLayers.Projection('EPSG:3857'),</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">            maxExtent: new OpenLayers.Bounds(-5505054, -5505054, 5505054, 5505054),</span><u></u><u></u></p><p class="" style="text-autospace:none">
<span style="font-family:'Courier New'">            maxResolution: 5505054 / 128,</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">            numZoomLevels: 18</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">        }</span><u></u><u></u></p><p class="" style="text-autospace:none"><span style="font-family:'Courier New'">    }; // end projectionOptions array</span><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'"> </span><u></u><u></u></p><p class="" style="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><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'"> </span><u></u><u></u></p><p class="" style="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><u></u><u></u></p>
<p class="" style="text-autospace:none"><span style="font-family:'Courier New'">Thank you.</span><u></u><u></u></p></div></div></div><p class=""> <u></u><u></u></p></div></div></div><br>_______________________________________________<br>

Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Richard Greenwood<br><a href="mailto:richard.greenwood@gmail.com">richard.greenwood@gmail.com</a><br><a href="http://www.greenwoodmap.com">www.greenwoodmap.com</a>
</div></div>