mirror of
https://github.com/noncomputable/AgentMaps.git
synced 2026-02-01 17:27:27 +00:00
removed & replaced deprecated turf dep
This commit is contained in:
parent
ae03116337
commit
99f6549f85
@ -1,7 +1,7 @@
|
||||
/* The Agentmap class, which turns a Leaflet map into a simulation platform. */
|
||||
|
||||
let lineSlice = require('@turf/line-slice').default,
|
||||
lineDistance = require('@turf/line-distance');
|
||||
length = require('@turf/length').default;
|
||||
|
||||
/**
|
||||
* The main class for building, storing, simulating, and manipulating agent-based models on Leaflet maps.
|
||||
@ -238,7 +238,7 @@ Agentmap.prototype.getNearestIntersection = function(lat_lng, place) {
|
||||
let start_coords = L.A.pointToCoordinateArray(lat_lng);
|
||||
intersection_coords = L.A.pointToCoordinateArray(intersection_point),
|
||||
segment = lineSlice(start_coords, intersection_coords, street_feature),
|
||||
distance = lineDistance(segment);
|
||||
distance = length(segment);
|
||||
*/
|
||||
|
||||
intersection_points.push(intersection_point);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
let path = require("ngraph.path"),
|
||||
createGraph = require("ngraph.graph"),
|
||||
lineSlice = require('@turf/line-slice').default,
|
||||
lineDistance = require('@turf/line-distance'),
|
||||
length = require('@turf/length').default,
|
||||
Agentmap = require('./agentmap').Agentmap;
|
||||
|
||||
/**
|
||||
@ -73,7 +73,7 @@ function streetToGraph(graph, street) {
|
||||
start_coords = L.A.pointToCoordinateArray(node_a),
|
||||
end_coords = L.A.pointToCoordinateArray(node_b),
|
||||
segment = lineSlice(start_coords, end_coords, street.toGeoJSON()),
|
||||
distance = lineDistance(segment);
|
||||
distance = length(segment);
|
||||
graph.addLink(a_string, b_string, {
|
||||
distance: distance,
|
||||
place: { type: "street",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user