[OpenLayers-Users] Overlay Issue

Paul Ramsey pramsey at refractions.net
Sat Sep 15 00:41:47 EDT 2007


There's clearly something going on in OpenLayers behind the scene  
that is making things work, since the layers end up lining up  
correctly (the WMS parcels neatly line up along the Yahoo roads).   
Curiously, they lined up even when I accidentally set the SRS option  
on the WMS to 4326 (initially I had it set to 3395, WGS84 Mercator).   
I didn't have a sniffer on, so I could see what SRS OpenLayers was  
actually using for the request, but nonetheless Magic Occurred.   
OpenLayers, so good it works even when you screw up.

P

On 14-Sep-07, at 10:56 AM, Tim Schaub wrote:

> Hey-
>
> Paul Ramsey wrote:
>> Anyone seen this before? Pretty simple page (add map, add two layers,
>> one yahoo, one wms overlay):
>>
>> http://mapserver.refractions.net/openlayers/index.html
>
> Note that this is not the issue causing you trouble, but it points  
> to a
> potential misunderstanding.
>
> You are setting layer.sphericalMercator to true.  This suggests that
> you'd like to overlay your yahoo layer with a WMS in
> Mercator/Sphere/meters.  OpenLayers assumes an epsg code of 9009l3 to
> represent this CRS.  Your WMS doesn't support EPSG:900913 (as it  
> is), so
> you won't be getting the spherical mercator overlay.
>
> If you did want to overlay Yahoo with a WMS layer in spherical  
> mercator,
> you would have to instantiate the layer with the sphericalMercator
> option.  It will not work to set this property after creating a layer.
>
> That is, you must do
>
> var layer = new OpenLayers.Layer.Yahoo(
>      "Yahoo", {sphericalMercator: true}
> );
>
> and not
>
> var layer = new OpenLayers.Layer.Yahoo("Yahoo");
> layer.sphericalMercator = true;
>
> In addition, the OpenLayers.js that you are including in your page  
> does
> not recognize the sphericalMercator option on commercial layers.  You
> can get this functionality from the version in trunk or from the
> upcoming 2.5 release.
>
> We'll write up some documentation of how to properly use a spherical
> mercator overlay for the release.  In the meantime, you can follow  
> from
> this example if you're interested:
> http://openlayers.org/dev/examples/spherical-mercator.html
>
> Tim
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list