Issue in Displaying WMS Layer with Different Spatial Reference on Map

01-10-2024 12:31 AM
Labels (3)
New Contributor II

In WPF application I am encountering difficulties displaying a WMS layer using .Net Maps SDK(200.2) when the layer and the map have different spatial references.

If I create the map and WMS layer both with a spatial reference of 4326(wms layer has this), everything displays correctly.
However, when I attempt to create the map with a spatial reference of 3857 and load the WMS layer with spatial reference 4326, the layer does not display.

How can I properly handle the display of layer if it has a different spatial reference from map

Here's the snippet of the code:

private async void DisplayWMSLayer(object sender, RoutedEventArgs e)
Uri _wmsUrl = new Uri("");

List<string> layerNames = new List<string>();
string strSelectedLayerName = "cdl_2020_ia";
WmsLayer wmsLayer = new WmsLayer(_wmsUrl, layerNames);
await wmsLayer.LoadAsync();
SpatialReference mapSpatialReference = SpatialReference.Create(3857);//if i use 4326 then display layer correctly
Map nMap = new Map(mapSpatialReference);

nMap.InitialViewpoint = new Viewpoint(wmsLayer.FullExtent);
MainMapView.Map = nMap;

0 Kudos
1 Reply
Esri Contributor

I believe the WMS service defines a list of supported spatial references that you can use. If you check the capabilities for the service here:

You'll see that the layers define the following spatial references (CRS):

0 Kudos