Skip to content

Latest commit

 

History

History
77 lines (48 loc) · 1.78 KB

README.md

File metadata and controls

77 lines (48 loc) · 1.78 KB

SharedStreets GeoJSON

npm version Build Status

Converts SharedStreets JSON to GeoJSON.

Install

In Node.js

$ yarn add sharedstreets-geojson

CommonJS

const sharedstreetsGeoJSON = require('sharedstreets-geojson');

Typescript

import * as sharedstreetsGeoJSON from 'sharedstreets-geojson';

In Browser

For a full list of web examples, check out SharedStreets examples.

API

Table of Contents

geometry

Geometry

Parameters

  • geom SharedStreetsGeometry 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

Intersection

Parameters

  • intersect SharedStreetsIntersection 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