@loaders.gl/wkt
Version:
Loader and Writer for the WKT (Well Known Text) Format
26 lines (25 loc) • 626 B
JavaScript
// loaders.gl
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors
import { VERSION } from "./lib/utils/version.js";
import { encodeWKT } from "./lib/encode-wkt.js";
/**
* WKT exporter
*/
export const WKTWriter = {
name: 'WKT (Well Known Text)',
id: 'wkt',
module: 'wkt',
version: VERSION,
extensions: ['wkt'],
text: true,
encode: async (geometry) => encodeWKTSync(geometry),
encodeSync: encodeWKTSync,
encodeTextSync: encodeWKT,
options: {
wkt: {}
}
};
function encodeWKTSync(geometry) {
return new TextEncoder().encode(encodeWKT(geometry)).buffer;
}