testGetBoundaries.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:policosm 作者: ComplexCity 项目源码 文件源码
def getRoadsBoundaries(graph):
    lons = nx.get_node_attributes(graph,'longitude').values()
    lats = nx.get_node_attributes(graph,'latitude').values()

    lon = lons[0]
    lat = lats[0]

    bounds = [lon,lat,lon,lat]

    for i in range(0,len(lons)):
        lon = lons[i]
        lat = lats[i]
        if lon < bounds[0]:
            bounds[0] = lon
        if lon > bounds[2]:
            bounds[2] = lon
        if lat < bounds[1]:
            bounds[1] = lat
        if lat > bounds[3]:
            bounds[3] = lat
    return bounds
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号