@mapbox/graph-normalizer
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -17,2 +17,3 @@ 'use strict'; | ||
options.mergeBridges = (options.mergeBridges === undefined) ? false : options.mergeBridges; | ||
options.mergeJunctions = (options.mergeJunctions === undefined) ? false : options.mergeJunctions; | ||
@@ -79,2 +80,9 @@ // build node and way hashes | ||
) | ||
) || | ||
( | ||
(!options.mergeJunctions) && | ||
( | ||
owners[0].properties.junction !== | ||
owners[1].properties.junction | ||
) | ||
) | ||
@@ -156,3 +164,3 @@ ) nodes.delete(node); | ||
// persist oneway, highway, bridge, and tunnel tags if they are present | ||
// persist oneway, highway, bridge, tunnel, and junction tags if they are present | ||
if (opening.properties.hasOwnProperty('oneway')) combined.properties.oneway = opening.properties.oneway; | ||
@@ -177,4 +185,9 @@ | ||
else if (closing.properties.hasOwnProperty('tunnel')) combined.properties.tunnel = closing.properties.tunnel; | ||
} else if (opening.properties.hasOwnProperty('tunnel')) combined.properties.bridge = opening.properties.bridge; | ||
} else if (opening.properties.hasOwnProperty('tunnel')) combined.properties.tunnel = opening.properties.tunnel; | ||
if (options.mergeJunctions) { | ||
if (opening.properties.hasOwnProperty('junction')) combined.properties.junction = opening.properties.junction; | ||
else if (closing.properties.hasOwnProperty('junction')) combined.properties.junction = closing.properties.junction; | ||
} else if (opening.properties.hasOwnProperty('junction')) combined.properties.junction = opening.properties.junction; | ||
// insert combined way into hash | ||
@@ -181,0 +194,0 @@ ways[combined.properties.id] = combined; |
@@ -56,2 +56,3 @@ 'use strict'; | ||
if (way.properties.hasOwnProperty('ref')) waySlice.properties.ref = way.properties.ref; | ||
if (way.properties.hasOwnProperty('junction')) waySlice.properties.junction = way.properties.junction; | ||
@@ -83,2 +84,3 @@ splitWays.push(waySlice); | ||
if (way.properties.hasOwnProperty('ref')) waySlice.properties.ref = way.properties.ref; | ||
if (way.properties.hasOwnProperty('junction')) waySlice.properties.junction = way.properties.junction; | ||
@@ -85,0 +87,0 @@ splitWays.push(waySlice); |
{ | ||
"name": "@mapbox/graph-normalizer", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Takes nodes and ways and turn them into a normalized graph of intersections and ways.", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -66,7 +66,7 @@ # Graph-normalizer | ||
- Normalized way ids keep track of the history of transformations that led to it. | ||
- `highway`, `oneway`, `bridge` and `tunnel` tags are conserved from the original graph by default. | ||
- `highway`, `bridge` and `tunnel` tags can be merged using optional arguments. When merging different tags: | ||
- `highway`, `oneway`, `bridge`, `tunnel` and `junction` tags are conserved from the original graph by default. | ||
- `highway`, `bridge`, `tunnel` and `junction` tags can be merged using optional arguments. When merging different tags: | ||
- `highway` tag is set as `unclassified` | ||
- `tunnel` tag is set to `yes` i.e. we keep the info that there is a tunnel in the merged way | ||
- `bridge` tag is set to `yes` i.e. we keep the info that there is a bridge in the merged way | ||
- `junction` tag is set we keep the info about the junction in the merged way |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1978151
487
4
1