@@ -1456,18 +1456,21 @@ def build_h3(cls, ids, order=1, weight="distance"):
14561456 raise ValueError ("weight must be one of 'distance', 'binary', or 'inverse'" )
14571457
14581458 @classmethod
1459- def build_travel_cost (cls , df , network , threshold , kernel = None ):
1459+ def build_travel_cost (
1460+ cls , df , network , threshold , kernel = None , mapping_distance = None
1461+ ):
14601462 """Generate a Graph based on shortest travel costs from a pandana.Network
14611463
14621464 Parameters
14631465 ----------
14641466 df : geopandas.GeoDataFrame
14651467 geodataframe representing observations which are snapped to the nearest
1466- node in the pandana.Network. If passing polygon geometries, the spatial
1467- support will be reduced to Points (via centroid) before snapping.
1468+ node in the pandana.Network. CRS should be the same as the locations
1469+ of ``node_x`` and ``node_y`` in the pandana.Network (usually 4326 if network
1470+ comes from OSM, but sometimes projected to improve snapping quality).
14681471 network : pandana.Network
14691472 pandana Network object describing travel costs between nodes in the study
1470- area
1473+ area. See <https://udst.github.io/pandana/> for more
14711474 threshold : int
14721475 threshold representing maximum cost distances. This is measured in the same
14731476 units as the pandana.Network (not influenced by the df.crs in any way). For
@@ -1480,6 +1483,10 @@ def build_travel_cost(cls, df, network, threshold, kernel=None):
14801483 libpysal.graph.Graph.build_kernel for more information on kernel
14811484 transformation options. Default is None, in which case the Graph weight
14821485 is pure distance between focal and neighbor
1486+ mapping_distance : int
1487+ snapping tolerance passed to ``pandana.Network.get_node_ids`` that defines
1488+ the maximum range at which observations are snapped to nearest nodes in the
1489+ network. Default is None
14831490
14841491 Returns
14851492 -------
@@ -1524,7 +1531,7 @@ def build_travel_cost(cls, df, network, threshold, kernel=None):
15241531 117 333.639008
15251532 Name: weight, dtype: float64
15261533 """
1527- adj = _build_travel_graph (df , network , threshold )
1534+ adj = _build_travel_graph (df , network , threshold , mapping_distance )
15281535 g = cls .from_adjacency (adj )
15291536 if kernel is not None :
15301537 arrays = _kernel (
0 commit comments