Select to view content in your preferred language

WMSLayer - How to access additional parameters from server?

3388
3
02-10-2011 01:47 AM
IanWatkins
Emerging Contributor
Hi All,

After being disappointed with early WMS implementations in ESRI API I was happy to see the addition of a WMSLayer in 2.1/2.2.

Now, I've been using the example: http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=WMS_TOC as the basis for my initial work against our own WMS servers which serve imagery of weather information.

I'm able to get the default WMS layer back for each Layer from each Service our WMS provides. However, I'm unable to access the additional parameters our WMS provides and allows for selection. E.g. one layer returns a list of date/times for data and in your request you can add this date/time to get that specific image back. I'll include a grab of some of the returned XML from the GetCapabilities call below

Now I'm sure WMSLayer was designed to work against ArcGIS servers rather than other vendor's WMS servers but surely it isn't a big stretch to get there.

Could anybody advise on how to get there? I'm currently so close, but so far... 🙂

Cheers

Ian

----------------------------

<Layer queryable="1">
    <Name>NOW_Visibility</Name>
    <Title>Scaled Visibility</Title>
    <SRS>CRS:84</SRS>
    <SRS>EPSG:4326</SRS>
    <LatLonBoundingBox minx="-180" miny="-90" maxx="180" maxy="90"/>
    <BoundingBox SRS="CRS:84" minx="-180" miny="-90" maxx="180" maxy="90"/>
    <BoundingBox SRS="EPSG:4326" minx="-180" miny="-90" maxx="180" maxy="90"/>
    <Dimension name="DIM_RUN" units="ISO8601"/>
    <Dimension name="DIM_FORECAST" units="ISO8601"/>
    <Extent name="DIM_RUN" default="2011-02-10T11:00:00">2011-02-10T10:00:00,2011-02-10T11:00:00</Extent>
    <Extent name="DIM_FORECAST" default="+0">+0,+1,+2,+3,+4,+5,+6</Extent>
</Layer>
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
One option may be to add the extra parameters to the url you set on the WMSLayer since extra params are passed on in the requests the WMSLayer makes to the server.

e.g.

http://sampleserver1.arcgisonline.com/arcgis/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServe...
0 Kudos
IanWatkins
Emerging Contributor
One option may be to add the extra parameters to the url you set on the WMSLayer since extra params are passed on in the requests the WMSLayer makes to the server.

e.g.

http://sampleserver1.arcgisonline.com/arcgis/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServe...


Thanks Dasa,

That would work, but would need to know the possible values for "foo" from the GetCapabilities before I presented them to the user to choose one value before adding it to the url for the WMSLayer.

I guess the answer is "not right now" with regards to the WMSLayer.

But I think I have a plan:

1. Set up the WMSLayer as normal but use "skipCapabilites=true"

2. Use a HTTPService call to get the XML back from GetCapabilities for the selected service.

3. Parse that to get the available values back for "foo"

4. Allow the user to select the value of "foo" they want.

5. Add that to the URL for WMSLayer as you suggest and trigger it to get the WMS imagery back from the server.

Probably not ideal, but would work I think. I'll give it a go over the weekend.

-----------------

I guess what I would like to see is for WMSLayer to be extended to allow access to all the information in the returned GetCapabilities for a layer. This way all additional parameters would be accessible in one hit. So as in the example, name and title for the layer would be able to be added directly to a datagrid for selection but also so would other parameters be they 1, 2 or 3 dimensional. (e.g. in our case, data over time and data over elevations)

And extension to that would be to allow one of those parameters to be associated with a TimeSlider much like you would with a FeatureLayer etc.

Any chance those two possibilities could be fed back to the ideas guys please?

Cheers

Ian
0 Kudos
HarryLam
Emerging Contributor
Bumping this request; maybe I can also post it on the Esri Ideas website.

It looks like I will have to follow iwatkins's approach in order to get the Dimension tags from a WMS Layer.  I agree it feels inefficient since I am essentially getting the GetCapabilities twice, once for the WMSLayer object and again as an XML object for my own parsing.

This is the reference for WMSLayerInfo:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/supportClasses/WMSLayerInfo.html

Would love to see additional properties in the future, perhaps one called "dimension" which would be an array of WMSDimension objects containing the name, units, and the value of the dimension.
0 Kudos