Cross Street Indexer
Light weigth reverse geocoding for cross street 100% sourced from OSM QA Tiles.
Features
- Blazing fast 1/20th of a millisecond search (275,000 ops/sec)
- Processed United States OSM QA Tiles in 35m 13s (189714 tiles)
- Easy to use CLI to build index
- Node 6 & 7 compatible
- Only uses Tile Reduce + Turf
- Ready for S3 Upload or LevelDB
- Bundled 5MB QA-Tiles for testing purposes
Process
Install
npm
$ npm install --global cross-street-indexer
yarn
$ yarn global add cross-street-indexer
Quickstart
$ cross-street-indexer latest.planet.mbtiles --tiles [[654,1584,12]]
$ cross-street-search "Chester St" "ABBOT AVE." --tiles [[654,1584,12]]
-122.457711,37.688544
CLI
Cross Street Indexer
$ cross-street-indexer --help
Cross Street Indexer
Usage:
$ cross-street-indexer <qa-tiles>
Options:
--output [cross-street-index] Filepath to store outputs
--bbox Excludes QATiles by BBox
--tiles Excludes QATiles by an Array of Tiles
--debug [false] Enables DEBUG mode
Examples:
$ cross-street-indexer latest.planet.mbtiles
$ cross-street-indexer latest.planet.mbtiles --tiles [[654,1584,12]]
$ cross-street-indexer latest.planet.mbtiles --bbox [-122.519,37.629,-122.168,37.917]
Cross Street Search
$ cross-street-search --help
Cross Street Indexer
Usage:
$ cross-street-search <name1> <name2>
Options:
--output [cross-street-index] filepath to Cross Street index output folder
--tiles Lookup index files via an Array of Tiles or Quadkeys
--bbox Lookup index files via BBox
--stream Enables reading from streaming index file (ignores tiles options)
Examples:
$ cross-street-search "Chester St" "ABBOT AVE." --tiles [[654,1584,12]]
$ cross-street-search "Chester St" "ABBOT AVE." --tiles '["023010221110"]'
$ cat 023010221110.json | cross-street-search "Chester St" "ABBOT AVE."
Normalization Process
Normalization should follow the following standards:
- Drop any period if exists
- Street suffix to full name
- ave => avenue
- CIR => circle
- ln => lane
- Name should be entirely lowercase
- Parkside Avenue => parkside avenue
- Direction to full word
- N => north
- S => south
- NE => northeast
Index (JSON Lines)
The Cross Street Index is stored in an easy to read key/value JSON Lines format.
- key: Normalized road pairs (
<name1>+<name2>
) - value: Longitude & Latitude
{"abbot avenue+chester street":[-122.457711,37.688544]}
{"chester street+abbot avenue":[-122.457711,37.688544]}
{"chester street+lisbon street":[-122.45821,37.68796]}
{"lisbon street+chester street":[-122.45821,37.68796]}
{"hoffman street+lisbon street":[-122.456764,37.687179]}
OSM Attributes
name
: Street name (Abbot Avenue)ref
Reference number normaly used to tag highways numbershighway
classification (residential, primary, secondary)bridge
yes/notunnel
yes/no@id
OSM ID of street (way)
Debugging
Adding --debug
will store .geojson
items for each process & for each QA-Tile:
{
"tile": [
654,
1584,
12
],
"quadkey": "023010221110",
"features": 49003,
"lines": 2427,
"intersects": 1921,
"index": 3882
}
Additional files will be created in the debug/
folder:
debug/<quadkey>/lines.geojson
- Filtered (Multi)LinesString from QA-Tiledebug/<quadkey>/intersects.geojson
- Point which are intersecting roadsdebug/<quadkey>/index.json
- Final Cross Street indexdebug/<quadkey>/debug.json
- Debug details
Limitations
Loops
Loops would return multiple cross street matches, only the last matched point is stored.
Turning Circles
Turning Circles without any names are exclude, thus not finding any matches.
References