[OpenLayers-Users] EPSG:4326 WMS map aspect ratio
Smart, Gary
Gary.Smart at utas.utc.com
Fri May 31 02:07:33 PDT 2013
I'm surprised that OpenLayers cannot do this. Granted, the WorldWind
applet is a thicker client, but the rather more primative ModestMaps
seems perfectly capable of using our WMS and displaying OS maps with
square grids at high latitudes. Are you sure we are not just missing a
trick here?
From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
Sent: 30 May 2013 22:00
To: Smart, Gary
Cc: OpenLayers
Subject: [External] Re: [OpenLayers-Users] EPSG:4326 WMS map aspect
ratio
On Thu, May 30, 2013 at 9:52 AM, Smart, Gary <Gary.Smart at utas.utc.com>
wrote:
Thanks for the response. However, I am not in control of the
WMS maps supplied.
Have you issued a getcapabilities request against the server and
verified that only epsg:4326 is available? A request would look
something like:
http://www.youserver.com/wms?service=WMS&version=1.3.0&request=GetCapabi
lities
<http://maps.greenwoodmap.com/cgi-bin/mapserv?map=MAP_22_MAIN6&service=W
MS&version=1.3.0&request=GetCapabilities>
and would return an xml document. Available coordinate systems would
appear between <CRS> </CRS> tags.
I certainly cannot insist that the customer re-projects his
entire WMS contents.
The customer is always right, but we can try to educate them.
I am looking for a way to make the client (openLayers) adjust
the projection (to its native spherical Mercator) prior to display?
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.
Incidentally, WorldWind has no problem displaying maps from the
very same WMS and displaying a square OS grid.
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.
Good luck,
Rich
From: Richard Greenwood [mailto:richard.greenwood at gmail.com]
Sent: 25 May 2013 16:03
To: Smart, Gary
Cc: OpenLayers
Subject: [External] Re: [OpenLayers-Users] EPSG:4326 WMS map
aspect ratio
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.
Rich
On Wed, May 22, 2013 at 7:59 AM, Smart, Gary
<Gary.Smart at utas.utc.com> wrote:
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.
Salient extracts from the js code follow:
var map, options = {
projection: new
OpenLayers.Projection('EPSG:4326'),
//displayProjection: new
OpenLayers.Projection('EPSG:3574'),
//units: 'm',
//maxResolution: 156543.0339,
//maxExtent: new
OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
zoom: 14
};
map = new OpenLayers.Map('map', options);
var my50kLayer = new OpenLayers.Layer.WMS( "OpenLayers
WMS",
"http://expdev2/cgi-bin/wms?",
{
layers:
'UK_ASRP_1to50000',
format:
'image/png',
//transparent: 'true',
continuousWorld: true,
attribution: "OS 1:50K",
});
map.addLayers([my50kLayer]);
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)?
Adding the displayProjection seems to do nothing. Using any of
the other options with my WMS, results in a blank map.
I have also plagiarised the polar-projections example from the
OpenLayers example site, and replace the buttons with the following
projections:
var projectionOptions =
{
'EPSG:4326':
{
projection: new OpenLayers.Projection('EPSG:4326')
},
'EPSG:3857':
{
projection: new OpenLayers.Projection('EPSG:3857'),
maxExtent: new OpenLayers.Bounds(-5505054, -5505054,
5505054, 5505054),
maxResolution: 5505054 / 128,
numZoomLevels: 18
}
}; // end projectionOptions array
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)!
Can anyone tell me whether it is possible to display a square
grid for OS maps coming from an EPSG:4326 WMS?
Thank you.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130531/2f64905a/attachment-0001.html>
More information about the Users
mailing list