save_load.py 文件源码

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

项目:osmnx 作者: gboeing 项目源码 文件源码
def is_same_geometry(data, data_other):
    """
    Check if LineString geometries in two edge data dicts are the same, in
    normal or reversed order of points.

    Parameters
    ----------
    data : dict
        the first edge's data
    data_other : dict
        the second edge's data

    Returns
    -------
    bool
    """

    # extract geometries from each edge data dict
    geom1 = [list(coords) for coords in data['geometry'].xy]
    geom2 = [list(coords) for coords in data_other['geometry'].xy]

    # reverse the first edge's list of x's and y's to look for a match in
    # either order
    geom1_r = [list(reversed(list(coords))) for coords in data['geometry'].xy]

    # if the edge's geometry matches its reverse's geometry in either order,
    # return True
    return (geom1 == geom2 or geom1_r == geom2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号