@loaders.gl/wms
Version:
Framework-independent loaders for the WMS (Web Map Service) standard
32 lines (31 loc) • 1.04 kB
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { parseCSWDomain } from "./lib/parsers/csw/parse-csw-domain.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 CSW GetCapability request
*/
export const CSWDomainLoader = {
dataType: null,
batchType: null,
id: 'csw-domain',
name: 'CSW Domain',
module: 'wms',
version: VERSION,
worker: false,
extensions: ['xml'],
mimeTypes: ['application/vnd.ogc.csw_xml', 'application/xml', 'text/xml'],
testText: testXMLFile,
options: {
csw: {}
},
parse: async (arrayBuffer, options) => parseCSWDomain(new TextDecoder().decode(arrayBuffer), options),
parseTextSync: (text, options) => parseCSWDomain(text, options)
};
function testXMLFile(text) {
// TODO - There could be space first.
return text.startsWith('<?xml');
}