Converts SharedStreets JSON to GeoJSON.
In Node.js
$ yarn add sharedstreets-geojsonCommonJS
const sharedstreetsGeoJSON = require('sharedstreets-geojson');Typescript
import * as sharedstreetsGeoJSON from 'sharedstreets-geojson';For a full list of web examples, check out SharedStreets examples.
Geometry
Parameters
geomSharedStreetsGeometry JSON SharedStreetsGeometry
Examples
const line = [[110, 45], [115, 50], [120, 55]];
const geom = sharedstreets.geometry(line);
const geojson = sharedstreetsGeoJSON.geometry(geom)));
geojson // => Feature<LineString, SharedStreetsGeometry>Returns Feature<LineString, SharedStreetsGeometry> GeoJSON LineString Feature SharedSteetsGeometry
Intersection
Parameters
intersectSharedStreetsIntersection JSON SharedStreetsIntersection
Examples
const pt = [110, 45];
const intersect = sharedstreets.intersection(pt);
const geojson = sharedstreetsGeoJSON.intersection(intersect)));
geojson // => Feature<Point, SharedStreetsIntersection>Returns Feature<Point, SharedStreetsIntersection> GeoJSON Point Feature SharedSteetsIntersection