A TypeScript library that provides functionality for working with GeoJSON data.
npm install @envisim/geojson
Example of creating a GeoJSON Line feature:
import { Feature, LineString } from "@envisim/geojson";
// Create a LineString, from a vector of coordinates ([Longitude, Latitude] pairs)
const lineString = LineString.create([
[10, 20],
[10, 30],
]);
// Calculate the length of the linstering
lineString.length();
// Create properties for the feature
const properties = {
value: 123,
};
// Create a Feature instance
const lineFeature = new Feature(lineString, properties);
// Get the measure of the geometry
lineFeature.measure();