@loaders.gl/wms
Version:
Framework-independent loaders for the WMS (Web Map Service) standard
36 lines (35 loc) • 1.17 kB
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { parseWMSCapabilities } from "./lib/parsers/wms/parse-wms-capabilities.js";
// __VERSION__ is injected by babel-plugin-version-inline
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
const VERSION = typeof "4.3.3" !== 'undefined' ? "4.3.3" : 'latest';
/**
* Loader for the response to the WMS GetCapability request
*/
export const WMSCapabilitiesLoader = {
dataType: null,
batchType: null,
id: 'wms-capabilities',
name: 'WMS Capabilities',
module: 'wms',
version: VERSION,
worker: false,
extensions: ['xml'],
mimeTypes: ['application/vnd.ogc.wms_xml', 'application/xml', 'text/xml'],
testText: testXMLFile,
options: {
wms: {}
},
parse: async (arrayBuffer, options) =>
// TODO pass in XML options
parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options?.wms),
parseTextSync: (text, options) =>
// TODO pass in XML options
parseWMSCapabilities(text, options?.wms)
};
function testXMLFile(text) {
// TODO - There could be space first.
return text.startsWith('<?xml');
}