Skip to content

Add WMS DescribeLayer operation support#137

Merged
ronitjadhav merged 2 commits intomainfrom
wms-describe-layer
Mar 6, 2026
Merged

Add WMS DescribeLayer operation support#137
ronitjadhav merged 2 commits intomainfrom
wms-describe-layer

Conversation

@ronitjadhav
Copy link
Copy Markdown
Member

Description

Adds support for the WMS DescribeLayer operation to determine the underlying
data type of a WMS layer (e.g. whether it is backed by vector/WFS or raster/WCS data).

Changes

  • Add describeLayer(layerName) method to WmsEndpoint
  • Add WmsLayerDescription type (layerName, owsType, owsUrl, typeName)
  • Add generateDescribeLayerUrl() URL builder in src/wms/url.ts
  • Add parseDescribeLayerResponse() XML parser in src/wms/describelayer.ts
  • Export WmsLayerDescription from the library entry point

Usage

const endpoint = new WmsEndpoint(url);
await endpoint.isReady();

const description = await endpoint.describeLayer('my_workspace:my_layer');
// { layerName: 'my_workspace:my_layer', owsType: 'WFS', owsUrl: '...', typeName: '...' }

Copy link
Copy Markdown
Member

@jahow jahow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, a few comments to address!

Comment thread src/wms/url.ts
SERVICE: 'WMS',
REQUEST: 'DescribeLayer',
VERSION: version,
LAYERS: layerName,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a SLD_VERSION=1.1.0 param here

Comment thread src/wms/model.ts Outdated

export type WmsLayerDescription = {
layerName: string;
owsType: string;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be typed as 'wcs' | 'wfs' as per the spec

Comment thread fixtures/wms/describelayer-response.xml Outdated
Comment on lines +3 to +10
<WMS_DescribeLayerResponse version="1.1.1">
<LayerDescription name="my_workspace:my_vector_layer" wfs="https://my-server.com/wfs?" owsURL="https://my-server.com/wfs?" owsType="WFS">
<Query typeName="my_workspace:my_vector_layer"/>
</LayerDescription>
<LayerDescription name="my_workspace:my_raster_layer" owsURL="https://my-server.com/wcs?" owsType="WCS">
<Query typeName="my_workspace:my_raster_layer"/>
</LayerDescription>
</WMS_DescribeLayerResponse>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this fixture looks like a real response. For instance this is the response example from the spec:

<DescribeLayerResponse xmlns="http://www.opengis.net/sld" xmlns:ows="http://www.opengis.net/ows"
xmlns:se="http://www.opengis.net/se" xmlns:wfs="http://schemas.opengis.net/wfs"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:myns="http://myserver/somenamespace"
xsi:schemaLocation="http://www.opengis.net/sld DescribeLayer.xsd">
<Version>1.1.0</Version>
<LayerDescription>
 <owsType>wfs</owsType>
 <se:OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://mywfs/server/ogcwebservice"/>
 <TypeName>
 <se:FeatureTypeName>myns:cloudfeatures</se:FeatureTypeName>
 <TypeName>
</LayerDescription>
</DescribeLayerResponse>

Could you maybe do two different fixtures, one for WCS and one for WFS? Also slightly different, e.g. coming from different services. Thank you!

Comment thread src/wms/endpoint.ts Outdated
* @param layerName Layer name to describe
* @return Returns null if the endpoint is not ready or does not advertise DescribeLayer
*/
describeLayer(layerName: string): Promise<WmsLayerDescription | null> | null {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it so that a Promise is always returned, otherwise the API is very awkward

@ronitjadhav
Copy link
Copy Markdown
Member Author

Thanks for the review. I have addressed the mentioned comments.

Copy link
Copy Markdown
Member

@jahow jahow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ronitjadhav ronitjadhav merged commit 12086e8 into main Mar 6, 2026
1 check passed
@ronitjadhav ronitjadhav deleted the wms-describe-layer branch March 6, 2026 13:15
Sam-Bolling added a commit to OS4CSAPI/ogc-client that referenced this pull request Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants