if node exists but not connected in the net (doesn't exists in links table) pandana returns a constant distance (different from zero, 4294967.295 is the value). So Pandana is providing a shortest path length, even if shortest path returns an empty list.
This function matches external idx with internal ones in the net object. The shortest path method uses this function to count nodes between origin/destination here. It returns empty list, so the internal/external idx are working fine.
But, when the same operation occurs here (nodes idx are the same as shown in shortest path calculation I mention above), I get a len value for nodes involved in the empty list output. In short, I'm getting a numeric value for shortest distance when both nodes are not connected.
The shortest_path_distance calculation is call from cyacces interface (not sure but I guess here)
While creating the net object by excluding non connected nodes, the shortest path will return a ValueError: cannot convert float NaN to integer when trying to look for these internal net node indexes (here). Nodes don't exist, so shortest path can't be calculated (which is ok).
Alternatives:
including a warning to declare that there are non connected nodes after the net is created
adding some if statement here to discriminate distance metric as follow:
if node exists but not connected in the net (doesn't exists in links table) pandana returns a constant distance (different from zero,
4294967.295
is the value). So Pandana is providing a shortest path length, even if shortest path returns an empty list.This function matches external idx with internal ones in the
net
object. The shortest path method uses this function to count nodes between origin/destination here. It returns empty list, so the internal/external idx are working fine.But, when the same operation occurs here (nodes idx are the same as shown in shortest path calculation I mention above), I get a
len
value for nodes involved in the empty list output. In short, I'm getting a numeric value for shortest distance when both nodes are not connected.The shortest_path_distance calculation is call from cyacces interface (not sure but I guess here)
While creating the
net
object by excluding non connected nodes, the shortest path will return aValueError: cannot convert float NaN to integer
when trying to look for these internal net node indexes (here). Nodes don't exist, so shortest path can't be calculated (which is ok).Alternatives:
if len(shortest_nodes)==0: len=0 else: len = self.net.shortest_path_distance(node_a, node_b, imp_num)