Comments (16)
To simplify the wording of my question using the tutorial as an example:
I am able to obtain the distances of every node in the network to its 10 nearest restaurants given a cut-off radius. However, I'd like to find out the names/ids of those 10 nearest restaurants and store the result next to every node in the network along with the distances. Ideally, I'd like to store in a data frame.
from pandana.
I don't know of a way to do this. @fscottfoti?
from pandana.
Had to read some C++ code to answer this one... In fact, it is possible in the underlying C library, just not in Python at this time. I will see if I can carve out some time to add this feature.
from pandana.
Thanks for your swift responses.
The set_pois function takes in the 'lat' and 'long' of the (hospital/restaurant) nodes as inputs so perhaps there's a way of attaching the ids of these nodes as an output to the nearest_pois query? I presume that the points utilised to calculate distances (shortest to 10th shortest) for each node in the network get stored somewhere in a local variable or is this underlying code written in C++?
I have also been looking at other methods to find out which points fall within a buffer radius (QGIS, other python libraries, etc) although these would be based on euclidian distance queries as opposed to focusing on the functionalities of network analysis in pandana.
from pandana.
@nuripurswani are you comfortable with git and branches? I mean, if I check in a quick fix for this and leave on a branch for a while would you be comfortable to switch to the branch and "python setup.py install"?
from pandana.
@nuripurswani I think this branch will work for you #47
The pull request describes how to use it - to get the code
git clone https://github.com/UDST/pandana.git
git checkout which-poi
python setup.py develop
from pandana.
Hi, I tested the new branch today. It works!!! Thank you so much for all your help - it's exactly what I needed.
I have another quick question to ask on the nearest_pois query:
When it calculates the 10 shortest paths, I assume that the distances are computed by developing node lists and summing the distances from node to node stored in the network structure until we get to the point of interest or hospital.
Are the node ids, or more importantly, the way ids utilised for calculating distances/impedances also stored locally inside the function?
Many thanks,
Nuri
from pandana.
Right so you just want the shortest path from point to point? Yes, that's a method that's available but hasn't been exposed in Python yet either. I might be able to add that as well at some point soon. Is it critical for your application?
from pandana.
I will also merge that branch so you can now get the code in master.
from pandana.
@fscottfoti - thanks so much for your help. Yes- this is correct. The idea would be to have an output that's quite similar to what you've already created for the poi ids as follows (taking the hospital example):
1 2
id dist1 dist2
1 2
id hosp1 hosp2
1 2
id [osm_node_list1] [nodelist_2]
1 2
id [osm_way_id_list 1] [osm_way_id_list2]
It's fairly important for the application in order to match the node id/way ids to other parameters such as the road surface or average speed of travel. However, knowing the IDs of the pois is a great step forward :) Many thanks!!
from pandana.
So to clarify again- since we have the distances, having the node lists used to compute that distance or shortest - nth shortest path is helpful. The way ids are less redundant as many nodes can be part of the same way but the nodes are OK by themselves.
from pandana.
OK, so this is the easiest way for me to add it - there's a new method to return the shortest path between two node ids (I can also imagine doing a dataframe of queries and returning a dataframe of routes, but this is the first step)
As a reminder, you can get node ids from xys if you need to do that, here:
https://github.com/UDST/pandana/blob/master/pandana/network.py#L340
from pandana.
Excellent- are the functions in issue 48 which you listed already in a new git branch? I couldn't find them in the source code so I assume they are new? Happy to contribute by creating a function that will store the results in a data frame if this is of interest?
from pandana.
PS. I apologise for the basic question- I'm new to git branches
from pandana.
No problem. Yes the branch is called single-shortest-path.
Not sure about the dataframe. The problem is the paths will all be
different lengths, but I suppose leaving nans in the dataframe and having
as many columns as the longest path or something like that could make
sense. Not sure there's a huge advantage to though. I cant think of a
dataframe op I'd want to run on it?? Maybe worth it just for to_csv?
On Fri, Nov 13, 2015, 11:04 PM Nuri [email protected] wrote:
PS. I apologise for the basic question- I'm new to git branches
—
Reply to this email directly or view it on GitHub
#46 (comment).
from pandana.
This was fixed before not sure why I didn't close it
from pandana.
Related Issues (20)
- Support for Python 3.9 HOT 1
- Support for MacOS 11.0 Big Sur HOT 2
- Support for M1 Macs HOT 3
- [Question] How to get different Key|Value combinations in osm.node_query
- [Feature Request] Aggreggation queries to subset of nodes
- Binary incompatibility error with older versions of NumPy HOT 1
- Shortest path length exists but shortest path is empty HOT 5
- shortest path distance between non connected nodes
- Allow specifying mapping distance for POIs
- Issue: the POI Accessibility computation is taking forever
- OSM loader - POIs that are ways in OSM HOT 1
- Pandana network initiation slow for large network HOT 4
- how to increase the performance of the aggregate when impedance is changed to time?
- net.shortest_paths doesn't work with multiprocessing
- tables sub-dependency versions conflict with python 3.10 compatibility when installing with pip HOT 1
- incorrect shortest paths solutions when impendance values are particularly small or large HOT 1
- Plotting with Pandana does not render title HOT 1
- osm.pdna_network_from_bbox error HOT 6
- Pulling network object from OSM bugged HOT 2
- New release ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandana.