Select to view content in your preferred language

WKID problem with WMS service

619
3
08-03-2012 05:02 AM
Labels (1)
martindevos
Deactivated User
Hi,

I have a map in which i have several layers of ArcGIS webservices of different origins. One of them is a WMS service which supports the spatial reference that i am using in my map, but when I look at the spatial reference of this layer it returns the WKID of the first EPSG tag in the WMS file.  How can I force it to use my WKID instead ?
0 Kudos
3 Replies
BjørnarSundsbø
Deactivated User
Hi,

I have a map in which i have several layers of ArcGIS webservices of different origins. One of them is a WMS service which supports the spatial reference that i am using in my map, but when I look at the spatial reference of this layer it returns the WKID of the first EPSG tag in the WMS file.  How can I force it to use my WKID instead ?


I just ran into the same problem. Did you find a good solution for this, or did you end up extending the WmsLayer class in the toolkit?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
That seems the normal behavior. WmsLayer has 2 properties concerning SRs:
  - SpatialReference = Default Spatial Reference, i.e the first SR as you noticed
  - SupportedSpatialReferenceIDs = enumeration of  supported spatial reference IDs.

You should be able to display the WMS layer whatever the map SR in the SupportedSpatialReferenceIDs.

For example the following WebMercator map displays correctly the WMS layer despite its default SR is Geographic.
<esri:Map UseAcceleratedDisplay="True" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000">
    <esri:ArcGISTiledMapServiceLayer 
        Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
    <esri:WmsLayer ID="OtherWMSLayer"                      
                    Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi"                                         
                    SkipGetCapabilities="False"                     
                    Layers="nexrad-n0r" 
                    Version="1.1.1" 
                    Opacity="0.7" />
</esri:Map>
 


Did you notice a particular issue whith that?
0 Kudos
BjørnarSundsbø
Deactivated User
I didn't experience any issues with that sample. I just tried creating my own sample, but the services providing the maps I am looking for are not publicly available. The WMS I'm accessing is http://wms.norgeibilder.no/services/wms/wms.aspx?request=getcapabilities.

My base map is in spatial reference epsg 32633 (custom layer exported from MXD), and the WMS defaults to epsg 25832. They are both displayed, but there is an offset between them. The image of scandinavia from the WMS is then rendered somewhere in the Baltics, on top of the base map.

I was able to "fix" this issue by deriving from WMS layer to set the spatial reference system in the constructor. That way I lose the ability to verify that the srs is actually supported.

If the spatial reference is null,the WMS will assign the first in the supported srs. As the setter for Spatial reference is not publicly accessible, I am not able to assign it from the outside. There may be some other factors in play here, where I assign the spatial reference system to the map based on my basemap, which may have an impact on the offset I experience. As a user of the WmsLayer class, it appears there is no way of actually using the SupportedSpatialReferenceIDs. I can just see what they are, without a way of affecting what is picked up. A PreferredSpatialReference property would have been nice. That way, the WMS layer can assign the SpatialReference from that, if it is in the SupportedSpatialReferenceIDs, instead of just picking the first available.
0 Kudos