[OpenLayers-Users] Overlay WMS layer on OSM

jrom jerome.gasperi at gmail.com
Tue Jan 10 07:38:12 EST 2012


Hi Luis,

I think EPSG:3785 is deprecated. You should use EPSG:3857 instead

Regards

Jerome

--
http://mapshup.info

2012/1/10 Luís de Sousa <luis.a.de.sousa at gmail.com>:
> Dear all,
>
> Below is the code of a very simple map that pretends to overlay a WMS layer
> on OSM. I have a local MapServer instance from which I add the same layer in
> two different ways: as a base layer and as an overlay. As a base layer the
> WMS data is shown without trouble. As an overlay nothing is shown, just the
> pink void tiles with the missing image icon. Using Firebug I can verify that
> when I turn the overlay on no HTTP request is being sent, thus it must be
> something wrong with the code.
>
> This is going on with OpenLayers 2.11, btw. Any help appreciated, thank you,
>
> Luís
>
> --------------------------------------------------------
>
> function initMap(){
>
>        map = new OpenLayers.Map("MiniMap",{
>                projection: new OpenLayers.Projection("EPSG:3785"),
>                displayProjection: new OpenLayers.Projection("EPSG:4326"),
>                units: "m",
>                numZoomLevels: 18,
>                maxResolution: 156543.0339,
>                maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508,
> 20037508.34)
>        });
>
>        map.addLayer(new OpenLayers.Layer.OSM());
>        map.addControl(new OpenLayers.Control.MousePosition());
>        map.addControl(new OpenLayers.Control.LayerSwitcher());
>        map.setCenter(new OpenLayers.LonLat(1022500, 6256500), 13);
>
>        var builds = new OpenLayers.Layer.WMS(
>                "Buildings",
>                "http://localhost/cgi-bin/mapserv?map=/var/www/MapServ/Ludwigsburg01.map",
>                {layers: "LudwigTest",
>                format: "image/png",
>                srsName: "EPSG:3785",
>                srs: "EPSG:3785"}
>        );
>
>        var buildsOver = new OpenLayers.Layer.WMS(
>                "Buildings overlay",
>                "http://localhost/cgi-bin/mapserv?map=/var/www/MapServ/Ludwigsburg01.map",
>                {layers: "LudwigTest",
>                format: "image/png",
>                srsName: "EPSG:3785",
>                srs: "EPSG:3785",
>                transparent: "true"},
>                {isBaseLayer: false}
>        );
>
>        map.addLayers([builds, buildsOver]);
>  }
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Overlay-WMS-layer-on-OSM-tp7171504p7171504.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


More information about the Users mailing list