WMS service called with CRS=EPSG:102100

4181
2
12-02-2013 02:12 AM
IVPlatformen
New Contributor
Hi,

I'm trying to add a WMS layer on top of a map.
I'm trying to use CRS="EPSG:28992", so this is my code:

[HTML]    <script src="//js.arcgis.com/3.7/"></script>
    <script>
        var map;

        require([
          "esri/map",
          "esri/dijit/LocateButton",
          "esri/layers/WMSLayer",
          "esri/layers/WMSLayerInfo",
          "esri/geometry/Extent",
          "dojo/domReady!"
        ], function (
          Map, LocateButton, WMSLayer, WMSLayerInfo, Extent
        ) {
            map = new Map("map", {
                center: [5.291, 52.132],
                zoom: 8,
                basemap: "osm",
                logo: false,
                showAttribution: false
            });

            var wmsURL = "http://geodata.nationaalgeoregister.nl/aan/wms";

            var layer1 = new WMSLayerInfo({ name: "aan", title: "aan" });
            var resourceInfo = {
                extent: new Extent(4259, 304879, 285658, 614732, { wkid: 28992 }),
                layerInfos: [layer1]
            };

            var wmsLayer = new WMSLayer(wmsURL, {
                resourceInfo: resourceInfo,
                visibleLayers: ['aan']
            });

            wmsLayer.setImageTransparency(true);
            map.addLayers([wmsLayer]);

            geoLocate = new LocateButton({
                map: map
            }, "LocateButton");
            geoLocate.startup();

        });
    </script>[/HTML]

Now here is my problem, when I look in the requests, I see the following url being called:
http://geodata.nationaalgeoregister.nl/aan/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARE...CRS=EPSG:102100&BBOX=99794.44476209529,6630795.21998089,1078188.4068123032,7017260.834990723

Where I specifically asked for EPSG:28992.

What am I doing wrong here?

Thank you in advance!
0 Kudos
2 Replies
JeffPace
MVP Alum
when you call new map with the basemap defined your application is defaulting to 102100

So you need to explicitly set your desired spatial reference to 28992, which just setting the extent does not do

try

var wmsLayer = new WMSLayer(wmsURL, {
                resourceInfo: resourceInfo,
                visibleLayers: ['aan'],
                spatialReference: new SpatialReference(28992)
            });
0 Kudos
JasonCantrell
New Contributor III

Hi - I'm having the same issue that IV Platformen was having (my posted question: https://community.esri.com/message/491878) and I tried setting the Spatial Reference explicitly for the wms layer as Jeff suggested, but I'm still getting the same results (WMS service getting called with CRS=EPSG:102100). Did anybody ever find a way to solve this issue?

0 Kudos