本文整理汇总了Python中graphserver.core.WalkOptions.with_wheelchair方法的典型用法代码示例。如果您正苦于以下问题:Python WalkOptions.with_wheelchair方法的具体用法?Python WalkOptions.with_wheelchair怎么用?Python WalkOptions.with_wheelchair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphserver.core.WalkOptions
的用法示例。
在下文中一共展示了WalkOptions.with_wheelchair方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: path_xml
# 需要导入模块: from graphserver.core import WalkOptions [as 别名]
# 或者: from graphserver.core.WalkOptions import with_wheelchair [as 别名]
#.........这里部分代码省略.........
# determine distance from actual origin/destination to osm nodes
orig_distance = vincenty(float(origlat), float(origlon), orig_node_lat, orig_node_lon)
dest_distance = vincenty(dest_node_lat, dest_node_lon, float(destlat), float(destlon))
#print "Origin distance: " + str(orig_distance)
#print "Destination distance: " + str(dest_distance)
# calculate time to origin and destination nodes (seconds)
time_to_orig = int(round(float( float(orig_distance) / float(walking_speed) )))
time_to_dest = int(round(float( float(dest_distance) / float(walking_speed) )))
#print "Origin time: " + str(time_to_orig)
#print "Destination time: " + str(time_to_dest)
# adjust departure time by time needed to reach origin node
dep_time = (dep_time + time_to_orig)
# adjust arrival time by time needed to reach destination node
if (arr_time != 0):
arr_time = (arr_time - time_to_dest)
#print "Adjusted departure time: " + str(dep_time)
# set walk options
wo.transfer_penalty=transfer_penalty
wo.walking_speed=walking_speed
wo.walking_reluctance=walking_reluctance
wo.max_walk=max_walk
wo.walking_overage=walking_overage
# check for wheelchair street_mode
if (street_mode == "wheelchair"):
wo.with_wheelchair = int(True)
wo.transfer_penalty = 180
else:
wo.with_wheelchair = int(False)
# check for bike street_mode
if (street_mode == "bike"):
wo.transfer_penalty = 120
# check for transit_mode
if (transit_mode == "Both"):
wo.transit_types = int(14)
elif (transit_mode == "Bus"):
wo.transit_types = int(8)
elif (transit_mode == "Rail"):
wo.transit_types = int(6)
elif (transit_mode == "None"):
wo.transit_types = int(0)
# check for less_walking flag
if (less_walking == "True"):
wo.walking_reluctance *= 10.0
# create RouteInfo object
route_info = RouteInfo()
route_info.origlat = origlat
route_info.origlon = origlon
route_info.dep_time_diff = time_to_orig
route_info.destlat = destlat
route_info.destlon = destlon
route_info.arr_time_diff = time_to_dest
route_info.street_mode = street_mode
示例2: getUrbanExplorerBlob
# 需要导入模块: from graphserver.core import WalkOptions [as 别名]
# 或者: from graphserver.core.WalkOptions import with_wheelchair [as 别名]
def getUrbanExplorerBlob(self, origlon, origlat, destlon, destlat, arrive_time, street_mode="walk", transit_mode="Both", less_walking="False", transfer_penalty=60, walking_speed=1.0, walking_reluctance=1.0, max_walk=10000, walking_overage=0.1,start_time=0,switch=1):
# get origin and destination nodes from osm map
sys.stderr.write("[get_osm_vertex_from_coords," + str(time.time()) + "]\n")
orig_osm, orig_osm_dist = self.pgosmdb.get_osm_vertex_from_coords(origlon, origlat)
dest_osm, dest_osm_dist = self.pgosmdb.get_osm_vertex_from_coords(destlon, destlat)
# get origin and destination nodes from gtfs database
sys.stderr.write("[get_station_vertex_from_coords," + str(time.time()) + "]\n")
orig_sta, orig_sta_dist = self.pggtfsdb.get_station_vertex_from_coords(origlon, origlat)
dest_sta, dest_sta_dist = self.pggtfsdb.get_station_vertex_from_coords(destlon, destlat)
# get coordinates for origin node
if (orig_osm_dist < orig_sta_dist):
origin = orig_osm
sys.stderr.write("[get_coords_for_osm_vertex," + str(time.time()) + "]\n")
orig_node_lat, orig_node_lon = self.pgosmdb.get_coords_for_osm_vertex(origin)
else:
origin = orig_sta
sys.stderr.write("[get_coords_for_station_vertex," + str(time.time()) + "]\n")
orig_node_lat, orig_node_lon = self.pggtfsdb.get_coords_for_station_vertex(origin)
# get coordinates for destination node
if (dest_osm_dist < dest_sta_dist):
dest = dest_osm
sys.stderr.write("[get_coords_for_osm_vertex," + str(time.time()) + "]\n")
dest_node_lat, dest_node_lon = self.pgosmdb.get_coords_for_osm_vertex(dest)
else:
dest = dest_sta
sys.stderr.write("[get_coords_for_station_vertex," + str(time.time()) + "]\n")
dest_node_lat, dest_node_lon = self.pggtfsdb.get_coords_for_station_vertex(dest)
wo = WalkOptions()
wo.transfer_penalty=transfer_penalty
wo.walking_speed=walking_speed
wo.walking_reluctance=walking_reluctance
wo.max_walk=max_walk
wo.walking_overage=walking_overage
# check for wheelchair street_mode
if (street_mode == "wheelchair"):
wo.with_wheelchair = int(True)
wo.transfer_penalty = 180
else:
wo.with_wheelchair = int(False)
# check for bike street_mode
if (street_mode == "bike"):
wo.transfer_penalty = 120
# check for transit_mode
if (transit_mode == "Both"):
wo.transit_types = int(14)
elif (transit_mode == "Bus"):
wo.transit_types = int(8)
elif (transit_mode == "Rail"):
wo.transit_types = int(6)
elif (transit_mode == "None"):
wo.transit_types = int(0)
# check for less_walking flag
if (less_walking == "True"):
wo.walking_reluctance *= 10.0
if (start_time == 0):
start_time = int(time.time())
if (switch == 1):
graphserver.core.makeImage(self.graph.soul, origin, dest, State(self.graph.num_agencies,start_time), State(self.graph.num_agencies,arrive_time), wo)
return open("explorerimages/blah.png", "rb").read()
else:
graphserver.core.makeUrbanExplorerBlob(self.graph.soul, origin, dest, State(self.graph.num_agencies,start_time), State(self.graph.num_agencies,arrive_time), wo)
return open("explorerimages/blah2.png", "rb").read()