示例#1
0
def orient(geom, sign=1.0):
    """A properly oriented copy of the given geometry.

    The signed area of the result will have the given sign. A sign of
    1.0 means that the coordinates of the product's exterior rings will
    be oriented counter-clockwise.

    Parameters
    ----------
    geom : Geometry
        The original geometry. May be a Polygon, MultiPolygon, or
        GeometryCollection.
    sign : float, optional.
        The sign of the result's signed area.

    Returns
    -------
    Geometry

    """
    if isinstance(geom, BaseMultipartGeometry):
        return geom.__class__(
            list(map(
                lambda geom: orient(geom, sign),
                geom.geoms,
            )))
    if isinstance(geom, (Polygon, )):
        return orient_(geom, sign)
    return geom
示例#2
0
 def orient(geom, sign=1.0):
     if isinstance(geom, BaseMultipartGeometry):
         return geom.__class__(
             list(map(lambda geom: orient(geom, sign), geom.geoms)))
     if isinstance(geom, (Polygon, )):
         return orient_(geom, sign)
     return geom