[OpenLayers-Users] Overlay Issue
Tim Schaub
tschaub at openplans.org
Fri Sep 14 13:56:21 EDT 2007
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
More information about the Users
mailing list