本文整理汇总了Python中Map.index_roads_on_grid方法的典型用法代码示例。如果您正苦于以下问题:Python Map.index_roads_on_grid方法的具体用法?Python Map.index_roads_on_grid怎么用?Python Map.index_roads_on_grid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map.index_roads_on_grid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Map [as 别名]
# 或者: from Map import index_roads_on_grid [as 别名]
def __init__ (self, search_range = 100):
bjmap = Map()
filenames = ["bjmap/road"]
bjmap.load_roads(filenames)
bjmap.stat_map_info()
bjmap.index_roads_on_grid()
bjmap.gen_road_graph()
self.traj_map = bjmap
self.search_range = search_range
#for constructing a coordinate map in meters
m_latitude = (self.traj_map.min_latitude + self.traj_map.max_latitude) / 2
self.WIDTH = map_dist(self.traj_map.min_longitude, m_latitude, self.traj_map.max_longitude, m_latitude)
m_longitude = (self.traj_map.min_longitude + self.traj_map.max_longitude) / 2
self.HEIGHT = map_dist(m_longitude, self.traj_map.min_latitude, m_longitude, self.traj_map.max_latitude)
print "Connecting..Database: shortest_path..."
self.conn_sp = psycopg2.connect(host='localhost', port='5432', database="mapmatching", user='postgres',password='123456')
print "Connected!"
self.cursor_sp = self.conn_sp.cursor()
self.shortest_path = {}
self.initialize_sp()
self.supp = {}
示例2: wg_to_bd
# 需要导入模块: import Map [as 别名]
# 或者: from Map import index_roads_on_grid [as 别名]
return mg_lon, mg_lat
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def wg_to_bd(self, wg_lon, wg_lat):
mg_lon, mg_lat = self.wg_to_Mars(wg_lon, wg_lat)
bd_lon, bd_lat = self.Mars_to_bd(mg_lon, mg_lat)
return bd_lon,bd_lat
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if __name__ == "__main__":
bjmap = Map()
filenames = ["bjmap_new/road"]
bjmap.load_roads(filenames)
bjmap.stat_map_info()
bjmap.index_roads_on_grid()
bjmap.gen_road_graph()
matching_module = Matching(bjmap, 100)
master = Tk()
map_canvas = MapCanvas(bjmap, master)
map_canvas.draw_map()
traj_file = []
traj_file.append("oneMonthData/oneMonth_967790112791.txt")
map_canvas.load_traj(traj_file)
time_sum = 0.0 # record the time consumption for matching
for f in traj_file: