You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/get-surface.js
+42-5Lines changed: 42 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,37 @@ import dbg from 'debug'
2
2
importpropagatefrom'./propagation'
3
3
constdebug=dbg('browsochrones:get-surface')
4
4
5
+
constMAX_TRIP_LENGTH=120// minutes
6
+
5
7
/**
6
8
* Get a travel time surface and accessibility results for a particular origin.
7
9
* Pass in references to the query (the JS object stored in query.json), the stopTreeCache, the origin file, the
8
10
* x and y origin point relative to the query, what parameter you want (BEST_CASE, WORST_CASE or MEDIAN),
9
-
* and a cutoff for accessibility calculations. Returns a travel time/accessibility surface which can be used by isochoroneTile and accessibilityForCutoff
11
+
* and a cutoff for accessibility calculations. Sets the current surface within the Browsochrones instance,
12
+
* and returns data used to draw a spectrogram.
13
+
* This is basically just an array of curves like so:
14
+
* For each iteration you will have an array of
15
+
* [opportunities reachable in 1 minute,
16
+
* marginal opportunities reachable in 2 minutes,
17
+
* ...
18
+
* marginal opportunities reachable in 120 minutes]
19
+
*
20
+
* This does mean that changing the grid requires recomputing the surface even though that's not technically
21
+
* required. It is assumed this is a relatively rare occurence and it's worth the extra work there to
22
+
* avoid doing propagation twice, once for getting the surface and once for the spectrogram data.
23
+
* It's also better than having duplicate code to avoid computing a surface sometimes. We could add a
24
+
* switch to this function to select what is generated but that may even be more complexity than is needed.
0 commit comments