Ejemplo n.º 1
0
 def dist_to_all_nds(self, lon, lat):
     ## Needs optimization, write a numpy version of computeDist
     return map((
         lambda i: {
             'id': self.node_ids[i],
             'dist': computeDist(lon, lat, self.node_lons[i], self.
                                 node_lats[i])
         }), range(len(self.node_ids)))
Ejemplo n.º 2
0
 def dist_to_all_nds(self, lon, lat):
     ## Needs optimization, write a numpy version of computeDist
     return map((lambda i : {'id' : self.node_ids[i],
                             'dist' : computeDist(lon, 
                                                  lat,
                                                  self.node_lons[i], 
                                                  self.node_lats[i])}),
                range(len(self.node_ids)))
     
     
     
     
     
Ejemplo n.º 3
0
#
start = my_network.lkd_nds.keys()[0]
end   = 240469798

#
#    Get their latitudes and longitudes
#
lon_1 = my_network.lkd_nds[start]['lon']
lat_1 = my_network.lkd_nds[start]['lat']
lon_2 = my_network.lkd_nds[end]['lon']
lat_2 = my_network.lkd_nds[end]['lat']

#
#    Compute the distance between the two nodes
#
dist = computeDist(lon_1, lat_1, lon_2, lat_2)

#
#    Compute all paths betwoeen start and end whose length is below dist * 1.35
#
path_finding_result = my_network.find_all_paths(start, end, dist * 1.35)

#
#    Extract the ids along the first path (the shortest)
#
path_points = path_finding_result['paths'][1]

#
#    Plot the path onto the network
#
#===============================================================================
Ejemplo n.º 4
0
def l2_dist(node_1, node_2):
    lat_1 = float(node_1.get('lat'))
    lon_1 = float(node_1.get('lon'))
    lat_2 = float(node_2.get('lat'))
    lon_2 = float(node_2.get('lon'))
    return computeDist(lon_1, lat_1, lon_2, lat_2)