Coder Social home page Coder Social logo

Comments (16)

nuripurswani avatar nuripurswani commented on July 19, 2024

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.

jiffyclub avatar jiffyclub commented on July 19, 2024

I don't know of a way to do this. @fscottfoti?

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

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.

nuripurswani avatar nuripurswani commented on July 19, 2024

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.

fscottfoti avatar fscottfoti commented on July 19, 2024

@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.

fscottfoti avatar fscottfoti commented on July 19, 2024

@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.

nuripurswani avatar nuripurswani commented on July 19, 2024

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.

fscottfoti avatar fscottfoti commented on July 19, 2024

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.

fscottfoti avatar fscottfoti commented on July 19, 2024

I will also merge that branch so you can now get the code in master.

from pandana.

nuripurswani avatar nuripurswani commented on July 19, 2024

@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.

nuripurswani avatar nuripurswani commented on July 19, 2024

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.

fscottfoti avatar fscottfoti commented on July 19, 2024

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)

#48

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.

nuripurswani avatar nuripurswani commented on July 19, 2024

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.

nuripurswani avatar nuripurswani commented on July 19, 2024

PS. I apologise for the basic question- I'm new to git branches

from pandana.

fscottfoti avatar fscottfoti commented on July 19, 2024

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.

fscottfoti avatar fscottfoti commented on July 19, 2024

This was fixed before not sure why I didn't close it

from pandana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.