Пример #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
Пример #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
Пример #3
0
 def _set_srs(self, srs):
     "Sets the SpatialReference for this geometry."
     if isinstance(srs, SpatialReference):
         srs_ptr = srs_api.clone_srs(srs.ptr)
     elif isinstance(srs, (int, long, basestring)):
         sr = SpatialReference(srs)
         srs_ptr = srs_api.clone_srs(sr.ptr)
     else:
         raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
     capi.assign_srs(self.ptr, srs_ptr)
Пример #4
0
 def _set_srs(self, srs):
     "Sets the SpatialReference for this geometry."
     if isinstance(srs, SpatialReference):
         srs_ptr = srs_api.clone_srs(srs.ptr)
     elif isinstance(srs, (int, long, basestring)):
         sr = SpatialReference(srs)
         srs_ptr = srs_api.clone_srs(sr.ptr)
     else:
         raise TypeError(
             'Cannot assign spatial reference with object of type: %s' %
             type(srs))
     capi.assign_srs(self.ptr, srs_ptr)
Пример #5
0
 def _set_srs(self, srs):
     "Sets the SpatialReference for this geometry."
     # 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):
         srs_ptr = srs.ptr
     elif isinstance(srs, six.integer_types + six.string_types):
         sr = SpatialReference(srs)
         srs_ptr = sr.ptr
     else:
         raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
     capi.assign_srs(self.ptr, srs_ptr)
Пример #6
0
 def _set_srs(self, srs):
     "Sets the SpatialReference for this geometry."
     # 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):
         srs_ptr = srs.ptr
     elif isinstance(srs, six.integer_types + six.string_types):
         sr = SpatialReference(srs)
         srs_ptr = sr.ptr
     else:
         raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
     capi.assign_srs(self.ptr, srs_ptr)
Пример #7
0
        # reference count is incremented, and will likewise be released
        # (decremented) when this geometry's destructor is called.
        if isinstance(srs, SpatialReference):
            srs_ptr = srs.ptr
<<<<<<< HEAD
        elif isinstance(srs, six.integer_types + six.string_types):
=======
        elif isinstance(srs, (int, str)):
>>>>>>> 37c99181c9a6b95433d60f8c8ef9af5731096435
            sr = SpatialReference(srs)
            srs_ptr = sr.ptr
        elif srs is None:
            srs_ptr = None
        else:
            raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
        capi.assign_srs(self.ptr, srs_ptr)

    srs = property(_get_srs, _set_srs)

    # The SRID property
    def _get_srid(self):
        srs = self.srs
        if srs:
            return srs.srid
        return None

    def _set_srid(self, srid):
<<<<<<< HEAD
        if isinstance(srid, six.integer_types) or srid is None:
=======
        if isinstance(srid, int) or srid is None: