当前位置: 首页>>代码示例>>Python>>正文


Python Map.gen_road_graph方法代码示例

本文整理汇总了Python中Map.gen_road_graph方法的典型用法代码示例。如果您正苦于以下问题:Python Map.gen_road_graph方法的具体用法?Python Map.gen_road_graph怎么用?Python Map.gen_road_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map.gen_road_graph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import Map [as 别名]
# 或者: from Map import gen_road_graph [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 = {}
开发者ID:LabNAYO,项目名称:MapMatching-on-JStorm,代码行数:30,代码来源:Matching.py

示例2: wg_to_bd

# 需要导入模块: import Map [as 别名]
# 或者: from Map import gen_road_graph [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:
		prev_point = -1
开发者ID:LabNAYO,项目名称:MapMatching-on-JStorm,代码行数:33,代码来源:UI.py


注:本文中的Map.gen_road_graph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。