Skip to content

Commit

Permalink
add note about using v8 for install
Browse files Browse the repository at this point in the history
  • Loading branch information
mguida22 committed Jul 24, 2020
1 parent cd5b60b commit 142915b
Show file tree
Hide file tree
Showing 4 changed files with 14,436 additions and 6,126 deletions.
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v11
44 changes: 37 additions & 7 deletions README.md
Expand Up @@ -5,7 +5,8 @@

Node.js & JavaScript implementation of [SharedStreets Reference System](https://github.com/sharedstreets/sharedstreets-ref-system).

# Command Line Interface (CLI)
# Command Line Interface (CLI)

![SharedStreets CLI Matcher](docs/cli_matcher.png)

## Description
Expand All @@ -15,6 +16,7 @@ The CLI is the primary tool for users to match GIS data to SharedStreets. The CL
The CLI is currently runs on macOS and Linux. It does not (yet) support Windows.

Usage:

```sh
shst <command> [options ... ]
```
Expand All @@ -25,22 +27,26 @@ For detailed examples of how to use this tool, see the [SharedStreets blog](http

The CLI requires Node v10+ on MacOS or Linux. Windows is not currently supported. On supported platforms it can be installed using either `npm` or `yarn`, or follow using Docker for unsupported environments.


#### NPM

To install using `npm`:

```sh
npm install -g sharedstreets
```

#### Yarn

To install using `yarn`:

```sh
yarn global add sharedstreets
```

This will install the CLI as `shst`.

#### Docker

To install using Docker create the following Dockerfile:

```
Expand All @@ -54,65 +60,77 @@ RUN npm install -g sharedstreets
```

Docker image build:

```
docker build --tag shst-image .
```

Run match on local data file:

```
docker run -it -v [/path/to/data/on/host/]:/data/ --rm shst-image shst match /data/[input_file.geojson] --out=/data/output.geojson
```


## Available commands

Available commands include:

- **extract**: extracts SharedStreets streets using polygon boundary and returns GeoJSON output of all intersecting features (this includes features that are in but not fully contained by the polygon)
- **help**: displays help for `shst`
- **match**: matches point and line features to SharedStreets references

### extract

Extracts SharedStreets streets using polygon boundary and returns GeoJSON routput of all intersecting features from the SharedStreets reference tile set.

The input polygon(s) must be in GeoJSON format, using the WGS84 datum (EPSG:4326) in decimal degrees. "Extracts" includes features that are inside but not fully contained by the polygon.

Output is given as a GeoJSON file:

- `[output filename].geojson`: contains features that intersected with the input polygon, including the SharedStreets ReferenceID

#### Usage:

```sh
shst extract <path/to/input_polygon.geojson> [options]
```

### help

Displays help for `shst`

#### Usage:

```sh
shst help
```

#### Options:

The following options may be appended to the command:

- **-h, --help**: displays help for the `intersects` command
- **-o, --out=[filename.geojson]**: names the output file and allows user to place it in a different location
- **-s, --stats**: not sure

#### Example:

```sh
shst extract ~/Desktop/project/city_boundary.geojson --out=streets_in_city.geojson
```


### match

Matches point and line features, from GIS, to SharedStreets references. This can be used to match city centerlines, parking meters, and other street features. Input data must be in GeoJSON format, using the WGS84 datum (EPSG:4326) in decimal degrees. Any standard GIS program (e.g. ArcGIS, QGIS) can convert from more common GIS file formats, like shapefile and geodatabase, into GeoJSON.

Output is given as up to three GeoJSON files:

- `[output filename].matched.geojson`: contains features that matched, including the SharedStreets IDs and properties, as well as the original properties of the matched features (by default)
- `[output filename].unmatched.geojson`: contains any unmatched features, if applicable
- `[output filename].invalid.geojson`: contains any invalid input data, if applicable

#### Usage:

```sh
shst match <path/to/input_data.geojson> [options]
```
Expand All @@ -122,9 +140,10 @@ shst match <path/to/input_data.geojson> [options]
Additional options allow users to change the modality for matching, incorporate a city's directionality information to support better matching, snap or offset results, cluster points along a street section, etc.

The following options may be appended to the command:

- **-h, --help**: displays help for the `intersects` command
- **-o, --out=[filename.geojson]**: names the output file and allows user to place it in a different location
- **-p, --skip-port-properties**: do not port input feature properties into the matched output (these are output fields normally preceeded by "pp_")
- **-p, --skip-port-properties**: do not port input feature properties into the matched output (these are output fields normally preceeded by "pp\_")
- **--bearing-field=[bearing field]**: [default: bearing] name of optional point property containing bearing in decimal degrees. If converting from GIS, this is the name of the appropriate field in the attribute table. Example: `--bearing-field=degrees`.
- **--best-direction**: only match one direction, based on best score
- **--cluster-points=[number of meters]**: target sub-segment length for clustering points (in meters). Since road segments will rarely divide evenly into the target length, actual lengths may vary slightly from the target.
Expand All @@ -146,15 +165,16 @@ The following options may be appended to the command:
- **--tile-source=[osm/planet-DATE]**: [default: osm/planet-181224] SharedStreets tile source, which is derived from OSM at the date specified (in `yymmdd` format). A new tile source is created roughly once a month and a list can be found [here](https://github.com/sharedstreets/sharedstreets-api_).
- **--two-way-value=[two-way-value]**: name of optional value of `direction-field` indicating a two-way street


#### Examples:

Matching city centerlines to SharedStreets:

```sh
$ shst match ~/Desktop/project/city_centerlines.geojson --out=city_centerlines.geojson
```

Matching city bike facilities to SharedStreets:

```sh
$ shst match ~/Desktop/project/city_bikeways.geojson --out=city_bikeways.geojson --match-bike --tile-hierarchy=8
```
Expand All @@ -164,24 +184,34 @@ $ shst match ~/Desktop/project/city_bikeways.geojson --out=city_bikeways.geojson
For developers:

### Install

```sh
git clone https://github.com/sharedstreets/sharedstreets-js.git
yarn install
yarn prepack
yarn global add /Users/username/github/sharedstreets-js
```

If installation fails on the OSRM dependency, try node v11

```sh
nvm install v11
nvm use v11
# run the rest of the install commands from above
```

### Test

You can test your installation using the following:

```sh
yarn test
```

### Troubleshooting

- When updating `sharedstreets-js`, remove the cache of graphs and data that were created using previous versions. Do this by deleting the entire `sharedstreets-js/shst` directory.


### Build docs

```sh
Expand Down

0 comments on commit 142915b

Please sign in to comment.