(ob, update_geom=None, update_ndim=0)
Create a GEOS geom from an object that is a Point, a coordinate sequence
    or that provides the array interface.

    Returns the GEOS geometry and the number of its dimensions.
Create a GEOS geom from an object that is a Point, a coordinate sequence
    or that provides the array interface.
Create a GEOS geom from an object that is a Point a coordinate sequence or that provides the array interface .
def geos_point_from_py(ob, update_geom=None, update_ndim=0):
    """Create a GEOS geom from an object that is a Point, a coordinate sequence
    or that provides the array interface.

    Returns the GEOS geometry and the number of its dimensions.
    """
    if isinstance(ob, Point):
        return geos_geom_from_py(ob)

    # Accept either (x, y) or [(x, y)]
    if not hasattr(ob, '__getitem__'):  # Iterators, e.g. Python 3 zip
        ob = list(ob)

    if isinstance(ob[0], tuple):
        coords = ob[0]
    else:
        coords = ob
    n = len(coords)
    dx = c_double(coords[0])
    dy = c_double(coords[1])
    dz = None
    if n == 3:
        dz = c_double(coords[2])

    if update_geom:
        cs = lgeos.GEOSGeom_getCoordSeq(update_geom)
        if n != update_ndim:
            raise ValueError(
                "Wrong coordinate dimensions; this geometry has dimensions: "
                "%d" % update_ndim)
    else:
        cs = lgeos.GEOSCoordSeq_create(1, n)

    # Because of a bug in the GEOS C API, always set X before Y
    lgeos.GEOSCoordSeq_setX(cs, 0, dx)
    lgeos.GEOSCoordSeq_setY(cs, 0, dy)
    if n == 3:
        lgeos.GEOSCoordSeq_setZ(cs, 0, dz)

    if update_geom:
        return None
    else:
        return lgeos.GEOSGeom_createPoint(cs), n
def geos_point_from_py ( ob , update_geom = None , update_ndim = 0 ) : if isinstance ( ob , Point ) : return geos_geom_from_py ( ob ) # Accept either (x, y) or [(x, y)] if not hasattr ( ob , '__getitem__' ) : # Iterators, e.g. Python 3 zip ob = list ( ob ) if isinstance ( ob [ 0 ] , tuple ) : coords = ob [ 0 ] else : coords = ob n = len ( coords ) dx = c_double ( coords [ 0 ] ) dy = c_double ( coords [ 1 ] ) dz = None if n == 3 : dz = c_double ( coords [ 2 ] ) if update_geom : cs = lgeos . GEOSGeom_getCoordSeq ( update_geom ) if n != update_ndim : raise ValueError ( "Wrong coordinate dimensions; this geometry has dimensions: " "%d" % update_ndim ) else : cs = lgeos . GEOSCoordSeq_create ( 1 , n ) # Because of a bug in the GEOS C API, always set X before Y lgeos . GEOSCoordSeq_setX ( cs , 0 , dx ) lgeos . GEOSCoordSeq_setY ( cs , 0 , dy ) if n == 3 : lgeos . GEOSCoordSeq_setZ ( cs , 0 , dz ) if update_geom : return None else : return lgeos . GEOSGeom_createPoint ( cs ) , n