convert geojson to wkt/kml/shpfile or back
npm install geojson-converter-kit
# or use yarn
yarn add geojson-converter-kit
# or use pnpm
pnpm add geojson-converter-kitimport { WKT } from "geojson-converter-kit";
const wktStr = WKT.stringify({
type: "Point",
coordinates: [100.0, 0.0],
});
const geometry = WKT.parse(wktStr);args
| name | type | nullable |
|---|---|---|
| geometry | GeoJSON.Geometry | false |
| includeZ | boolean | true, default false |
args
| name | type | nullable |
|---|---|---|
| wkt | string | false |
import { KML } from "geojson-converter-kit";
const kmlStr = KML.stringify([
{
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [100.0, 0.0],
},
},
]);
const features = KML.parse(kmlStr);args
| name | type | nullable |
|---|---|---|
| data | GeoJSON.FeatureCollection | Array<GeoJSON.Feature> |
| options | KML.Stringify.Options | true, default {} |
KML.Stringify.Options
| name | type | nullable |
|---|---|---|
| name | string | true |
| description | string | true |
args
| name | type | nullable |
|---|---|---|
| kml | string | false |
import { SHPFILE } from "geojson-converter-kit";
const zipBlob = await SHPFILE.writeToZip([
{
type: "Feature",
properties: {},
geometry: {
type: "Point",
coordinates: [100.0, 0.0],
},
},
]);
const featureMaps = await SHPFILE.readFromZip(zipBlob);