@skymapglobal/geojson-io
v2.1.9
Published
Library for reading to and writing from GeoJSON
Downloads
15
Readme
GeoJSON IO
Library for reading to and writing from GeoJSON
Usage
Read
Supported file types:
- Shapefiles (.dbf, .prj, .cpg, .shx)
- GeoJSON (.json, .geojson)
- GPX (.gpx)
- KML (.kml)
- KMZ (.kmz)
- CSV (.csv)
- GML (.gml)
- WKT (.wkt)
import { Reader } from "@skymapglobal/geojson-io";
const reader = new Reader();
const result = await reader.read(files);
for (const data of result) {
console.log(data.file, data.geojson);
}
Read As
import { Reader } from "@skymapglobal/geojson-io";
const reader = new Reader();
// Support types: geojson, gpx, kml, kmz, shapefile, csv, gml, wkt
const result = await reader.readAs("shapefile", files);
for (const data of result) {
console.log(data.file, data.geojson);
}
Write
import { Writer } from "@skymapglobal/geojson-io";
const writer = new Writer();
// Support types: geojson, gpx, kml, shapefile, csv, gml, wkt
const saveAs = "shapefile";
const fileName = "my-geojson";
await writer.writeAs(saveAs, geojson, fileName);