Exemple #1
0
def get_evenly_spaced_points_along_border(boundary: BaseGeometry,
                                          spacing: float,
                                          offset: float = 0.0,
                                          max_number: Optional[int] = None,
                                          ) -> [Point]:
    """
    Spaced equally traversing the perimeter
    :param boundary: a boundary line
    :param spacing: distance between points
    :param offset: shifting where to start placing points
    :param max_number: max points
    :return: list of Points
    """
    length = boundary.length - spacing
    result = []
    d = 0.0
    starting_pt = offset * spacing
    while d <= length and (max_number is None or len(result) < max_number):
        result.append(boundary.interpolate(starting_pt + d))
        d += spacing
    # print('site_shape: ', [c for c in site_shape.coords])
    # print('boundary: ', [(p.x, p.y) for p in result])
    return result