GeoWKTer

GeoWKTer is a JavaScript library designed to convert Well-Known Text (WKT) representations of geometries into GeoJSON format. This tool is useful for developers and GIS specialists who need to work with geographic data across different standards.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/523986/1537670/GeoWKTer.js


Ask a question, post a review, or report the script.
Author
JS55CT
Version
2.1.0
Created
2025-01-16
Updated
2025-02-15
Size
22.8 KB
License
MIT

GeoWKTer: WKT to GeoJSON Converter

GeoWKTer is a JavaScript library designed to facilitate the conversion of Well-Known Text (WKT) geometries into GeoJSON format. This library is especially beneficial for developers and GIS specialists working with geographic data across varying standards. By implementing robust methods for parsing and conversion, GeoWKTer ensures seamless transitions between WKT and GeoJSON representations.

Features

Usage

Below is a basic example of how to use the GeoWKTer library:

// Initialize the GeoWKTer instance
let geoWKTer = new GeoWKTer();
// Example WKT input
let wktText = "GEOMETRYCOLLECTION(POINT(4 6), LINESTRING(4 6, 7 10))";
// Convert WKT to GeoJSON
let wktDataArray = geoWKTer.read(wktText, 'Example Label');
let geoJsonData = geoWKTer.toGeoJSON(wktDataArray);
// Output GeoJSON
console.log(JSON.stringify(geoJsonData, null, 2));

API

GeoWKTer

License

GeoWKTer is licensed under the MIT License. For more details, please see the LICENSE file.

Acknowledgments

GeoWKTer is also inspired by the work of Wicket.js and Terraformer.