Skip to content

Commit

Permalink
Support mapping_distance with POIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rikuoja committed Aug 30, 2021
1 parent 3e3d35c commit f63184c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pandana/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,8 @@ def init_pois(self, num_categories, max_dist, max_pois):
)
return None

def set_pois(self, category=None, maxdist=None, maxitems=None, x_col=None, y_col=None):
def set_pois(self, category=None, maxdist=None, maxitems=None, x_col=None, y_col=None,
mapping_distance=mapping_distance):
"""
Set the location of all the points of interest (POIs) of this category.
The POIs are connected to the closest node in the Pandana network
Expand All @@ -648,6 +649,13 @@ def set_pois(self, category=None, maxdist=None, maxitems=None, x_col=None, y_col
The x location (longitude) of POIs in this category
y_col : pandas.Series (float)
The y location (latitude) of POIs in this category
mapping_distance : float, optional
The maximum distance that will be considered a match between the
POIs and the nearest node in the network. This will usually
be a distance unit in meters however if you have customized the
impedance this could be in other units such as utility or time
etc. If not specified, every POI will be mapped to
the nearest node.
Returns
-------
Expand Down Expand Up @@ -677,7 +685,7 @@ def set_pois(self, category=None, maxdist=None, maxitems=None, x_col=None, y_col

self.max_pois = maxitems

node_ids = self.get_node_ids(x_col, y_col)
node_ids = self.get_node_ids(x_col, y_col, mapping_distance=mapping_distance)

self.poi_category_indexes[category] = node_ids.index

Expand Down

0 comments on commit f63184c

Please sign in to comment.