
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
@mapbox/graph-normalizer
Advanced tools
Takes nodes and ways and turn them into a normalized graph of intersections and ways.
Takes nodes and ways in input and turn them into a graph object.
A graph is an object of this form:
{
intersections: {
intersectionId: { GeoJson Point with properties 'ways' and 'id' },
...
},
ways: {
wayId: { geojson LineString with properties 'refs' and 'id' },
...
}
}
This module exposes methods to create and modify graph objects.
Graph objects are created from nodes
and ways
which are GeoJson and that must satisfy the following:
id
property.id
property as well as a refs
property that is an array of node ids (a comma delineated string is acceptable as well).Typically, graph-normalizer is used in tile-reduce scripts with input from graph-tiler which satisfies these requirements.
$ npm install private-npm-url
var graphNormalizer = require('graph-normalizer');
graphNormalizer.createGraph(nodes, ways [, tile]);
Return a graph where only the only nodes stored are intersections, and MultiLineString ways have been split in multiple LineString ways, with !i
appended to their id, where i
is the index of the geometry in the MultiLineString.
If a tile ([x, y, z]
array) is provided, intersections strictly outside of the tile boundaries will be discarded, and tile ids will be appended to way ids.
graphNormalizer.splitIntersections(graph);
Modifies graph
so that every way is guaranteed to not have any intersection outside of its first and last geometry coordinates.
Ways that have been split have a !A
or !B
appended to their id. Ways can be split multiple times consecutively.
graphNormalizer.mergeIntersections(graph);
Modifies graph
so that every intersection is guaranteed to connect at least 3 ways. This method is intended to work on a graph where splitIntersections
has already run.
Ways that are merged result in a way whose id is wayOne!M!wayTwo
, which keeps the order of the geometry coordinates and references to nodes.
graphNormalizer.duplicateWays(graph);
If the original ways have a oneWay
property that is 0
or 1
(which the output of graph-tiler satisfies), two-directional ways will be duplicated into one-ways after duplicateWays
is run.
Ways that are duplicated and reversed are appended a !R
to their id.
graphNormalizer.normalizeGraph(nodes, ways [, tile]);
This is just a wrapper around all previous methods.
The output of this method returns a graph that satisfies the following constraints:
FAQs
Takes nodes and ways and turn them into a normalized graph of intersections and ways.
The npm package @mapbox/graph-normalizer receives a total of 0 weekly downloads. As such, @mapbox/graph-normalizer popularity was classified as not popular.
We found that @mapbox/graph-normalizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.