예제 #1
0
 def centroid(self):
     "Returns the centroid (a Point) of this Polygon."
     # The centroid is a Point, create a geometry for this.
     p = OGRGeometry(OGRGeomType('Point'))
     capi.get_centroid(self.ptr, p.ptr)
     return p
예제 #2
0
파일: geometries.py 프로젝트: 007lva/mmddpp
 def centroid(self):
     "Returns the centroid (a Point) of this Polygon."
     # The centroid is a Point, create a geometry for this.
     p = OGRGeometry(OGRGeomType('Point'))
     capi.get_centroid(self.ptr, p.ptr)
     return p
예제 #3
0
=======
        "Return the number of Points in this Polygon."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        # Summing up the number of points in each ring of the Polygon.
        return sum(self[i].point_count for i in range(self.geom_count))

    @property
    def centroid(self):
<<<<<<< HEAD
        "Returns the centroid (a Point) of this Polygon."
=======
        "Return the centroid (a Point) of this Polygon."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        # The centroid is a Point, create a geometry for this.
        p = OGRGeometry(OGRGeomType('Point'))
        capi.get_centroid(self.ptr, p.ptr)
        return p


# Geometry Collection base class.
class GeometryCollection(OGRGeometry):
    "The Geometry Collection class."

    def __getitem__(self, index):
<<<<<<< HEAD
        "Gets the Geometry at the specified index."
        if index < 0 or index >= self.geom_count:
            raise OGRIndexError('index out of range: %s' % index)
        else:
            return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)