[OpenLayers-Users] Combining layers with different SRS - intentionally - is failing

Andreas Hocevar ahocevar at opengeo.org
Fri Mar 2 05:13:35 EST 2012


Hi,

you need a recent build of OpenLayers (preferably the latest master
from http://github.com/openlayers/openlayers), and then you can do
something like the following:

var map = new OpenLayers.Map({
    div: "map",
    projection: "EPSG:3857",
    layers: [
        new OpenLayers.Layer.WMS(
            "GeoWebCache", "http://sever/geowebcache/service/wms,
            {layers: "mylayer"},
            {projection: "EPSG:900913", maxExtent: /* bbox here */)
        ),
        new OpenLayers.Layer.WMS(
            "live", "http://server/wms",
            {layers: "livelayer", transparent: true}
    ]
});

Note the projection configuration for the GeoWebCache layer.
OpenLayers knows that EPSG:900913 and EPSG:3857 are equal, and will
use EPSG:900913 for the srs parameter of the request.

Andreas.

On Thu, Mar 1, 2012 at 11:54 PM, cheesybiscuits
<thomaschristian at gmail.com> wrote:
> I am trying to resolve an issue that stems from my Oracle database not being
> the correct version to understand the EPSG:3857 / 900913 Spherical Mercator
> projection.
>
> I'm using OpenLayers, via WMS, with GeoServer & GeoWebCache. GeoWebCache has
> generated tiles in EPSG:4326 and 900913 (I tried and failed to add a new
> gridset, but that is another issue). My OpenLayers map's base layer should
> be 900913.
>
> Using a transform I found here:
> https://forums.oracle.com/forums/thread.jspa?threadID=2228982 I am able to
> use the 3785 SRS in Oracle (which does exist in my version) to mimic the
> 900913 SRS and so Oracle can serve up coordinates that match the 900913
> projection.
>
> So what I need is for OpenLayers to request the base layer in 900913
> (because GeoWebCache is not happy otherwise) and the 'live' layer in 3785. I
> overrode the map's default projection just for the live layer -
> liveLayer.projection = new OpenLayers.Projection('EPSG:3785') - but Firebug
> is showing me that requests for this layer are being sent with
> SRS=EPSG:900913 and a BBOX in metres, rather than degrees, which means
> GeoServer is re-projecting the coordinates during rendering and this will
> obviously affect performance.
>
> Is what I'm trying to do even possible with OpenLayers? I know it doesn't
> seem sensible, but in the absence of the required version of Oracle, with a
> coordinate transform that fills in the gaps, and a need to avoid
> re-projection it's my best option.
>
> Any suggestions very much appreciated.
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/Combining-layers-with-different-SRS-intentionally-is-failing-tp4537869p4537869.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list