Exemplo n.º 1
0
 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 4
0
Arquivo: layer.py Projeto: 01-/django
 def _get_spatial_filter(self):
     try:
         return OGRGeometry(geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))
     except GDALException:
         return None
Exemplo n.º 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))
Exemplo n.º 6
0
 def _get_spatial_filter(self):
     try:
         return OGRGeometry(
             geom_api.clone_geom(capi.get_spatial_filter(self.ptr)))
     except OGRException:
         return None
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def clone(self):
     "Clones this OGR Geometry."
     return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
Exemplo n.º 9
0
 def clone(self):
     "Clones this OGR Geometry."
     return OGRGeometry(capi.clone_geom(self.ptr), self.srs)
Exemplo n.º 10
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))
Exemplo n.º 11
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)
Exemplo n.º 12
0
from django.contrib.gis.gdal.base import GDALBase
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 15
0
from ctypes import byref, c_double