Skip to main content

WMS API · feature information

Ask a map service what is under the cursor.

WMSFeatureInfoLoader parses the XML response from a GetFeatureInfo request into a typed JavaScript result. It keeps verbose protocol details behind a smaller boundary for identify, tooltip, and inspection tools.

The identify path

Keep map rendering and feature inspection separate.

The WMS map response is an image; GetFeatureInfo is a separate request that returns information about the queried location. This loader parses that second response without becoming a full XML client.

Input

XML response from a WMS GetFeatureInfo request

Output

Typed WMSFeatureInfo data

Runtime

Synchronous XML parsing; no worker path

Fallback

Use XMLLoader when fields outside the normalized result are needed

Detailed guide

WMSFeatureInfoLoader reference

The sections below document request usage, parsed data, options, and the boundary between normalized fields and raw XML.

From-v3.3Status: Experimental

The WMSFeatureInfoLoader parses the XML-formatted response from the OGC WMS (Web Map Service) standard GetFeatureInfo request into a typed JavaScript data structure.

Note that the WMS standard is rather verbose and the XML responses can contain many rarely used metadata fields, not all of which are extracted by this loader. If this is a problem, it is possible to use the XMLLoader directly though the result will be untyped and not normalized.

WMSFeatureInfoLoader
File Extension.xml
File TypeText
File FormatWMS
Data FormatData structure
Decoder TypeSynchronous
Worker Thread❌ No
Streaming Support❌ No

Usage​

import {_WMSFeatureInfoLoader, type _WMSFeatureInfo} from '@loaders.gl/ogc/wms';
import {load} from '@loaders.gl/core';

// Form a WMS request
const url = `${WMS_SERVICE_URL}?REQUEST=GetFeatureInfo&LAYER=...`;

const data = (await load(url, _WMSFeatureInfoLoader, options)) as _WMSFeatureInfo;

Parsed Data Format​

/** All capabilities of a WMS service. Typed data structure extracted from XML */
export type WMSFeatureInfo = {
features: {
attributes: Record<string, number | string>;
type: string;
bounds: {top: number; bottom: number; left: number; right: number};
}[];
};

The current experimental parser extracts FIELDS attributes from FeatureInfoResponse. Its type and bounds fields are placeholders (empty string and zero bounds), not inferred feature geometry. Other response encodings need a matching parser. The public export is _WMSFeatureInfoLoader.

Options​

OptionTypeDefaultDescription