From 99f6549f850783c5f15539eed6a93c04ed87fe0c Mon Sep 17 00:00:00 2001 From: noncomputable Date: Sun, 2 Sep 2018 15:38:36 -0400 Subject: [PATCH] removed & replaced deprecated turf dep --- src/agentmap.js | 4 ++-- src/routing.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/agentmap.js b/src/agentmap.js index c1d8a45..d7a4d6a 100644 --- a/src/agentmap.js +++ b/src/agentmap.js @@ -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); diff --git a/src/routing.js b/src/routing.js index 10232b5..8670675 100644 --- a/src/routing.js +++ b/src/routing.js @@ -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",