WMS-layer problem

4444
6
02-13-2015 06:11 AM
TuukkaJärvinen
New Contributor III

Hi,

I would like to show a layer from a WMS-service on my map but somehow it draws nothing. The WmsLayer.ServiceInfo is loaded correctly after initialization. I try to add it to my map with the following code where "vaki2011_1km" is the layer name from service ( http://geo.stat.fi/geoserver/vaestoruutu/wms?service=wms&%20version=1.3.0&request=GetCapabilities ).

            var wmslayer = new WmsLayer(new Uri("http://geo.stat.fi/geoserver/vaestoruutu/wms?"))
            {
                DisplayName = "Väestöruutuaineisto",
                IsVisible = true,
              
            };
            
            wmslayer.Layers = new[] {"vaki2011_1km"};
            wmslayer.ImageFormat = "image/png";
            await wmslayer.InitializeAsync();
           
            Map.Layers.Insert(0, wmslayer);

My map spatial reference is EPSG:3067 and the WMS Service supports it. What can possibly go wrong here? I tried to publish a simple own WMS service on ArcGIS server and added it to my map same way and it worked fine.

0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor

Looks like a server issue when using the SR 3067 which is supposed to be supported.

With the geographic SR 4326, the server returns the correct image.

With SR 3067, it returns a blank image.

The workaround might be to use a map in geographic coordinates.

0 Kudos
TuukkaJärvinen
New Contributor III

The server returns correct image with SR 3067 if the bounding box is set correctly.

http://geoserv.stat.fi:8080/geoserver/vaestoruutu/ows?SERVICE=WMS&REQUEST=GetMap&WIDTH=1921&HEIGHT=1...

I'm still wondering what causes it not to be drawn on the map after adding it as WmsLayer.

0 Kudos
TuukkaJärvinen
New Contributor III

I actually noticed that the API calls WMS with the following:

http://geoserv.stat.fi:8080/geoserver/vaestoruutu/ows?SERVICE=WMS&SERVICE=WMS&REQUEST=GetMap&WIDTH=1...

which returns this:

"Error occurred decoding the espg code urn:x-ogc:def:crs:EPSG:102139 No code "EPSG:102139" from authority "European Petroleum Survey Group" found for object of type "IdentifiedObject"."

If it would send the request with EPSG:3067 which is the spatial reference of my map, the request would work like this:

http://geoserv.stat.fi:8080/geoserver/vaestoruutu/ows?SERVICE=WMS&SERVICE=WMS&REQUEST=GetMap&WIDTH=1...

Is there any way to make it use correct SR in the request?

0 Kudos
DominiqueBroux
Esri Frequent Contributor

Oh you are right.

Looks like there is a mismatch between 2 equivalent SR (3067 and 102139).

How did you set the map SR?

0 Kudos
TuukkaJärvinen
New Contributor III

After further testing I actually noticed that the request SR is not dependent on Map.SpatialReference but MapView.SpatialReference. The MapView gets SpatialReference from the first layer that gets added, right? For some reason, if I add FeatureLayer from ArcGIS server that has spatial reference WKID 3067 the MapView.SpatialReference is set to WKID 3067. But when I add ArcGISDynamicMapService layer with the same WKID 3067, the MapView.SpatialReference is set to WKID 102139. Both layers have their spatial references marked as "Spatial Reference: 102139  (3067)" on ArcGIS Server.

What would be the best way to make sure that the MapView.SpatialReference is always 3067?

0 Kudos
AnttiKajanus1
Occasional Contributor III

Hey Tuukka,

Can you try to force the SR and see what happens.

MyMapView.Map.SpatialReference = SpatialReference.Create(3067);

0 Kudos