Example #1
0
def explain_validity(shp):

    from shapely.wkt import loads
    from shapely.geos import lgeos
    """
   Explains the validity reason of each feature in a shapefile
   """
    ds = openToRead(shp)
    layer = ds.GetLayer()
    nbfeat = getNbFeat(shp)
    for feat in layer:
        geom = feat.GetGeometryRef()
        ob = loads(geom.ExportToWkt())
        print lgeos.GEOSisValidReason(ob._geom)
        a = raw_input()
    return 0
Example #2
0
def explain_validity(ob):
    """
    Explain the validity of the input geometry, if it is invalid.
    This will describe why the geometry is invalid, and might
    include a location if there is a self-intersection or a
    ring self-intersection.

    Parameters
    ----------
    ob: Geometry
        A shapely geometry object

    Returns
    -------
    str
        A string describing the reason the geometry is invalid.

    """
    return lgeos.GEOSisValidReason(ob._geom)
Example #3
0
def explain_validity(ob):
    return lgeos.GEOSisValidReason(ob._geom)
Example #4
0
 def __call__(self, this):
     return lgeos.GEOSisValidReason(this._geom)