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

Missing POIs with a small network #43

Closed
jiffyclub opened this issue Jul 14, 2015 · 2 comments
Closed

Missing POIs with a small network #43

jiffyclub opened this issue Jul 14, 2015 · 2 comments

Comments

@jiffyclub
Copy link
Member

When I make a very small network (in this case two nodes), there seems to be a problem with POIs. In the example below I'm adding four POIs but nearest_pois only ever finds one. My hunch is that some of the POIs aren't actually being assigned to nodes, maybe because they are outside the the bounding box formed by the network nodes? (They are inside the original bounding box, though.)

In [1]: from pandana.loaders import osm

In [2]: bbox = (37.8668405874, -122.2590948685, 37.8679028054, -122.2586363885)

In [3]: network = osm.network_from_bbox(*bbox)
Generating contraction hierarchies with 1 threads.
Setting CH node vector of size 2
Setting CH edge vector of size 1
[info src/contraction_hierarchies/src/libch.cpp:205] Range graph removed 0 edges of 2
. 10% . 20% . 30% . 40% . 50%  100%
. 60% . 70% . 80% . 90% . 100%
In [4]: network.nodes_df
Out[4]:
                   x          y
id
53063555 -122.258810  37.866910
53099275 -122.258993  37.867808

In [5]: query = "amenity=restaurant"

In [6]: data = osm.node_query(*bbox, tags=query)

In [7]: data
Out[7]:
               amenity    cuisine        lat         lon           name
id
286632169   restaurant        NaN  37.867231 -122.258692     Tako Sushi
366088674   restaurant        NaN  37.867388 -122.258940  Naan 'n Curry
1419597327  restaurant  ice_cream  37.867044 -122.258676          Cream
2965338413  restaurant      asian  37.867116 -122.258682   Koja Kitchen

In [8]: network.init_pois(num_categories=1, max_dist=1000, max_pois=5)

In [9]: network.set_pois(query, data['lon'], data['lat'])

In [10]: network.nearest_pois(1000, query, num_pois=3)
Out[10]:
                   1     2     3
id
53063555  101.205002  1000  1000
53099275    0.000000  1000  1000

In [11]:
@fscottfoti
Copy link
Contributor

Thanks for the example - I will take a look when I get the chance.

@fscottfoti
Copy link
Contributor

Well it took me almost two years, but I finally got around to trying it.

I'm not sure if it was related to the big overhaul of the internals in #87 but it appears to work appropriately now (3 pois are found at < 1000m)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants