Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mapping_distance with POIs #171

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=None):
"""
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