Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
geojson-network-parser
Advanced tools
Readme
npm install geojson-network-parser
const NetworkParser = require('geojson-network-parser');
var geojson = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {
layer: 'roadway',
cost: 4
},
geometry: {
type: 'LineString',
geometry: [[-37.231312, 32.4444], [-37.23111, 32.5534] /* and so on ... */ ]
}
},
// ... and so on with more roads
]
};
// Filter the features only process the ones that represent roads
const roads = geojson.features.filter(f => (f.properties.layer === "roadway"));
// Turn the GeoJSON FeatureCollection of roads into a network that we can find shortest-path routes on
const network = new NetworkParser(roads, "cost", 2);
const parsed = network.parse({
tolerance: 0.0000075, // Ignore gaps greater than this distance. Units are in degrees latitude, so values < 0.00002 are a good starting point.
ignoreCrossings: false // If `true`, intersections will only be added where there are two nearby points in the original FeatureCollection. If `false`, intersections will be inferred where two edge segments cross each other.
});
// Snap latitude/longitude point to nearest node on the network
const A = network.getNearestNode([-37.231312, 32.4444]);
const B = network.getNearestNode([-37.23111, 32.5534]);
// Get a list of nodes that connect the shortest path between two points
const route = network.findShortestPath(A, B);
Clone this repo then run:
npm install
npm run build
This will output a bundled js file to dist/geojson-network-parser.js
.
FAQs
A utility that turns a GeoJSON FeatureCollection of a road network and turns it into a routable graph
We found that geojson-network-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).