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.
The server returns correct image with SR 3067 if the bounding box is set correctly.
I'm still wondering what causes it not to be drawn on the map after adding it as WmsLayer.
I actually noticed that the API calls WMS with the following:
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:
Is there any way to make it use correct SR in the request?
Oh you are right.
Looks like there is a mismatch between 2 equivalent SR (3067 and 102139).
How did you set the map SR?
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?
Hey Tuukka,
Can you try to force the SR and see what happens.
MyMapView.Map.SpatialReference = SpatialReference.Create(3067);