[OpenLayers-Users] spherical-mercator

Christopher Schmidt crschmidt at metacarta.com
Tue Oct 2 16:28:34 EDT 2007


On Tue, Oct 02, 2007 at 02:13:56PM -0600, Linda Rawson wrote:
> In this case my WMS layer is the following:
> 
>             var wms = new OpenLayers.Layer.WMS(
>                 "Canada Map",
>                 "http://wms.cits.rncan.gc.ca/cgi-bin/cubeserv.cgi?",
>                 {'layers': layerOptions, 'format':'png'},
>                 {
>                     'reproject': false, 'opacity': 0.4,
>                     'isBaseLayer': false,'wrapDateLine': true
>                 }
>             );
> 
> I was just trying to use your example.  In order for me to display the
> layers in a certain projection from this service I have to tell it.  It
> wants EPSG:26919.  It does not understand EPSG:900913 and fails on the
> request.

Correct. If you want to overlay image on top of Google, Yahoo, or
Microsoft maps, you have two options:
 * Use a WMS Server which support EPSG:900913 and sphericalMercator
   on the base layer.
 * Use a WMS Server which supports non-square pixels and EPSG:4326, and
   reproject on the base layer.  (This is only usably accurate for small
   areas, does not allow TileCaching, and will be removed in OL 3.0.) 

No other options are possible. If you use anything else, the imagery
will not line up -- and if you use the second option at small scales,
the imagery will not line up. 

> Basically here is my goal....I need to use a spherical-mercator projection
> to get the UTM coordinates to pass to this WMS layer.  The map can be in
> whatever it wants I just need the SRS parameter changed for the WMS layer.

No, the map can't be in whatever it wants: If you request images from a
server which is UTM based on coordinates in sphericalMercator, it will
not line up. The projections are different, the origin is different,
etc. Your projections for your overlaid images must match the base
layer, and this is enforced in the code. 


Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list