Example #1
0
 def _from_json(geom_input):
     ptr = capi.from_json(geom_input)
     if GDAL_VERSION < (2, 0):
         try:
             capi.get_geom_srs(ptr)
         except SRSException:
             srs = SpatialReference(4326)
             capi.assign_srs(ptr, srs.ptr)
     return ptr
Example #2
0
 def _from_json(geom_input):
     ptr = capi.from_json(geom_input)
     if GDAL_VERSION < (2, 0):
         try:
             capi.get_geom_srs(ptr)
         except SRSException:
             srs = SpatialReference(4326)
             capi.assign_srs(ptr, srs.ptr)
     return ptr
Example #3
0
 def _get_srs(self):
     "Returns the Spatial Reference for this Geometry."
     try:
         srs_ptr = capi.get_geom_srs(self.ptr)
         return SpatialReference(srs_api.clone_srs(srs_ptr))
     except SRSException:
         return None
Example #4
0
 def _get_srs(self):
     "Returns the Spatial Reference for this Geometry."
     try:
         srs_ptr = capi.get_geom_srs(self.ptr)
         return SpatialReference(srs_api.clone_srs(srs_ptr))
     except SRSException:
         return None
Example #5
0
=======
        "Return the envelope as a 4-tuple, instead of as an Envelope object."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        return self.envelope.tuple

    # #### SpatialReference-related Properties ####

    # The SRS property
    def _get_srs(self):
<<<<<<< HEAD
        "Returns the Spatial Reference for this Geometry."
=======
        "Return the Spatial Reference for this Geometry."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        try:
            srs_ptr = capi.get_geom_srs(self.ptr)
            return SpatialReference(srs_api.clone_srs(srs_ptr))
        except SRSException:
            return None

    def _set_srs(self, srs):
<<<<<<< HEAD
        "Sets the SpatialReference for this geometry."
=======
        "Set the SpatialReference for this geometry."
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
        # Do not have to clone the `SpatialReference` object pointer because
        # when it is assigned to this `OGRGeometry` it's internal OGR
        # reference count is incremented, and will likewise be released
        # (decremented) when this geometry's destructor is called.
        if isinstance(srs, SpatialReference):