コード例 #1
0
ファイル: geometries.py プロジェクト: huicheese/Django-test3
 def __getitem__(self, index):
     "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)
コード例 #2
0
 def __getitem__(self, index):
     "Get the ring at the specified index."
     if 0 <= index < self.geom_count:
         return OGRGeometry(
             capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)
     else:
         raise IndexError(
             "Index out of range when accessing rings of a polygon: %s." %
             index)
コード例 #3
0
 def __getitem__(self, index):
     "Get the Geometry at the specified index."
     if 0 <= index < self.geom_count:
         return OGRGeometry(
             capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)
     else:
         raise IndexError(
             'Index out of range when accessing geometry in a collection: %s.'
             % index)
コード例 #4
0
ファイル: layer.py プロジェクト: 01-/django
 def _get_spatial_filter(self):
     try:
         return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))
     except GDALException:
         return None
コード例 #5
0
 def geom(self):
     "Return the OGR Geometry for this Feature."
     # Retrieving the geometry pointer for the feature.
     geom_ptr = capi.get_feat_geom_ref(self.ptr)
     return OGRGeometry(geom_api.clone_geom(geom_ptr))
コード例 #6
0
 def _get_spatial_filter(self):
     try:
         return OGRGeometry(
             geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))
     except OGRException:
         return None
コード例 #7
0
ファイル: geometries.py プロジェクト: 007lva/mmddpp
 def __getitem__(self, index):
     "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)
コード例 #8
0
ファイル: geometries.py プロジェクト: 007lva/mmddpp
 def clone(self):
     "Clones this OGR Geometry."
     return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
コード例 #9
0
ファイル: geometries.py プロジェクト: huicheese/Django-test3
 def clone(self):
     "Clones this OGR Geometry."
     return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
コード例 #10
0
ファイル: feature.py プロジェクト: ana-balica/django
 def geom(self):
     "Return the OGR Geometry for this Feature."
     # Retrieving the geometry pointer for the feature.
     geom_ptr = capi.get_feat_geom_ref(self.ptr)
     return OGRGeometry(geom_api.clone_geom(geom_ptr))
コード例 #11
0
ファイル: geometries.py プロジェクト: agmond/django
 def __getitem__(self, index):
     "Get the Geometry at the specified index."
     if 0 <= index < self.geom_count:
         return OGRGeometry(capi.clone_geom(capi.get_geom_ref(self.ptr, index)), self.srs)
     else:
         raise IndexError('Index out of range when accessing geometry in a collection: %s.' % index)
コード例 #12
0
from django.contrib.gis.gdal.base import GDALBase
コード例 #13
0
        "Return the EWKT representation of the Geometry."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        srs = self.srs
        if srs and srs.srid:
            return 'SRID=%s;%s' % (srs.srid, self.wkt)
        else:
            return self.wkt

    # #### Geometry Methods ####
    def clone(self):
<<<<<<< HEAD
        "Clones this OGR Geometry."
=======
        "Clone this OGR Geometry."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        return OGRGeometry(capi.clone_geom(self.ptr), self.srs)

    def close_rings(self):
        """
        If there are any rings within this geometry that have not been
        closed, this routine will do so by adding the starting point at the
        end.
        """
        # Closing the open rings.
        capi.geom_close_rings(self.ptr)

    def transform(self, coord_trans, clone=False):
        """
<<<<<<< HEAD
        Transforms this geometry to a different spatial reference system.
        May take a CoordTransform object, a SpatialReference object, string
コード例 #14
0
        "Return a list of fields in the Feature."
        return [
            force_text(
                capi.get_field_name(capi.get_field_defn(self._layer._ldefn, i)),
                self.encoding,
                strings_only=True
            ) for i in range(self.num_fields)
        ]

    @property
    def geom(self):
        "Return the OGR Geometry for this Feature."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        # Retrieving the geometry pointer for the feature.
        geom_ptr = capi.get_feat_geom_ref(self.ptr)
        return OGRGeometry(geom_api.clone_geom(geom_ptr))

    @property
    def geom_type(self):
<<<<<<< HEAD
        "Returns the OGR Geometry Type for this Feture."
=======
        "Return the OGR Geometry Type for this Feture."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        return OGRGeomType(capi.get_fd_geom_type(self._layer._ldefn))

    # #### Feature Methods ####
    def get(self, field):
        """
<<<<<<< HEAD
        Returns the value of the field, instead of an instance of the Field
コード例 #15
0
from ctypes import byref, c_double