本文整理汇总了Python中profile.Profile.concat方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.concat方法的具体用法?Python Profile.concat怎么用?Python Profile.concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profile.Profile
的用法示例。
在下文中一共展示了Profile.concat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_ep_profile
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import concat [as 别名]
def get_ep_profile( profiledb, edgepayload ):
combiner = Profile()
streets = unpack_streets( edgepayload )
for street in streets:
combiner.add( get_street_profile(profiledb, street) )
return combiner.concat() #reduce( lambda x,y:x+y, profile )
示例2: path
# 需要导入模块: from profile import Profile [as 别名]
# 或者: from profile.Profile import concat [as 别名]
def path(self, lat1, lng1, lat2, lng2, transfer_penalty=0, walking_speed=1.0, hill_reluctance=20, narrative=True, jsoncallback=None):
t0 = time.time()
origin = "osm-%s"%self.osmdb.nearest_node( lat1, lng1 )[0]
dest = "osm-%s"%self.osmdb.nearest_node( lat2, lng2 )[0]
endpoint_find_time = time.time()-t0
print origin, dest
t0 = time.time()
wo = WalkOptions()
#wo.transfer_penalty=transfer_penalty
#wo.walking_speed=walking_speed
wo.walking_speed=4
wo.walking_overage = 0
wo.hill_reluctance = 20
wo.turn_penalty = 15
edgepayloads = self.ch.shortest_path( origin, dest, State(1,0), wo )
wo.destroy()
route_find_time = time.time()-t0
t0 = time.time()
names = []
geoms = []
profile = Profile()
total_dist = 0
total_elev = 0
if narrative:
names, total_dist = get_full_route_narrative( self.osmdb, edgepayloads )
for edgepayload in edgepayloads:
geom, profile_seg = self.shortcut_cache.get( edgepayload.external_id )
#geom = get_ep_geom( self.osmdb, edgepayload )
#profile_seg = get_ep_profile( self.profiledb, edgepayload )
geoms.extend( geom )
profile.add( profile_seg )
route_desc_time = time.time()-t0
ret = json.dumps( (names,
encode_pairs( [(lat, lon) for lon, lat in geoms] ),
profile.concat(300),
{ 'route_find_time':route_find_time,
'route_desc_time':route_desc_time,
'endpoint_find_time':endpoint_find_time,},
{ 'total_dist':total_dist,
'total_elev':total_elev}) )
if jsoncallback:
return "%s(%s)"%(jsoncallback,ret)
else:
return ret