Package osgeo :: Module ogr |
[hide private]
[frames] | no frames]

# Source Code for Module osgeo.ogr

       1  # This file was automatically generated by SWIG (http://www.swig.org).
       2  # Version 1.3.40
       3  #
       4  # Do not make changes to this file unless you know what you are doing--modify
       5  # the SWIG interface file instead.
       6  # This file is compatible with both classic and new-style classes.
       7
       8  from sys import version_info
       9  if version_info >= (2,6,0):
      10 -    def swig_import_helper():
      11          from os.path import dirname
      12          import imp
      13          fp = None
      14          try:
      15              fp, pathname, description = imp.find_module('_ogr', [dirname(__file__)])
      16          except ImportError:
      17              import _ogr
      18              return _ogr
      19          if fp is not None:
      20              try:
      21                  _mod = imp.load_module('_ogr', fp, pathname, description)
      22              finally:
      23                  fp.close()
      24              return _mod
      25      _ogr = swig_import_helper()
      26      del swig_import_helper
      27  else:
      28      import _ogr
      29  del version_info
      30  try:
      31      _swig_property = property
      32  except NameError:
      33      pass # Python < 2.2 doesn't have 'property'.
      34 -def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
      35      if (name == "thisown"): return self.this.own(value)
      36      if (name == "this"):
      37          if type(value).__name__ == 'SwigPyObject':
      38              self.__dict__[name] = value
      39              return
      40      method = class_type.__swig_setmethods__.get(name,None)
      41      if method: return method(self,value)
      42      if (not static) or hasattr(self,name):
      43          self.__dict__[name] = value
      44      else:
      45          raise AttributeError("You cannot add attributes to %s" % self)
      46
      47 -def _swig_setattr(self,class_type,name,value):
      48      return _swig_setattr_nondynamic(self,class_type,name,value,0)
      49
      50 -def _swig_getattr(self,class_type,name):
      51      if (name == "thisown"): return self.this.own()
      52      method = class_type.__swig_getmethods__.get(name,None)
      53      if method: return method(self)
      54      raise AttributeError(name)
      55
      56 -def _swig_repr(self):
      57      try: strthis = "proxy of " + self.this.__repr__()
      58      except: strthis = ""
      59      return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
      60
      61  try:
      62      _object = object
      63      _newclass = 1
      64  except AttributeError:
      65 -    class _object : pass
      66      _newclass = 0
      67
      68
      69  wkb25DBit = _ogr.wkb25DBit
      70  wkb25Bit = _ogr.wkb25Bit
      71  wkbUnknown = _ogr.wkbUnknown
      72  wkbPoint = _ogr.wkbPoint
      73  wkbLineString = _ogr.wkbLineString
      74  wkbPolygon = _ogr.wkbPolygon
      75  wkbMultiPoint = _ogr.wkbMultiPoint
      76  wkbMultiLineString = _ogr.wkbMultiLineString
      77  wkbMultiPolygon = _ogr.wkbMultiPolygon
      78  wkbGeometryCollection = _ogr.wkbGeometryCollection
      79  wkbNone = _ogr.wkbNone
      80  wkbLinearRing = _ogr.wkbLinearRing
      81  wkbPoint25D = _ogr.wkbPoint25D
      82  wkbLineString25D = _ogr.wkbLineString25D
      83  wkbPolygon25D = _ogr.wkbPolygon25D
      84  wkbMultiPoint25D = _ogr.wkbMultiPoint25D
      85  wkbMultiLineString25D = _ogr.wkbMultiLineString25D
      86  wkbMultiPolygon25D = _ogr.wkbMultiPolygon25D
      87  wkbGeometryCollection25D = _ogr.wkbGeometryCollection25D
      88  OFTInteger = _ogr.OFTInteger
      89  OFTIntegerList = _ogr.OFTIntegerList
      90  OFTReal = _ogr.OFTReal
      91  OFTRealList = _ogr.OFTRealList
      92  OFTString = _ogr.OFTString
      93  OFTStringList = _ogr.OFTStringList
      94  OFTWideString = _ogr.OFTWideString
      95  OFTWideStringList = _ogr.OFTWideStringList
      96  OFTBinary = _ogr.OFTBinary
      97  OFTDate = _ogr.OFTDate
      98  OFTTime = _ogr.OFTTime
      99  OFTDateTime = _ogr.OFTDateTime
     100  OJUndefined = _ogr.OJUndefined
     101  OJLeft = _ogr.OJLeft
     102  OJRight = _ogr.OJRight
     103  wkbXDR = _ogr.wkbXDR
     104  wkbNDR = _ogr.wkbNDR
     105  NullFID = _ogr.NullFID
     106  ALTER_NAME_FLAG = _ogr.ALTER_NAME_FLAG
     107  ALTER_TYPE_FLAG = _ogr.ALTER_TYPE_FLAG
     108  ALTER_WIDTH_PRECISION_FLAG = _ogr.ALTER_WIDTH_PRECISION_FLAG
     109  ALTER_ALL_FLAG = _ogr.ALTER_ALL_FLAG
     110  OLCRandomRead = _ogr.OLCRandomRead
     111  OLCSequentialWrite = _ogr.OLCSequentialWrite
     112  OLCRandomWrite = _ogr.OLCRandomWrite
     113  OLCFastSpatialFilter = _ogr.OLCFastSpatialFilter
     114  OLCFastFeatureCount = _ogr.OLCFastFeatureCount
     115  OLCFastGetExtent = _ogr.OLCFastGetExtent
     116  OLCCreateField = _ogr.OLCCreateField
     117  OLCDeleteField = _ogr.OLCDeleteField
     118  OLCReorderFields = _ogr.OLCReorderFields
     119  OLCAlterFieldDefn = _ogr.OLCAlterFieldDefn
     120  OLCTransactions = _ogr.OLCTransactions
     121  OLCDeleteFeature = _ogr.OLCDeleteFeature
     122  OLCFastSetNextByIndex = _ogr.OLCFastSetNextByIndex
     123  OLCStringsAsUTF8 = _ogr.OLCStringsAsUTF8
     124  OLCIgnoreFields = _ogr.OLCIgnoreFields
     125  ODsCCreateLayer = _ogr.ODsCCreateLayer
     126  ODsCDeleteLayer = _ogr.ODsCDeleteLayer
     127  ODrCCreateDataSource = _ogr.ODrCCreateDataSource
     128  ODrCDeleteDataSource = _ogr.ODrCDeleteDataSource
     129
     130 -def GetUseExceptions(*args):
     131    """GetUseExceptions() -> int"""
     132    return _ogr.GetUseExceptions(*args)
     133
     134 -def UseExceptions(*args):
     135    """UseExceptions()"""
     136    return _ogr.UseExceptions(*args)
     137
     138 -def DontUseExceptions(*args):
     139    """DontUseExceptions()"""
     140    return _ogr.DontUseExceptions(*args)
     141  import osr
     142 -class Driver(_object):
     143      """Proxy of C++ OGRDriverShadow class"""
     144      __swig_setmethods__ = {}
     145      __setattr__ = lambda self, name, value: _swig_setattr(self, Driver, name, value)
     146      __swig_getmethods__ = {}
     147      __getattr__ = lambda self, name: _swig_getattr(self, Driver, name)
     148 -    def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
     149      __repr__ = _swig_repr
     150      __swig_getmethods__["name"] = _ogr.Driver_name_get
     151      if _newclass:name = _swig_property(_ogr.Driver_name_get)
     152 -    def CreateDataSource(self, *args, **kwargs):
     153          """
     154          CreateDataSource(self, char utf8_path, char options = None) -> DataSource
     155
     156          OGRDataSourceH
     157          OGR_Dr_CreateDataSource(OGRSFDriverH hDriver, const char *pszName,
     158          char **papszOptions)
     159
     160          This function attempts to create a new data source based on the passed
     161          driver.
     162
     163          The papszOptions argument can be used to control driver specific
     164          creation options. These options are normally documented in the format
     165          specific documentation.
     166
     167          It is important to call OGR_DS_Destroy() when the datasource is no
     168          longer used to ensure that all data has been properly flushed to disk.
     169
     170          This function is the same as the C++ method
     171          OGRSFDriver::CreateDataSource().
     172
     173          Parameters:
     174          -----------
     175
     176          hDriver:  handle to the driver on which data source creation is based.
     177
     178          pszName:  the name for the new data source. UTF-8 encoded.
     179
     180          papszOptions:  a StringList of name=value options. Options are driver
     181          specific, and driver information can be found at the following
     182          url:http://www.gdal.org/ogr/ogr_formats.html
     183
     184          NULL is returned on failure, or a new OGRDataSource handle on success.
     185
     186          """
     187          return _ogr.Driver_CreateDataSource(self, *args, **kwargs)
     188
     189 -    def CopyDataSource(self, *args, **kwargs):
     190          """
     191          CopyDataSource(self, DataSource copy_ds, char utf8_path, char options = None) -> DataSource
     192
     193          OGRDataSourceH
     194          OGR_Dr_CopyDataSource(OGRSFDriverH hDriver, OGRDataSourceH hSrcDS,
     195          const char *pszNewName, char **papszOptions)
     196
     197          This function creates a new datasource by copying all the layers from
     198          the source datasource.
     199
     200          It is important to call OGR_DS_Destroy() when the datasource is no
     201          longer used to ensure that all data has been properly flushed to disk.
     202
     203          This function is the same as the C++ method
     204          OGRSFDriver::CopyDataSource().
     205
     206          Parameters:
     207          -----------
     208
     209          hDriver:  handle to the driver on which data source creation is based.
     210
     211          hSrcDS:  source datasource
     212
     213          pszNewName:  the name for the new data source.
     214
     215          papszOptions:  a StringList of name=value options. Options are driver
     216          specific, and driver information can be found at the following
     217          url:http://www.gdal.org/ogr/ogr_formats.html
     218
     219          NULL is returned on failure, or a new OGRDataSource handle on success.
     220
     221          """
     222          return _ogr.Driver_CopyDataSource(self, *args, **kwargs)
     223
     224 -    def Open(self, *args, **kwargs):
     225          """
     226          Open(self, char utf8_path, int update = 0) -> DataSource
     227
     228          OGRDataSourceH OGR_Dr_Open(OGRSFDriverH
     229          hDriver, const char *pszName, int bUpdate)
     230
     231          Attempt to open file with this driver.
     232
     233          This function is the same as the C++ method OGRSFDriver::Open().
     234
     235          Parameters:
     236          -----------
     237
     238          hDriver:  handle to the driver that is used to open file.
     239
     240          pszName:  the name of the file, or data source to try and open.
     241
     242          bUpdate:  TRUE if update access is required, otherwise FALSE (the
     243          default).
     244
     245          NULL on error or if the pass name is not supported by this driver,
     246          otherwise an handle to an OGRDataSource. This OGRDataSource should be
     247          closed by deleting the object when it is no longer needed.
     248          """
     249          return _ogr.Driver_Open(self, *args, **kwargs)
     250
     251 -    def DeleteDataSource(self, *args):
     252          """
     253          DeleteDataSource(self, char utf8_path) -> int
     254
     255          OGRErr
     256          OGR_Dr_DeleteDataSource(OGRSFDriverH hDriver, const char
     257          *pszDataSource)
     258
     259          Delete a datasource.
     260
     261          Delete (from the disk, in the database, ...) the named datasource.
     262          Normally it would be safest if the datasource was not open at the
     263          time.
     264
     265          Whether this is a supported operation on this driver case be tested
     266          using TestCapability() on ODrCDeleteDataSource.
     267
     268          This method is the same as the C++ method
     269          OGRSFDriver::DeleteDataSource().
     270
     271          Parameters:
     272          -----------
     273
     274          hDriver:  handle to the driver on which data source deletion is based.
     275
     276          pszDataSource:  the name of the datasource to delete.
     277
     278          OGRERR_NONE on success, and OGRERR_UNSUPPORTED_OPERATION if this is
     279          not supported by this driver.
     280          """
     281          return _ogr.Driver_DeleteDataSource(self, *args)
     282
     283 -    def TestCapability(self, *args):
     284          """
     285          TestCapability(self, char cap) -> bool
     286
     287          int
     288          OGR_Dr_TestCapability(OGRSFDriverH hDriver, const char *pszCap)
     289
     290          Test if capability is available.
     291
     292          One of the following data source capability names can be passed into
     293          this function, and a TRUE or FALSE value will be returned indicating
     294          whether or not the capability is available for this object.
     295
     296          ODrCCreateDataSource: True if this driver can support creating data
     297          sources.
     298
     299          ODrCDeleteDataSource: True if this driver supports deleting data
     300          sources.
     301
     302          The #define macro forms of the capability names should be used in
     303          preference to the strings themselves to avoid mispelling.
     304
     305          This function is the same as the C++ method
     306          OGRSFDriver::TestCapability().
     307
     308          Parameters:
     309          -----------
     310
     311          hDriver:  handle to the driver to test the capability against.
     312
     313          pszCap:  the capability to test.
     314
     315          TRUE if capability available otherwise FALSE.
     316          """
     317          return _ogr.Driver_TestCapability(self, *args)
     318
     319 -    def GetName(self, *args):
     320          """
     321          GetName(self) -> char
     322
     323          const char*
     324          OGR_Dr_GetName(OGRSFDriverH hDriver)
     325
     326          Fetch name of driver (file format). This name should be relatively
     327          short (10-40 characters), and should reflect the underlying file
     328          format. For instance "ESRI Shapefile".
     329
     330          This function is the same as the C++ method OGRSFDriver::GetName().
     331
     332          Parameters:
     333          -----------
     334
     335          hDriver:  handle to the the driver to get the name from.
     336
     337          driver name. This is an internal string and should not be modified or
     338          freed.
     339          """
     340          return _ogr.Driver_GetName(self, *args)
     341
     342 -    def Register(self, *args):
     343          """Register(self)"""
     344          return _ogr.Driver_Register(self, *args)
     345
     346 -    def Deregister(self, *args):
     347          """Deregister(self)"""
     348          return _ogr.Driver_Deregister(self, *args)
     349
     350  Driver_swigregister = _ogr.Driver_swigregister
     351  Driver_swigregister(Driver)
     352
     353 -class DataSource(_object):
     354      """Proxy of C++ OGRDataSourceShadow class"""
     355      __swig_setmethods__ = {}
     356      __setattr__ = lambda self, name, value: _swig_setattr(self, DataSource, name, value)
     357      __swig_getmethods__ = {}
     358      __getattr__ = lambda self, name: _swig_getattr(self, DataSource, name)
     359 -    def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
     360      __repr__ = _swig_repr
     361      __swig_getmethods__["name"] = _ogr.DataSource_name_get
     362      if _newclass:name = _swig_property(_ogr.DataSource_name_get)
     363      __swig_destroy__ = _ogr.delete_DataSource
     364      __del__ = lambda self : None;
     365 -    def GetRefCount(self, *args):
     366          """
     367          GetRefCount(self) -> int
     368
     369          int
     370          OGR_DS_GetRefCount(OGRDataSourceH hDataSource)
     371          """
     372          return _ogr.DataSource_GetRefCount(self, *args)
     373
     374 -    def GetSummaryRefCount(self, *args):
     375          """
     376          GetSummaryRefCount(self) -> int
     377
     378          int
     379          OGR_DS_GetSummaryRefCount(OGRDataSourceH hDataSource)
     380          """
     381          return _ogr.DataSource_GetSummaryRefCount(self, *args)
     382
     383 -    def GetLayerCount(self, *args):
     384          """
     385          GetLayerCount(self) -> int
     386
     387          int
     388          OGR_DS_GetLayerCount(OGRDataSourceH hDS)
     389
     390          Get the number of layers in this data source.
     391
     392          This function is the same as the C++ method
     393          OGRDataSource::GetLayerCount().
     394
     395          Parameters:
     396          -----------
     397
     398          hDS:  handle to the data source from which to get the number of
     399          layers.
     400
     401          layer count.
     402          """
     403          return _ogr.DataSource_GetLayerCount(self, *args)
     404
     405 -    def GetDriver(self, *args):
     406          """
     407          GetDriver(self) -> Driver
     408
     409          OGRSFDriverH
     410          OGR_DS_GetDriver(OGRDataSourceH hDS)
     411
     412          Returns the driver that the dataset was opened with.
     413
     414          This method is the same as the C++ method OGRDataSource::GetDriver()
     415
     416          Parameters:
     417          -----------
     418
     419          hDS:  handle to the datasource
     420
     421          NULL if driver info is not available, or pointer to a driver owned by
     422          the OGRSFDriverManager.
     423          """
     424          return _ogr.DataSource_GetDriver(self, *args)
     425
     426 -    def GetName(self, *args):
     427          """
     428          GetName(self) -> char
     429
     430          const char*
     431          OGR_DS_GetName(OGRDataSourceH hDS)
     432
     433          Returns the name of the data source.
     434
     435          This string should be sufficient to open the data source if passed to
     436          the same OGRSFDriver that this data source was opened with, but it
     437          need not be exactly the same string that was used to open the data
     438          source. Normally this is a filename.
     439
     440          This function is the same as the C++ method OGRDataSource::GetName().
     441
     442          Parameters:
     443          -----------
     444
     445          hDS:  handle to the data source to get the name from.
     446
     447          pointer to an internal name string which should not be modified or
     448          freed by the caller.
     449          """
     450          return _ogr.DataSource_GetName(self, *args)
     451
     452 -    def DeleteLayer(self, *args):
     453          """
     454          DeleteLayer(self, int index) -> OGRErr
     455
     456          OGRErr
     457          OGR_DS_DeleteLayer(OGRDataSourceH hDS, int iLayer)
     458
     459          Delete the indicated layer from the datasource.
     460
     461          If this method is supported the ODsCDeleteLayer capability will test
     462          TRUE on the OGRDataSource.
     463
     464          This method is the same as the C++ method
     465          OGRDataSource::DeleteLayer().
     466
     467          Parameters:
     468          -----------
     469
     470          hDS:  handle to the datasource
     471
     472          iLayer:  the index of the layer to delete.
     473
     474          OGRERR_NONE on success, or OGRERR_UNSUPPORTED_OPERATION if deleting
     475          layers is not supported for this datasource.
     476          """
     477          return _ogr.DataSource_DeleteLayer(self, *args)
     478
     479 -    def SyncToDisk(self, *args):
     480          """
     481          SyncToDisk(self) -> OGRErr
     482
     483          OGRErr
     484          OGR_DS_SyncToDisk(OGRDataSourceH hDS)
     485
     486          Flush pending changes to disk.
     487
     488          This call is intended to force the datasource to flush any pending
     489          writes to disk, and leave the disk file in a consistent state. It
     490          would not normally have any effect on read-only datasources.
     491
     492          Some data sources do not implement this method, and will still return
     493          OGRERR_NONE. An error is only returned if an error occurs while
     494          attempting to flush to disk.
     495
     496          The default implementation of this method just calls the SyncToDisk()
     497          method on each of the layers. Conceptionally, calling SyncToDisk() on
     498          a datasource should include any work that might be accomplished by
     499          calling SyncToDisk() on layers in that data source.
     500
     501          In any event, you should always close any opened datasource with
     502          OGR_DS_Destroy() that will ensure all data is correctly flushed.
     503
     504          This method is the same as the C++ method OGRDataSource::SyncToDisk()
     505
     506          Parameters:
     507          -----------
     508
     509          hDS:  handle to the data source
     510
     511          OGRERR_NONE if no error occurs (even if nothing is done) or an error
     512          code.
     513          """
     514          return _ogr.DataSource_SyncToDisk(self, *args)
     515
     516 -    def CreateLayer(self, *args, **kwargs):
     517          """
     518          CreateLayer(self, char name, SpatialReference srs = None, OGRwkbGeometryType geom_type = wkbUnknown,
     519              char options = None) -> Layer
     520
     521          OGRLayerH
     522          OGR_DS_CreateLayer(OGRDataSourceH hDS, const char *pszName,
     523          OGRSpatialReferenceH hSpatialRef, OGRwkbGeometryType eType, char
     524          **papszOptions)
     525
     526          This function attempts to create a new layer on the data source with
     527          the indicated name, coordinate system, geometry type.
     528
     529          The papszOptions argument can be used to control driver specific
     530          creation options. These options are normally documented in the format
     531          specific documentation.
     532
     533          This function is the same as the C++ method
     534          OGRDataSource::CreateLayer().
     535
     536          Parameters:
     537          -----------
     538
     539          hDS:  The dataset handle.
     540
     541          pszName:  the name for the new layer. This should ideally not match
     542          any existing layer on the datasource.
     543
     544          hSpatialRef:  handle to the coordinate system to use for the new
     545          layer, or NULL if no coordinate system is available.
     546
     547          eType:  the geometry type for the layer. Use wkbUnknown if there are
     548          no constraints on the types geometry to be written.
     549
     550          papszOptions:  a StringList of name=value options. Options are driver
     551          specific, and driver information can be found at the following
     552          url:http://www.gdal.org/ogr/ogr_formats.html
     553
     554          NULL is returned on failure, or a new OGRLayer handle on success.
     555          Example:
     556          """
     557          return _ogr.DataSource_CreateLayer(self, *args, **kwargs)
     558
     559 -    def CopyLayer(self, *args, **kwargs):
     560          """
     561          CopyLayer(self, Layer src_layer, char new_name, char options = None) -> Layer
     562
     563          OGRLayerH
     564          OGR_DS_CopyLayer(OGRDataSourceH hDS, OGRLayerH hSrcLayer, const char
     565          *pszNewName, char **papszOptions)
     566
     567          Duplicate an existing layer.
     568
     569          This function creates a new layer, duplicate the field definitions of
     570          the source layer and then duplicate each features of the source layer.
     571          The papszOptions argument can be used to control driver specific
     572          creation options. These options are normally documented in the format
     573          specific documentation. The source layer may come from another
     574          dataset.
     575
     576          This function is the same as the C++ method OGRDataSource::CopyLayer
     577
     578          Parameters:
     579          -----------
     580
     581          hDS:  handle to the data source where to create the new layer
     582
     583          hSrcLayer:  handle to the source layer.
     584
     585          pszNewName:  the name of the layer to create.
     586
     587          papszOptions:  a StringList of name=value options. Options are driver
     588          specific.
     589
     590          an handle to the layer, or NULL if an error occurs.
     591          """
     592          return _ogr.DataSource_CopyLayer(self, *args, **kwargs)
     593
     594 -    def GetLayerByIndex(self, *args):
     595          """GetLayerByIndex(self, int index = 0) -> Layer"""
     596          return _ogr.DataSource_GetLayerByIndex(self, *args)
     597
     598 -    def GetLayerByName(self, *args):
     599          """
     600          GetLayerByName(self, char layer_name) -> Layer
     601
     602          OGRLayerH
     603          OGR_DS_GetLayerByName(OGRDataSourceH hDS, const char *pszName)
     604
     605          Fetch a layer by name.
     606
     607          The returned layer remains owned by the OGRDataSource and should not
     608          be deleted by the application.
     609
     610          This function is the same as the C++ method
     611          OGRDataSource::GetLayerByName().
     612
     613          Parameters:
     614          -----------
     615
     616          hDS:  handle to the data source from which to get the layer.
     617
     618          pszLayerName:  Layer the layer name of the layer to fetch.
     619
     620          an handle to the layer, or NULL if the layer is not found or an error
     621          occurs.
     622          """
     623          return _ogr.DataSource_GetLayerByName(self, *args)
     624
     625 -    def TestCapability(self, *args):
     626          """
     627          TestCapability(self, char cap) -> bool
     628
     629          int
     630          OGR_DS_TestCapability(OGRDataSourceH hDS, const char *pszCap)
     631
     632          Test if capability is available.
     633
     634          One of the following data source capability names can be passed into
     635          this function, and a TRUE or FALSE value will be returned indicating
     636          whether or not the capability is available for this object.
     637
     638          ODsCCreateLayer: True if this datasource can create new layers.
     639
     640          The #define macro forms of the capability names should be used in
     641          preference to the strings themselves to avoid mispelling.
     642
     643          This function is the same as the C++ method
     644          OGRDataSource::TestCapability().
     645
     646          Parameters:
     647          -----------
     648
     649          hDS:  handle to the data source against which to test the capability.
     650
     651          pszCapability:  the capability to test.
     652
     653          TRUE if capability available otherwise FALSE.
     654          """
     655          return _ogr.DataSource_TestCapability(self, *args)
     656
     657 -    def ExecuteSQL(self, *args, **kwargs):
     658          """
     659          ExecuteSQL(self, char statement, Geometry spatialFilter = None, char dialect = "") -> Layer
     660
     661          OGRLayerH
     662          OGR_DS_ExecuteSQL(OGRDataSourceH hDS, const char *pszStatement,
     663          OGRGeometryH hSpatialFilter, const char *pszDialect)
     664
     665          Execute an SQL statement against the data store.
     666
     667          The result of an SQL query is either NULL for statements that are in
     668          error, or that have no results set, or an OGRLayer handle representing
     669          a results set from the query. Note that this OGRLayer is in addition
     670          to the layers in the data store and must be destroyed with
     671          OGR_DS_ReleaseResultSet() before the data source is closed
     672          (destroyed).
     673
     674          For more information on the SQL dialect supported internally by OGR
     675          review theOGR SQL document. Some drivers (ie. Oracle and PostGIS) pass
     676          the SQL directly through to the underlying RDBMS.
     677
     678          This function is the same as the C++ method
     679          OGRDataSource::ExecuteSQL();
     680
     681          Parameters:
     682          -----------
     683
     684          hDS:  handle to the data source on which the SQL query is executed.
     685
     686          pszSQLCommand:  the SQL statement to execute.
     687
     688          hSpatialFilter:  handle to a geometry which represents a spatial
     689          filter. Can be NULL.
     690
     691          pszDialect:  allows control of the statement dialect. If set to NULL,
     692          the OGR SQL engine will be used, except for RDBMS drivers that will
     693          use their dedicated SQL engine, unless OGRSQL is explicitely passed as
     694          the dialect.
     695
     696          an handle to a OGRLayer containing the results of the query.
     697          Deallocate with OGR_DS_ReleaseResultSet().
     698          """
     699          return _ogr.DataSource_ExecuteSQL(self, *args, **kwargs)
     700
     701 -    def ReleaseResultSet(self, *args):
     702          """
     703          ReleaseResultSet(self, Layer layer)
     704
     705          void
     706          OGR_DS_ReleaseResultSet(OGRDataSourceH hDS, OGRLayerH hLayer)
     707
     708          Release results of OGR_DS_ExecuteSQL().
     709
     710          This function should only be used to deallocate OGRLayers resulting
     711          from an OGR_DS_ExecuteSQL() call on the same OGRDataSource. Failure to
     712          deallocate a results set before destroying the OGRDataSource may cause
     713          errors.
     714
     715          This function is the same as the C++ method
     716          OGRDataSource::ReleaseResultSet().
     717
     718          Parameters:
     719          -----------
     720
     721          hDS:  an handle to the data source on which was executed an SQL query.
     722
     723          hLayer:  handle to the result of a previous OGR_DS_ExecuteSQL() call.
     724
     725          """
     726          return _ogr.DataSource_ReleaseResultSet(self, *args)
     727
     728 -    def Destroy(self):
     729        "Once called, self has effectively been destroyed.  Do not access. For backwards compatiblity only"
     730        _ogr.delete_DataSource( self )
     731        self.thisown = 0
     732
     733 -    def Release(self):
     734        "Once called, self has effectively been destroyed.  Do not access. For backwards compatiblity only"
     735        _ogr.delete_DataSource( self )
     736        self.thisown = 0
     737
     738 -    def Reference(self):
     739        "For backwards compatibility only."
     740        return self.Reference()
     741
     742 -    def Dereference(self):
     743        "For backwards compatibility only."
     744        self.Dereference()
     745
     746 -    def __len__(self):
     747          """Returns the number of layers on the datasource"""
     748          return self.GetLayerCount()
     749
     750 -    def __getitem__(self, value):
     751          """Support dictionary, list, and slice -like access to the datasource.
     752      ] would return the first layer on the datasource.
     753      aname'] would return the layer named "aname".
     754      :4] would return a list of the first four layers."""
     755          import types
     756          if isinstance(value, slice):
     757              output = []
     758              for i in xrange(value.start,value.stop,value.step):
     759                  try:
     760                      output.append(self.GetLayer(i))
     761                  except OGRError: #we're done because we're off the end
     762                      return output
     763              return output
     764          if isinstance(value, int):
     765              if value > len(self)-1:
     766                  raise IndexError
     767              return self.GetLayer(value)
     768          elif isinstance(value, str):
     769              return self.GetLayer(value)
     770          else:
     771              raise TypeError('Input %s is not of String or Int type' % type(value))
     772
     773 -    def GetLayer(self,iLayer=0):
     774          """Return the layer given an index or a name"""
     775          import types
     776          if isinstance(iLayer, str):
     777              return self.GetLayerByName(str(iLayer))
     778          elif isinstance(iLayer, int):
     779              return self.GetLayerByIndex(iLayer)
     780          else:
     781              raise TypeError("Input %s is not of String or Int type" % type(iLayer))
     782
     783 -    def DeleteLayer(self, value):
     784          """Deletes the layer given an index or layer name"""
     785          import types
     786          if isinstance(value, str):
     787              for i in range(self.GetLayerCount()):
     788                  name = self.GetLayer(i).GetName()
     789                  if name == value:
     790                      return _ogr.DataSource_DeleteLayer(self, i)
     791              raise ValueError("Layer %s not found to delete" % value)
     792          elif isinstance(value, int):
     793              return _ogr.DataSource_DeleteLayer(self, value)
     794          else:
     795              raise TypeError("Input %s is not of String or Int type" % type(iLayer))
     796
     797  DataSource_swigregister = _ogr.DataSource_swigregister
     798  DataSource_swigregister(DataSource)
     799
     800 -class Layer(_object):
     801      """Proxy of C++ OGRLayerShadow class"""
     802      __swig_setmethods__ = {}
     803      __setattr__ = lambda self, name, value: _swig_setattr(self, Layer, name, value)
     804      __swig_getmethods__ = {}
     805      __getattr__ = lambda self, name: _swig_getattr(self, Layer, name)
     806 -    def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
     807      __repr__ = _swig_repr
     808 -    def GetRefCount(self, *args):
     809          """
     810          GetRefCount(self) -> int
     811
     812          int OGR_L_GetRefCount(OGRLayerH
     813          hLayer)
     814          """
     815          return _ogr.Layer_GetRefCount(self, *args)
     816
     817 -    def SetSpatialFilter(self, *args):
     818          """
     819          SetSpatialFilter(self, Geometry filter)
     820
     821          void
     822          OGR_L_SetSpatialFilter(OGRLayerH hLayer, OGRGeometryH hGeom)
     823
     824          Set a new spatial filter.
     825
     826          This function set the geometry to be used as a spatial filter when
     827          fetching features via the OGR_L_GetNextFeature() function. Only
     828          features that geometrically intersect the filter geometry will be
     829          returned.
     830
     831          Currently this test is may be inaccurately implemented, but it is
     832          guaranteed that all features who's envelope (as returned by
     833          OGR_G_GetEnvelope()) overlaps the envelope of the spatial filter will
     834          be returned. This can result in more shapes being returned that should
     835          strictly be the case.
     836
     837          This function makes an internal copy of the passed geometry. The
     838          passed geometry remains the responsibility of the caller, and may be
     839          safely destroyed.
     840
     841          For the time being the passed filter geometry should be in the same
     842          SRS as the layer (as returned by OGR_L_GetSpatialRef()). In the future
     843          this may be generalized.
     844
     845          This function is the same as the C++ method
     846          OGRLayer::SetSpatialFilter.
     847
     848          Parameters:
     849          -----------
     850
     851          hLayer:  handle to the layer on which to set the spatial filter.
     852
     853          hGeom:  handle to the geometry to use as a filtering region. NULL may
     854          be passed indicating that the current spatial filter should be
     855          cleared, but no new one instituted.
     856          """
     857          return _ogr.Layer_SetSpatialFilter(self, *args)
     858
     859 -    def SetSpatialFilterRect(self, *args):
     860          """
     861          SetSpatialFilterRect(self, double minx, double miny, double maxx, double maxy)
     862
     863          void
     864          OGR_L_SetSpatialFilterRect(OGRLayerH hLayer, double dfMinX, double
     865          dfMinY, double dfMaxX, double dfMaxY)
     866
     867          Set a new rectangular spatial filter.
     868
     869          This method set rectangle to be used as a spatial filter when fetching
     870          features via the OGR_L_GetNextFeature() method. Only features that
     871          geometrically intersect the given rectangle will be returned.
     872
     873          The x/y values should be in the same coordinate system as the layer as
     874          a whole (as returned by OGRLayer::GetSpatialRef()). Internally this
     875          method is normally implemented as creating a 5 vertex closed
     876          rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It
     877          exists as a convenience.
     878
     879          The only way to clear a spatial filter set with this method is to call
     880          OGRLayer::SetSpatialFilter(NULL).
     881
     882          This method is the same as the C++ method
     883          OGRLayer::SetSpatialFilterRect().
     884
     885          Parameters:
     886          -----------
     887
     888          hLayer:  handle to the layer on which to set the spatial filter.
     889
     890          dfMinX:  the minimum X coordinate for the rectangular region.
     891
     892          dfMinY:  the minimum Y coordinate for the rectangular region.
     893
     894          dfMaxX:  the maximum X coordinate for the rectangular region.
     895
     896          dfMaxY:  the maximum Y coordinate for the rectangular region.
     897          """
     898          return _ogr.Layer_SetSpatialFilterRect(self, *args)
     899
     900 -    def GetSpatialFilter(self, *args):
     901          """
     902          GetSpatialFilter(self) -> Geometry
     903
     904          OGRGeometryH
     905          OGR_L_GetSpatialFilter(OGRLayerH hLayer)
     906
     907          This function returns the current spatial filter for this layer.
     908
     909          The returned pointer is to an internally owned object, and should not
     910          be altered or deleted by the caller.
     911
     912          This function is the same as the C++ method
     913          OGRLayer::GetSpatialFilter().
     914
     915          Parameters:
     916          -----------
     917
     918          hLayer:  handle to the layer to get the spatial filter from.
     919
     920          an handle to the spatial filter geometry.
     921          """
     922          return _ogr.Layer_GetSpatialFilter(self, *args)
     923
     924 -    def SetAttributeFilter(self, *args):
     925          """
     926          SetAttributeFilter(self, char filter_string) -> OGRErr
     927
     928          OGRErr
     929          OGR_L_SetAttributeFilter(OGRLayerH hLayer, const char *pszQuery)
     930
     931          Set a new attribute query.
     932
     933          This function sets the attribute query string to be used when fetching
     934          features via the OGR_L_GetNextFeature() function. Only features for
     935          which the query evaluates as true will be returned.
     936
     937          The query string should be in the format of an SQL WHERE clause. For
     938          instance "population > 1000000 and population < 5000000" where
     939          population is an attribute in the layer. The query format is a
     940          restricted form of SQL WHERE clause as defined
     941          "eq_format=restricted_where" about half way through this document:
     942
     943          http://ogdi.sourceforge.net/prop/6.2.CapabilitiesMetadata.html
     944
     945          Note that installing a query string will generally result in resetting
     946          the current reading position (ala OGR_L_ResetReading()).
     947
     948          This function is the same as the C++ method
     949          OGRLayer::SetAttributeFilter().
     950
     951          Parameters:
     952          -----------
     953
     954          hLayer:  handle to the layer on which attribute query will be
     955          executed.
     956
     957          pszQuery:  query in restricted SQL WHERE format, or NULL to clear the
     958          current query.
     959
     960          OGRERR_NONE if successfully installed, or an error code if the query
     961          expression is in error, or some other failure occurs.
     962          """
     963          return _ogr.Layer_SetAttributeFilter(self, *args)
     964
     965 -    def ResetReading(self, *args):
     966          """
     967          ResetReading(self)
     968
     969          void
     970          OGR_L_ResetReading(OGRLayerH hLayer)
     971
     972          Reset feature reading to start on the first feature.
     973
     974          This affects GetNextFeature().
     975
     976          This function is the same as the C++ method OGRLayer::ResetReading().
     977
     978          Parameters:
     979          -----------
     980
     981          hLayer:  handle to the layer on which features are read.
     982          """
     983          return _ogr.Layer_ResetReading(self, *args)
     984
     985 -    def GetName(self, *args):
     986          """
     987          GetName(self) -> char
     988
     989          const char* OGR_L_GetName(OGRLayerH
     990          hLayer)
     991
     992          Return the layer name.
     993
     994          This returns the same content as
     995          OGR_FD_GetName(OGR_L_GetLayerDefn(hLayer)), but for a few drivers,
     996          calling OGR_L_GetName() directly can avoid lengthy layer definition
     997          initialization.
     998
     999          This function is the same as the C++ method OGRLayer::GetName().
    1000
    1001          Parameters:
    1002          -----------
    1003
    1004          hLayer:  handle to the layer.
    1005
    1006          the layer name (must not been freed)
    1007
    1008          OGR 1.8.0
    1009          """
    1010          return _ogr.Layer_GetName(self, *args)
    1011
    1012 -    def GetGeomType(self, *args):
    1013          """
    1014          GetGeomType(self) -> OGRwkbGeometryType
    1015
    1016          OGRwkbGeometryType
    1017          OGR_L_GetGeomType(OGRLayerH hLayer)
    1018
    1019          Return the layer geometry type.
    1020
    1021          This returns the same result as
    1022          OGR_FD_GetGeomType(OGR_L_GetLayerDefn(hLayer)), but for a few drivers,
    1023          calling OGR_L_GetGeomType() directly can avoid lengthy layer
    1024          definition initialization.
    1025
    1026          This function is the same as the C++ method OGRLayer::GetGeomType().
    1027
    1028          Parameters:
    1029          -----------
    1030
    1031          hLayer:  handle to the layer.
    1032
    1033          the geometry type
    1034
    1035          OGR 1.8.0
    1036          """
    1037          return _ogr.Layer_GetGeomType(self, *args)
    1038
    1039 -    def GetGeometryColumn(self, *args):
    1040          """
    1041          GetGeometryColumn(self) -> char
    1042
    1043          const char*
    1044          OGR_L_GetGeometryColumn(OGRLayerH hLayer)
    1045
    1046          This method returns the name of the underlying database column being
    1047          used as the geometry column, or "" if not supported.
    1048
    1049          This method is the same as the C++ method
    1050          OGRLayer::GetGeometryColumn()
    1051
    1052          Parameters:
    1053          -----------
    1054
    1055          hLayer:  handle to the layer
    1056
    1057          geometry column name.
    1058          """
    1059          return _ogr.Layer_GetGeometryColumn(self, *args)
    1060
    1061 -    def GetFIDColumn(self, *args):
    1062          """
    1063          GetFIDColumn(self) -> char
    1064
    1065          const char*
    1066          OGR_L_GetFIDColumn(OGRLayerH hLayer)
    1067
    1068          This method returns the name of the underlying database column being
    1069          used as the FID column, or "" if not supported.
    1070
    1071          This method is the same as the C++ method OGRLayer::GetFIDColumn()
    1072
    1073          Parameters:
    1074          -----------
    1075
    1076          hLayer:  handle to the layer
    1077
    1078          fid column name.
    1079          """
    1080          return _ogr.Layer_GetFIDColumn(self, *args)
    1081
    1082 -    def GetFeature(self, *args):
    1083          """
    1084          GetFeature(self, long fid) -> Feature
    1085
    1086          OGRFeatureH
    1087          OGR_L_GetFeature(OGRLayerH hLayer, long nFeatureId)
    1088
    1089          Fetch a feature by its identifier.
    1090
    1091          This function will attempt to read the identified feature. The nFID
    1092          value cannot be OGRNullFID. Success or failure of this operation is
    1093          unaffected by the spatial or attribute filters.
    1094
    1095          If this function returns a non-NULL feature, it is guaranteed that its
    1096          feature id ( OGR_F_GetFID()) will be the same as nFID.
    1097
    1098          Use OGR_L_TestCapability(OLCRandomRead) to establish if this layer
    1099          supports efficient random access reading via OGR_L_GetFeature();
    1100          however, the call should always work if the feature exists as a
    1101          fallback implementation just scans all the features in the layer
    1102          looking for the desired feature.
    1103
    1104          Sequential reads are generally considered interrupted by a
    1105          OGR_L_GetFeature() call.
    1106
    1107          The returned feature should be free with OGR_F_Destroy().
    1108
    1109          This function is the same as the C++ method OGRLayer::GetFeature( ).
    1110
    1111          Parameters:
    1112          -----------
    1113
    1114          hLayer:  handle to the layer that owned the feature.
    1115
    1116          nFeatureId:  the feature id of the feature to read.
    1117
    1118          an handle to a feature now owned by the caller, or NULL on failure.
    1119          """
    1120          return _ogr.Layer_GetFeature(self, *args)
    1121
    1122 -    def GetNextFeature(self, *args):
    1123          """
    1124          GetNextFeature(self) -> Feature
    1125
    1126          OGRFeatureH
    1127          OGR_L_GetNextFeature(OGRLayerH hLayer)
    1128
    1129          Fetch the next available feature from this layer.
    1130
    1131          The returned feature becomes the responsiblity of the caller to delete
    1132          with OGR_F_Destroy(). It is critical that all features associated with
    1133          an OGRLayer (more specifically an OGRFeatureDefn) be deleted before
    1134          that layer/datasource is deleted.
    1135
    1136          Only features matching the current spatial filter (set with
    1137          SetSpatialFilter()) will be returned.
    1138
    1139          This function implements sequential access to the features of a layer.
    1140          The OGR_L_ResetReading() function can be used to start at the
    1141          beginning again.
    1142
    1143          This function is the same as the C++ method
    1144          OGRLayer::GetNextFeature().
    1145
    1146          Parameters:
    1147          -----------
    1148
    1149          hLayer:  handle to the layer from which feature are read.
    1150
    1151          an handle to a feature, or NULL if no more features are available.
    1152          """
    1153          return _ogr.Layer_GetNextFeature(self, *args)
    1154
    1155 -    def SetNextByIndex(self, *args):
    1156          """
    1157          SetNextByIndex(self, long new_index) -> OGRErr
    1158
    1159          OGRErr
    1160          OGR_L_SetNextByIndex(OGRLayerH hLayer, long nIndex)
    1161
    1162          Move read cursor to the nIndex'th feature in the current resultset.
    1163
    1164          This method allows positioning of a layer such that the
    1165          GetNextFeature() call will read the requested feature, where nIndex is
    1166          an absolute index into the current result set. So, setting it to 3
    1167          would mean the next feature read with GetNextFeature() would have been
    1168          the 4th feature to have been read if sequential reading took place
    1169          from the beginning of the layer, including accounting for spatial and
    1170          attribute filters.
    1171
    1172          Only in rare circumstances is SetNextByIndex() efficiently
    1173          implemented. In all other cases the default implementation which calls
    1174          ResetReading() and then calls GetNextFeature() nIndex times is used.
    1175          To determine if fast seeking is available on the current layer use the
    1176          TestCapability() method with a value of OLCFastSetNextByIndex.
    1177
    1178          This method is the same as the C++ method OGRLayer::SetNextByIndex()
    1179
    1180          Parameters:
    1181          -----------
    1182
    1183          hLayer:  handle to the layer
    1184
    1185          nIndex:  the index indicating how many steps into the result set to
    1186          seek.
    1187
    1188          OGRERR_NONE on success or an error code.
    1189          """
    1190          return _ogr.Layer_SetNextByIndex(self, *args)
    1191
    1192 -    def SetFeature(self, *args):
    1193          """
    1194          SetFeature(self, Feature feature) -> OGRErr
    1195
    1196          OGRErr OGR_L_SetFeature(OGRLayerH
    1197          hLayer, OGRFeatureH hFeat)
    1198
    1199          Rewrite an existing feature.
    1200
    1201          This function will write a feature to the layer, based on the feature
    1202          id within the OGRFeature.
    1203
    1204          Use OGR_L_TestCapability(OLCRandomWrite) to establish if this layer
    1205          supports random access writing via OGR_L_SetFeature().
    1206
    1207          This function is the same as the C++ method OGRLayer::SetFeature().
    1208
    1209          Parameters:
    1210          -----------
    1211
    1212          hLayer:  handle to the layer to write the feature.
    1213
    1214          hFeat:  the feature to write.
    1215
    1216          OGRERR_NONE if the operation works, otherwise an appropriate error
    1217          code.
    1218          """
    1219          return _ogr.Layer_SetFeature(self, *args)
    1220
    1221 -    def CreateFeature(self, *args):
    1222          """
    1223          CreateFeature(self, Feature feature) -> OGRErr
    1224
    1225          OGRErr
    1226          OGR_L_CreateFeature(OGRLayerH hLayer, OGRFeatureH hFeat)
    1227
    1228          Create and write a new feature within a layer.
    1229
    1230          The passed feature is written to the layer as a new feature, rather
    1231          than overwriting an existing one. If the feature has a feature id
    1232          other than OGRNullFID, then the native implementation may use that as
    1233          the feature id of the new feature, but not necessarily. Upon
    1234          successful return the passed feature will have been updated with the
    1235          new feature id.
    1236
    1237          This function is the same as the C++ method OGRLayer::CreateFeature().
    1238
    1239          Parameters:
    1240          -----------
    1241
    1242          hLayer:  handle to the layer to write the feature to.
    1243
    1244          hFeat:  the handle of the feature to write to disk.
    1245
    1246          OGRERR_NONE on success.
    1247          """
    1248          return _ogr.Layer_CreateFeature(self, *args)
    1249
    1250 -    def DeleteFeature(self, *args):
    1251          """
    1252          DeleteFeature(self, long fid) -> OGRErr
    1253
    1254          OGRErr
    1255          OGR_L_DeleteFeature(OGRLayerH hDS, long nFID)
    1256
    1257          Delete feature from layer.
    1258
    1259          The feature with the indicated feature id is deleted from the layer if
    1260          supported by the driver. Most drivers do not support feature deletion,
    1261          and will return OGRERR_UNSUPPORTED_OPERATION. The
    1262          OGR_L_TestCapability() function may be called with OLCDeleteFeature to
    1263          check if the driver supports feature deletion.
    1264
    1265          This method is the same as the C++ method OGRLayer::DeleteFeature().
    1266
    1267          Parameters:
    1268          -----------
    1269
    1270          hLayer:  handle to the layer
    1271
    1272          nFID:  the feature id to be deleted from the layer
    1273
    1274          OGRERR_NONE on success.
    1275          """
    1276          return _ogr.Layer_DeleteFeature(self, *args)
    1277
    1278 -    def SyncToDisk(self, *args):
    1279          """
    1280          SyncToDisk(self) -> OGRErr
    1281
    1282          OGRErr OGR_L_SyncToDisk(OGRLayerH
    1283          hDS)
    1284
    1285          Flush pending changes to disk.
    1286
    1287          This call is intended to force the layer to flush any pending writes
    1288          to disk, and leave the disk file in a consistent state. It would not
    1289          normally have any effect on read-only datasources.
    1290
    1291          Some layers do not implement this method, and will still return
    1292          OGRERR_NONE. The default implementation just returns OGRERR_NONE. An
    1293          error is only returned if an error occurs while attempting to flush to
    1294          disk.
    1295
    1296          In any event, you should always close any opened datasource with
    1297          OGR_DS_Destroy() that will ensure all data is correctly flushed.
    1298
    1299          This method is the same as the C++ method OGRLayer::SyncToDisk()
    1300
    1301          Parameters:
    1302          -----------
    1303
    1304          hLayer:  handle to the layer
    1305
    1306          OGRERR_NONE if no error occurs (even if nothing is done) or an error
    1307          code.
    1308          """
    1309          return _ogr.Layer_SyncToDisk(self, *args)
    1310
    1311 -    def GetLayerDefn(self, *args):
    1312          """
    1313          GetLayerDefn(self) -> FeatureDefn
    1314
    1315          OGRFeatureDefnH
    1316          OGR_L_GetLayerDefn(OGRLayerH hLayer)
    1317
    1318          Fetch the schema information for this layer.
    1319
    1320          The returned handle to the OGRFeatureDefn is owned by the OGRLayer,
    1321          and should not be modified or freed by the application. It
    1322          encapsulates the attribute schema of the features of the layer.
    1323
    1324          This function is the same as the C++ method OGRLayer::GetLayerDefn().
    1325
    1326          Parameters:
    1327          -----------
    1328
    1329          hLayer:  handle to the layer to get the schema information.
    1330
    1331          an handle to the feature definition.
    1332          """
    1333          return _ogr.Layer_GetLayerDefn(self, *args)
    1334
    1335 -    def GetFeatureCount(self, *args, **kwargs):
    1336          """
    1337          GetFeatureCount(self, int force = 1) -> int
    1338
    1339          int
    1340          OGR_L_GetFeatureCount(OGRLayerH hLayer, int bForce)
    1341
    1342          Fetch the feature count in this layer.
    1343
    1344          Returns the number of features in the layer. For dynamic databases the
    1345          count may not be exact. If bForce is FALSE, and it would be expensive
    1346          to establish the feature count a value of -1 may be returned
    1347          indicating that the count isn't know. If bForce is TRUE some
    1348          implementations will actually scan the entire layer once to count
    1349          objects.
    1350
    1351          The returned count takes the spatial filter into account.
    1352
    1353          Note that some implementations of this method may alter the read
    1354          cursor of the layer.
    1355
    1356          This function is the same as the CPP OGRLayer::GetFeatureCount().
    1357
    1358          Parameters:
    1359          -----------
    1360
    1361          hLayer:  handle to the layer that owned the features.
    1362
    1363          bForce:  Flag indicating whether the count should be computed even if
    1364          it is expensive.
    1365
    1366          feature count, -1 if count not known.
    1367          """
    1368          return _ogr.Layer_GetFeatureCount(self, *args, **kwargs)
    1369
    1370 -    def GetExtent(self, *args, **kwargs):
    1371          """
    1372          GetExtent(self, int force = 1, int can_return_null = 0)
    1373
    1374          OGRErr OGR_L_GetExtent(OGRLayerH
    1375          hLayer, OGREnvelope *psExtent, int bForce)
    1376
    1377          Fetch the extent of this layer.
    1378
    1379          Returns the extent (MBR) of the data in the layer. If bForce is FALSE,
    1380          and it would be expensive to establish the extent then OGRERR_FAILURE
    1381          will be returned indicating that the extent isn't know. If bForce is
    1382          TRUE then some implementations will actually scan the entire layer
    1383          once to compute the MBR of all the features in the layer.
    1384
    1385          Depending on the drivers, the returned extent may or may not take the
    1386          spatial filter into account. So it is safer to call OGR_L_GetExtent()
    1387          without setting a spatial filter.
    1388
    1389          Layers without any geometry may return OGRERR_FAILURE just indicating
    1390          that no meaningful extents could be collected.
    1391
    1392          Note that some implementations of this method may alter the read
    1393          cursor of the layer.
    1394
    1395          This function is the same as the C++ method OGRLayer::GetExtent().
    1396
    1397          Parameters:
    1398          -----------
    1399
    1400          hLayer:  handle to the layer from which to get extent.
    1401
    1402          psExtent:  the structure in which the extent value will be returned.
    1403
    1404          bForce:  Flag indicating whether the extent should be computed even if
    1405          it is expensive.
    1406
    1407          OGRERR_NONE on success, OGRERR_FAILURE if extent not known.
    1408          """
    1409          return _ogr.Layer_GetExtent(self, *args, **kwargs)
    1410
    1411 -    def TestCapability(self, *args):
    1412          """
    1413          TestCapability(self, char cap) -> bool
    1414
    1415          int
    1416          OGR_L_TestCapability(OGRLayerH hLayer, const char *pszCap)
    1417
    1418          Test if this layer supported the named capability.
    1419
    1420          The capability codes that can be tested are represented as strings,
    1421          but #defined constants exists to ensure correct spelling. Specific
    1422          layer types may implement class specific capabilities, but this can't
    1423          generally be discovered by the caller.
    1424
    1425          OLCRandomRead / "RandomRead": TRUE if the GetFeature() method is
    1426          implemented in an optimized way for this layer, as opposed to the
    1427          default implementation using ResetReading() and GetNextFeature() to
    1428          find the requested feature id.
    1429
    1430          OLCSequentialWrite / "SequentialWrite": TRUE if the CreateFeature()
    1431          method works for this layer. Note this means that this particular
    1432          layer is writable. The same OGRLayer class may returned FALSE for
    1433          other layer instances that are effectively read-only.
    1434
    1435          OLCRandomWrite / "RandomWrite": TRUE if the SetFeature() method is
    1436          operational on this layer. Note this means that this particular layer
    1437          is writable. The same OGRLayer class may returned FALSE for other
    1438          layer instances that are effectively read-only.
    1439
    1440          OLCFastSpatialFilter / "FastSpatialFilter": TRUE if this layer
    1441          implements spatial filtering efficiently. Layers that effectively read
    1442          all features, and test them with the OGRFeature intersection methods
    1443          should return FALSE. This can be used as a clue by the application
    1444          whether it should build and maintain its own spatial index for
    1445          features in this layer.
    1446
    1447          OLCFastFeatureCount / "FastFeatureCount": TRUE if this layer can
    1448          return a feature count (via OGR_L_GetFeatureCount()) efficiently ...
    1449          ie. without counting the features. In some cases this will return TRUE
    1450          until a spatial filter is installed after which it will return FALSE.
    1451
    1452          OLCFastGetExtent / "FastGetExtent": TRUE if this layer can return
    1453          its data extent (via OGR_L_GetExtent()) efficiently ... ie. without
    1454          scanning all the features. In some cases this will return TRUE until a
    1455          spatial filter is installed after which it will return FALSE.
    1456
    1457          OLCFastSetNextByIndex / "FastSetNextByIndex": TRUE if this layer can
    1458          perform the SetNextByIndex() call efficiently, otherwise FALSE.
    1459
    1460          OLCCreateField / "CreateField": TRUE if this layer can create new
    1461          fields on the current layer using CreateField(), otherwise FALSE.
    1462
    1463          OLCDeleteField / "DeleteField": TRUE if this layer can delete
    1464          existing fields on the current layer using DeleteField(), otherwise
    1465          FALSE.
    1466
    1467          OLCReorderFields / "ReorderFields": TRUE if this layer can reorder
    1468          existing fields on the current layer using ReorderField() or
    1469          ReorderFields(), otherwise FALSE.
    1470
    1471          OLCAlterFieldDefn / "AlterFieldDefn": TRUE if this layer can alter
    1472          the definition of an existing field on the current layer using
    1473          AlterFieldDefn(), otherwise FALSE.
    1474
    1475          OLCDeleteFeature / "DeleteFeature": TRUE if the DeleteFeature()
    1476          method is supported on this layer, otherwise FALSE.
    1477
    1478          OLCStringsAsUTF8 / "StringsAsUTF8": TRUE if values of OFTString
    1479          fields are assured to be in UTF-8 format. If FALSE the encoding of
    1480          fields is uncertain, though it might still be UTF-8.
    1481
    1482          OLCTransactions / "Transactions": TRUE if the StartTransaction(),
    1483          CommitTransaction() and RollbackTransaction() methods work in a
    1484          meaningful way, otherwise FALSE.
    1485
    1486          This function is the same as the C++ method
    1487          OGRLayer::TestCapability().
    1488
    1489          Parameters:
    1490          -----------
    1491
    1492          hLayer:  handle to the layer to get the capability from.
    1493
    1494          pszCap:  the name of the capability to test.
    1495
    1496          TRUE if the layer has the requested capability, or FALSE otherwise.
    1497          OGRLayers will return FALSE for any unrecognised capabilities.
    1498          """
    1499          return _ogr.Layer_TestCapability(self, *args)
    1500
    1501 -    def CreateField(self, *args, **kwargs):
    1502          """
    1503          CreateField(self, FieldDefn field_def, int approx_ok = 1) -> OGRErr
    1504
    1505          OGRErr
    1506          OGR_L_CreateField(OGRLayerH hLayer, OGRFieldDefnH hField, int
    1507          bApproxOK)
    1508
    1509          Create a new field on a layer.
    1510
    1511          You must use this to create new fields on a real layer. Internally the
    1512          OGRFeatureDefn for the layer will be updated to reflect the new field.
    1513          Applications should never modify the OGRFeatureDefn used by a layer
    1514          directly.
    1515
    1516          This function should not be called while there are feature objects in
    1517          existance that were obtained or created with the previous layer
    1518          definition.
    1519
    1520          Not all drivers support this function. You can query a layer to check
    1521          if it supports it with the OLCCreateField capability. Some drivers may
    1522          only support this method while there are still no features in the
    1523          layer. When it is supported, the existings features of the backing
    1524          file/database should be updated accordingly.
    1525
    1526          This function is the same as the C++ method OGRLayer::CreateField().
    1527
    1528          Parameters:
    1529          -----------
    1530
    1531          hLayer:  handle to the layer to write the field definition.
    1532
    1533          hField:  handle of the field definition to write to disk.
    1534
    1535          bApproxOK:  If TRUE, the field may be created in a slightly different
    1536          form depending on the limitations of the format driver.
    1537
    1538          OGRERR_NONE on success.
    1539          """
    1540          return _ogr.Layer_CreateField(self, *args, **kwargs)
    1541
    1542 -    def DeleteField(self, *args):
    1543          """
    1544          DeleteField(self, int iField) -> OGRErr
    1545
    1546          OGRErr
    1547          OGR_L_DeleteField(OGRLayerH hLayer, int iField)
    1548
    1549          Create a new field on a layer.
    1550
    1551          You must use this to delete existing fields on a real layer.
    1552          Internally the OGRFeatureDefn for the layer will be updated to reflect
    1553          the deleted field. Applications should never modify the OGRFeatureDefn
    1554          used by a layer directly.
    1555
    1556          This function should not be called while there are feature objects in
    1557          existance that were obtained or created with the previous layer
    1558          definition.
    1559
    1560          Not all drivers support this function. You can query a layer to check
    1561          if it supports it with the OLCDeleteField capability. Some drivers may
    1562          only support this method while there are still no features in the
    1563          layer. When it is supported, the existings features of the backing
    1564          file/database should be updated accordingly.
    1565
    1566          This function is the same as the C++ method OGRLayer::DeleteField().
    1567
    1568          Parameters:
    1569          -----------
    1570
    1571          hLayer:  handle to the layer.
    1572
    1573          iField:  index of the field to delete.
    1574
    1575          OGRERR_NONE on success.
    1576
    1577          OGR 1.9.0
    1578          """
    1579          return _ogr.Layer_DeleteField(self, *args)
    1580
    1581 -    def ReorderField(self, *args):
    1582          """
    1583          ReorderField(self, int iOldFieldPos, int iNewFieldPos) -> OGRErr
    1584
    1585          OGRErr
    1586          OGR_L_ReorderField(OGRLayerH hLayer, int iOldFieldPos, int
    1587          iNewFieldPos)
    1588
    1589          Reorder an existing field on a layer.
    1590
    1591          This function is a conveniency wrapper of OGR_L_ReorderFields()
    1592          dedicated to move a single field.
    1593
    1594          You must use this to reorder existing fields on a real layer.
    1595          Internally the OGRFeatureDefn for the layer will be updated to reflect
    1596          the reordering of the fields. Applications should never modify the
    1597          OGRFeatureDefn used by a layer directly.
    1598
    1599          This function should not be called while there are feature objects in
    1600          existance that were obtained or created with the previous layer
    1601          definition.
    1602
    1603          The field definition that was at initial position iOldFieldPos will be
    1604          moved at position iNewFieldPos, and elements between will be shuffled
    1605          accordingly.
    1606
    1607          For example, let suppose the fields were "0","1","2","3","4"
    1608          initially. ReorderField(1, 3) will reorder them as
    1609          "0","2","3","1","4".
    1610
    1611          Not all drivers support this function. You can query a layer to check
    1612          if it supports it with the OLCReorderFields capability. Some drivers
    1613          may only support this method while there are still no features in the
    1614          layer. When it is supported, the existings features of the backing
    1615          file/database should be updated accordingly.
    1616
    1617          This function is the same as the C++ method OGRLayer::ReorderField().
    1618
    1619          Parameters:
    1620          -----------
    1621
    1622          hLayer:  handle to the layer.
    1623
    1624          iOldFieldPos:  previous position of the field to move. Must be in the
    1625          range [0,GetFieldCount()-1].
    1626
    1627          iNewFieldPos:  new position of the field to move. Must be in the range
    1628          [0,GetFieldCount()-1].
    1629
    1630          OGRERR_NONE on success.
    1631
    1632          OGR 1.9.0
    1633          """
    1634          return _ogr.Layer_ReorderField(self, *args)
    1635
    1636 -    def ReorderFields(self, *args):
    1637          """
    1638          ReorderFields(self, int nList) -> OGRErr
    1639
    1640          OGRErr
    1641          OGR_L_ReorderFields(OGRLayerH hLayer, int *panMap)
    1642
    1643          Reorder all the fields of a layer.
    1644
    1645          You must use this to reorder existing fields on a real layer.
    1646          Internally the OGRFeatureDefn for the layer will be updated to reflect
    1647          the reordering of the fields. Applications should never modify the
    1648          OGRFeatureDefn used by a layer directly.
    1649
    1650          This function should not be called while there are feature objects in
    1651          existance that were obtained or created with the previous layer
    1652          definition.
    1653
    1654          panMap is such that,for each field definition at position i after
    1655          reordering, its position before reordering was panMap[i].
    1656
    1657          For example, let suppose the fields were "0","1","2","3","4"
    1658          initially. ReorderFields([0,2,3,1,4]) will reorder them as
    1659          "0","2","3","1","4".
    1660
    1661          Not all drivers support this function. You can query a layer to check
    1662          if it supports it with the OLCReorderFields capability. Some drivers
    1663          may only support this method while there are still no features in the
    1664          layer. When it is supported, the existings features of the backing
    1665          file/database should be updated accordingly.
    1666
    1667          This function is the same as the C++ method OGRLayer::ReorderFields().
    1668
    1669          Parameters:
    1670          -----------
    1671
    1672          hLayer:  handle to the layer.
    1673
    1674          panMap:  an array of GetLayerDefn()->GetFieldCount() elements which is
    1675          a permutation of [0, GetLayerDefn()->GetFieldCount()-1].
    1676
    1677          OGRERR_NONE on success.
    1678
    1679          OGR 1.9.0
    1680          """
    1681          return _ogr.Layer_ReorderFields(self, *args)
    1682
    1683 -    def AlterFieldDefn(self, *args):
    1684          """
    1685          AlterFieldDefn(self, int iField, FieldDefn field_def, int nFlags) -> OGRErr
    1686
    1687          OGRErr
    1688          OGR_L_AlterFieldDefn(OGRLayerH hLayer, int iField, OGRFieldDefnH
    1689          hNewFieldDefn, int nFlags)
    1690
    1691          Alter the definition of an existing field on a layer.
    1692
    1693          You must use this to alter the definition of an existing field of a
    1694          real layer. Internally the OGRFeatureDefn for the layer will be
    1695          updated to reflect the altered field. Applications should never modify
    1696          the OGRFeatureDefn used by a layer directly.
    1697
    1698          This function should not be called while there are feature objects in
    1699          existance that were obtained or created with the previous layer
    1700          definition.
    1701
    1702          Not all drivers support this function. You can query a layer to check
    1703          if it supports it with the OLCAlterFieldDefn capability. Some drivers
    1704          may only support this method while there are still no features in the
    1705          layer. When it is supported, the existings features of the backing
    1706          file/database should be updated accordingly. Some drivers might also
    1707          not support all update flags.
    1708
    1709          This function is the same as the C++ method
    1710          OGRLayer::AlterFieldDefn().
    1711
    1712          Parameters:
    1713          -----------
    1714
    1715          hLayer:  handle to the layer.
    1716
    1717          iField:  index of the field whose definition must be altered.
    1718
    1719          hNewFieldDefn:  new field definition
    1720
    1721          nFlags:  combination of ALTER_NAME_FLAG, ALTER_TYPE_FLAG and
    1722          ALTER_WIDTH_PRECISION_FLAG to indicate which of the name and/or type
    1723          and/or width and precision fields from the new field definition must
    1724          be taken into account.
    1725
    1726          OGRERR_NONE on success.
    1727
    1728          OGR 1.9.0
    1729          """
    1730          return _ogr.Layer_AlterFieldDefn(self, *args)
    1731
    1732 -    def StartTransaction(self, *args):
    1733          """
    1734          StartTransaction(self) -> OGRErr
    1735
    1736          OGRErr
    1737          OGR_L_StartTransaction(OGRLayerH hLayer)
    1738
    1739          For datasources which support transactions, StartTransaction creates a
    1740          transaction.
    1741
    1742          If starting the transaction fails, will return OGRERR_FAILURE.
    1743          Datasources which do not support transactions will always return
    1744          OGRERR_NONE.
    1745
    1746          This function is the same as the C++ method
    1747          OGRLayer::StartTransaction().
    1748
    1749          Parameters:
    1750          -----------
    1751
    1752          hLayer:  handle to the layer
    1753
    1754          OGRERR_NONE on success.
    1755          """
    1756          return _ogr.Layer_StartTransaction(self, *args)
    1757
    1758 -    def CommitTransaction(self, *args):
    1759          """
    1760          CommitTransaction(self) -> OGRErr
    1761
    1762          OGRErr
    1763          OGR_L_CommitTransaction(OGRLayerH hLayer)
    1764
    1765          For datasources which support transactions, CommitTransaction commits
    1766          a transaction.
    1767
    1768          If no transaction is active, or the commit fails, will return
    1769          OGRERR_FAILURE. Datasources which do not support transactions will
    1770          always return OGRERR_NONE.
    1771
    1772          This function is the same as the C++ method
    1773          OGRLayer::CommitTransaction().
    1774
    1775          Parameters:
    1776          -----------
    1777
    1778          hLayer:  handle to the layer
    1779
    1780          OGRERR_NONE on success.
    1781          """
    1782          return _ogr.Layer_CommitTransaction(self, *args)
    1783
    1784 -    def RollbackTransaction(self, *args):
    1785          """
    1786          RollbackTransaction(self) -> OGRErr
    1787
    1788          OGRErr
    1789          OGR_L_RollbackTransaction(OGRLayerH hLayer)
    1790
    1791          For datasources which support transactions, RollbackTransaction will
    1792          roll back a datasource to its state before the start of the current
    1793          transaction. If no transaction is active, or the rollback fails, will
    1794          return OGRERR_FAILURE. Datasources which do not support transactions
    1795          will always return OGRERR_NONE.
    1796
    1797          This function is the same as the C++ method
    1798          OGRLayer::RollbackTransaction().
    1799
    1800          Parameters:
    1801          -----------
    1802
    1803          hLayer:  handle to the layer
    1804
    1805          OGRERR_NONE on success.
    1806          """
    1807          return _ogr.Layer_RollbackTransaction(self, *args)
    1808
    1809 -    def GetSpatialRef(self, *args):
    1810          """
    1811          GetSpatialRef(self) -> SpatialReference
    1812
    1813          OGRSpatialReferenceH
    1814          OGR_L_GetSpatialRef(OGRLayerH hLayer)
    1815
    1816          Fetch the spatial reference system for this layer.
    1817
    1818          The returned object is owned by the OGRLayer and should not be
    1819          modified or freed by the application.
    1820
    1821          This function is the same as the C++ method OGRLayer::GetSpatialRef().
    1822
    1823          Parameters:
    1824          -----------
    1825
    1826          hLayer:  handle to the layer to get the spatial reference from.
    1827
    1828          spatial reference, or NULL if there isn't one.
    1829          """
    1830          return _ogr.Layer_GetSpatialRef(self, *args)
    1831
    1832 -    def GetFeaturesRead(self, *args):
    1833          """
    1834          GetFeaturesRead(self) -> GIntBig
    1835
    1836          GIntBig
    1837          OGR_L_GetFeaturesRead(OGRLayerH hLayer)
    1838          """
    1839          return _ogr.Layer_GetFeaturesRead(self, *args)
    1840
    1841 -    def SetIgnoredFields(self, *args):
    1842          """
    1843          SetIgnoredFields(self, char options) -> OGRErr
    1844
    1845          OGRErr
    1846          OGR_L_SetIgnoredFields(OGRLayerH hLayer, const char **papszFields)
    1847
    1848          Set which fields can be omitted when retrieving features from the
    1849          layer.
    1850
    1851          If the driver supports this functionality (testable using
    1852          OLCIgnoreFields capability), it will not fetch the specified fields in
    1853          subsequent calls to GetFeature() / GetNextFeature() and thus save some
    1854          processing time and/or bandwidth.
    1855
    1856          Besides field names of the layers, the following special fields can be
    1857          passed: "OGR_GEOMETRY" to ignore geometry and "OGR_STYLE" to
    1858          ignore layer style.
    1859
    1860          By default, no fields are ignored.
    1861
    1862          This method is the same as the C++ method OGRLayer::SetIgnoredFields()
    1863
    1864          Parameters:
    1865          -----------
    1866
    1867          papszFields:  an array of field names terminated by NULL item. If NULL
    1868          is passed, the ignored list is cleared.
    1869
    1870          OGRERR_NONE if all field names have been resolved (even if the driver
    1871          does not support this method)
    1872          """
    1873          return _ogr.Layer_SetIgnoredFields(self, *args)
    1874
    1875 -    def Reference(self):
    1876        "For backwards compatibility only."
    1877        pass
    1878
    1879 -    def Dereference(self):
    1880        "For backwards compatibility only."
    1881        pass
    1882
    1883 -    def __len__(self):
    1884          """Returns the number of features in the layer"""
    1885          return self.GetFeatureCount()
    1886
    1887 -    def __getitem__(self, value):
    1888          """Support list and slice -like access to the layer.
    1889      r[0] would return the first feature on the layer.
    1890      r[0:4] would return a list of the first four features."""
    1891          import types
    1892          if isinstance(value, slice):
    1893              output = []
    1894              if value.stop == sys.maxint:
    1895
    1896
    1897
    1898                  stop = len(self) - 1
    1899              else:
    1900                  stop = value.stop
    1901              for i in xrange(value.start,stop,value.step):
    1902                  feature = self.GetFeature(i)
    1903                  if feature:
    1904                      output.append(feature)
    1905                  else:
    1906                      return output
    1907              return output
    1908          if isinstance(value, int):
    1909              if value > len(self)-1:
    1910                  raise IndexError
    1911              return self.GetFeature(value)
    1912          else:
    1913              raise TypeError("Input %s is not of IntType or SliceType" % type(value))
    1914
    1915 -    def CreateFields(fields):
    1916          """Create a list of fields on the Layer"""
    1917          for i in fields:
    1918              self.CreateField(i)
    1919
    1920 -    def __iter__(self):
    1921          return self
    1922
    1923 -    def next(self):
    1924          feature = self.GetNextFeature()
    1925          if not feature:
    1926              raise StopIteration
    1927          else:
    1928              return feature
    1929
    1930 -    def schema(self):
    1931          output = []
    1932          defn = self.GetLayerDefn()
    1933          for n in range(defn.GetFieldCount()):
    1934              output.append(defn.GetFieldDefn(n))
    1935          return output
    1936      schema = property(schema)
    1937
    1938
    1939  Layer_swigregister = _ogr.Layer_swigregister
    1940  Layer_swigregister(Layer)
    1941
    1942 -class Feature(_object):
    1943      """Proxy of C++ OGRFeatureShadow class"""
    1944      __swig_setmethods__ = {}
    1945      __setattr__ = lambda self, name, value: _swig_setattr(self, Feature, name, value)
    1946      __swig_getmethods__ = {}
    1947      __getattr__ = lambda self, name: _swig_getattr(self, Feature, name)
    1948      __repr__ = _swig_repr
    1949      __swig_destroy__ = _ogr.delete_Feature
    1950      __del__ = lambda self : None;
    1951 -    def __init__(self, *args, **kwargs):
    1952          """__init__(self, FeatureDefn feature_def) -> Feature"""
    1953          this = _ogr.new_Feature(*args, **kwargs)
    1954          try: self.this.append(this)
    1955          except: self.this = this
    1956 -    def GetDefnRef(self, *args):
    1957          """
    1958          GetDefnRef(self) -> FeatureDefn
    1959
    1960          OGRFeatureDefnH
    1961          OGR_F_GetDefnRef(OGRFeatureH hFeat)
    1962
    1963          Fetch feature definition.
    1964
    1965          This function is the same as the C++ method OGRFeature::GetDefnRef().
    1966
    1967          Parameters:
    1968          -----------
    1969
    1970          hFeat:  handle to the feature to get the feature definition from.
    1971
    1972          an handle to the feature definition object on which feature depends.
    1973
    1974          """
    1975          return _ogr.Feature_GetDefnRef(self, *args)
    1976
    1977 -    def SetGeometry(self, *args):
    1978          """
    1979          SetGeometry(self, Geometry geom) -> OGRErr
    1980
    1981          OGRErr
    1982          OGR_F_SetGeometry(OGRFeatureH hFeat, OGRGeometryH hGeom)
    1983
    1984          Set feature geometry.
    1985
    1986          This function updates the features geometry, and operate exactly as
    1987          SetGeometryDirectly(), except that this function does not assume
    1988          ownership of the passed geometry, but instead makes a copy of it.
    1989
    1990          This function is the same as the C++ OGRFeature::SetGeometry().
    1991
    1992          Parameters:
    1993          -----------
    1994
    1995          hFeat:  handle to the feature on which new geometry is applied to.
    1996
    1997          hGeom:  handle to the new geometry to apply to feature.
    1998
    1999          OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
    2000          geometry type is illegal for the OGRFeatureDefn (checking not yet
    2001          implemented).
    2002          """
    2003          return _ogr.Feature_SetGeometry(self, *args)
    2004
    2005 -    def SetGeometryDirectly(self, *args):
    2006          """
    2007          SetGeometryDirectly(self, Geometry geom) -> OGRErr
    2008
    2009          OGRErr
    2010          OGR_F_SetGeometryDirectly(OGRFeatureH hFeat, OGRGeometryH hGeom)
    2011
    2012          Set feature geometry.
    2013
    2014          This function updates the features geometry, and operate exactly as
    2015          SetGeometry(), except that this function assumes ownership of the
    2016          passed geometry.
    2017
    2018          This function is the same as the C++ method
    2019          OGRFeature::SetGeometryDirectly.
    2020
    2021          Parameters:
    2022          -----------
    2023
    2024          hFeat:  handle to the feature on which to apply the geometry.
    2025
    2026          hGeom:  handle to the new geometry to apply to feature.
    2027
    2028          OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
    2029          geometry type is illegal for the OGRFeatureDefn (checking not yet
    2030          implemented).
    2031          """
    2032          return _ogr.Feature_SetGeometryDirectly(self, *args)
    2033
    2034 -    def GetGeometryRef(self, *args):
    2035          """
    2036          GetGeometryRef(self) -> Geometry
    2037
    2038          OGRGeometryH
    2039          OGR_F_GetGeometryRef(OGRFeatureH hFeat)
    2040
    2041          Fetch an handle to feature geometry.
    2042
    2043          This function is the same as the C++ method
    2044          OGRFeature::GetGeometryRef().
    2045
    2046          Parameters:
    2047          -----------
    2048
    2049          hFeat:  handle to the feature to get geometry from.
    2050
    2051          an handle to internal feature geometry. This object should not be
    2052          modified.
    2053          """
    2054          return _ogr.Feature_GetGeometryRef(self, *args)
    2055
    2056 -    def Clone(self, *args):
    2057          """
    2058          Clone(self) -> Feature
    2059
    2060          OGRFeatureH OGR_F_Clone(OGRFeatureH
    2061          hFeat)
    2062
    2063          Duplicate feature.
    2064
    2065          The newly created feature is owned by the caller, and will have it's
    2066          own reference to the OGRFeatureDefn.
    2067
    2068          This function is the same as the C++ method OGRFeature::Clone().
    2069
    2070          Parameters:
    2071          -----------
    2072
    2073          hFeat:  handle to the feature to clone.
    2074
    2075          an handle to the new feature, exactly matching this feature.
    2076          """
    2077          return _ogr.Feature_Clone(self, *args)
    2078
    2079 -    def Equal(self, *args):
    2080          """
    2081          Equal(self, Feature feature) -> bool
    2082
    2083          int OGR_F_Equal(OGRFeatureH hFeat,
    2084          OGRFeatureH hOtherFeat)
    2085
    2086          Test if two features are the same.
    2087
    2088          Two features are considered equal if the share them (handle equality)
    2089          same OGRFeatureDefn, have the same field values, and the same geometry
    2090          (as tested by OGR_G_Equal()) as well as the same feature id.
    2091
    2092          This function is the same as the C++ method OGRFeature::Equal().
    2093
    2094          Parameters:
    2095          -----------
    2096
    2097          hFeat:  handle to one of the feature.
    2098
    2099          hOtherFeat:  handle to the other feature to test this one against.
    2100
    2101          TRUE if they are equal, otherwise FALSE.
    2102          """
    2103          return _ogr.Feature_Equal(self, *args)
    2104
    2105 -    def GetFieldCount(self, *args):
    2106          """
    2107          GetFieldCount(self) -> int
    2108
    2109          int
    2110          OGR_F_GetFieldCount(OGRFeatureH hFeat)
    2111
    2112          Fetch number of fields on this feature This will always be the same as
    2113          the field count for the OGRFeatureDefn.
    2114
    2115          This function is the same as the C++ method
    2116          OGRFeature::GetFieldCount().
    2117
    2118          Parameters:
    2119          -----------
    2120
    2121          hFeat:  handle to the feature to get the fields count from.
    2122
    2123          count of fields.
    2124          """
    2125          return _ogr.Feature_GetFieldCount(self, *args)
    2126
    2127 -    def GetFieldDefnRef(self, *args):
    2128          """
    2129          GetFieldDefnRef(self, int id) -> FieldDefn
    2130          GetFieldDefnRef(self, char name) -> FieldDefn
    2131
    2132          OGRFieldDefnH
    2133          OGR_F_GetFieldDefnRef(OGRFeatureH hFeat, int i)
    2134
    2135          Fetch definition for this field.
    2136
    2137          This function is the same as the C++ method
    2138          OGRFeature::GetFieldDefnRef().
    2139
    2140          Parameters:
    2141          -----------
    2142
    2143          hFeat:  handle to the feature on which the field is found.
    2144
    2145          i:  the field to fetch, from 0 to GetFieldCount()-1.
    2146
    2147          an handle to the field definition (from the OGRFeatureDefn). This is
    2148          an internal reference, and should not be deleted or modified.
    2149          """
    2150          return _ogr.Feature_GetFieldDefnRef(self, *args)
    2151
    2152 -    def GetFieldAsString(self, *args):
    2153          """
    2154          GetFieldAsString(self, int id) -> char
    2155          GetFieldAsString(self, char name) -> char
    2156
    2157          const char*
    2158          OGR_F_GetFieldAsString(OGRFeatureH hFeat, int iField)
    2159
    2160          Fetch field value as a string.
    2161
    2162          OFTReal and OFTInteger fields will be translated to string using
    2163          sprintf(), but not necessarily using the established formatting rules.
    2164          Other field types, or errors will result in a return value of zero.
    2165
    2166          This function is the same as the C++ method
    2167          OGRFeature::GetFieldAsString().
    2168
    2169          Parameters:
    2170          -----------
    2171
    2172          hFeat:  handle to the feature that owned the field.
    2173
    2174          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2175
    2176          the field value. This string is internal, and should not be modified,
    2177          or freed. Its lifetime may be very brief.
    2178          """
    2179          return _ogr.Feature_GetFieldAsString(self, *args)
    2180
    2181 -    def GetFieldAsInteger(self, *args):
    2182          """
    2183          GetFieldAsInteger(self, int id) -> int
    2184          GetFieldAsInteger(self, char name) -> int
    2185
    2186          int
    2187          OGR_F_GetFieldAsInteger(OGRFeatureH hFeat, int iField)
    2188
    2189          Fetch field value as integer.
    2190
    2191          OFTString features will be translated using atoi(). OFTReal fields
    2192          will be cast to integer. Other field types, or errors will result in a
    2193          return value of zero.
    2194
    2195          This function is the same as the C++ method
    2196          OGRFeature::GetFieldAsInteger().
    2197
    2198          Parameters:
    2199          -----------
    2200
    2201          hFeat:  handle to the feature that owned the field.
    2202
    2203          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2204
    2205          the field value.
    2206          """
    2207          return _ogr.Feature_GetFieldAsInteger(self, *args)
    2208
    2209 -    def GetFieldAsDouble(self, *args):
    2210          """
    2211          GetFieldAsDouble(self, int id) -> double
    2212          GetFieldAsDouble(self, char name) -> double
    2213
    2214          double
    2215          OGR_F_GetFieldAsDouble(OGRFeatureH hFeat, int iField)
    2216
    2217          Fetch field value as a double.
    2218
    2219          OFTString features will be translated using atof(). OFTInteger fields
    2220          will be cast to double. Other field types, or errors will result in a
    2221          return value of zero.
    2222
    2223          This function is the same as the C++ method
    2224          OGRFeature::GetFieldAsDouble().
    2225
    2226          Parameters:
    2227          -----------
    2228
    2229          hFeat:  handle to the feature that owned the field.
    2230
    2231          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2232
    2233          the field value.
    2234          """
    2235          return _ogr.Feature_GetFieldAsDouble(self, *args)
    2236
    2237 -    def GetFieldAsDateTime(self, *args):
    2238          """
    2239          GetFieldAsDateTime(self, int id)
    2240
    2241          int
    2242          OGR_F_GetFieldAsDateTime(OGRFeatureH hFeat, int iField, int *pnYear,
    2243          int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, int *pnSecond,
    2244          int *pnTZFlag)
    2245
    2246          Fetch field value as date and time.
    2247
    2248          Currently this method only works for OFTDate, OFTTime and OFTDateTime
    2249          fields.
    2250
    2251          This function is the same as the C++ method
    2252          OGRFeature::GetFieldAsDateTime().
    2253
    2254          Parameters:
    2255          -----------
    2256
    2257          hFeat:  handle to the feature that owned the field.
    2258
    2259          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2260
    2261          pnYear:  (including century)
    2262
    2263          pnMonth:  (1-12)
    2264
    2265          pnDay:  (1-31)
    2266
    2267          pnHour:  (0-23)
    2268
    2269          pnMinute:  (0-59)
    2270
    2271          pnSecond:  (0-59)
    2272
    2273          pnTZFlag:  (0=unknown, 1=localtime, 100=GMT, see data model for
    2274          details)
    2275
    2276          TRUE on success or FALSE on failure.
    2277          """
    2278          return _ogr.Feature_GetFieldAsDateTime(self, *args)
    2279
    2280 -    def GetFieldAsIntegerList(self, *args):
    2281          """
    2282          GetFieldAsIntegerList(self, int id)
    2283
    2284          const int*
    2285          OGR_F_GetFieldAsIntegerList(OGRFeatureH hFeat, int iField, int
    2286          *pnCount)
    2287
    2288          Fetch field value as a list of integers.
    2289
    2290          Currently this function only works for OFTIntegerList fields.
    2291
    2292          This function is the same as the C++ method
    2293          OGRFeature::GetFieldAsIntegerList().
    2294
    2295          Parameters:
    2296          -----------
    2297
    2298          hFeat:  handle to the feature that owned the field.
    2299
    2300          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2301
    2302          pnCount:  an integer to put the list count (number of integers) into.
    2303
    2304          the field value. This list is internal, and should not be modified, or
    2305          freed. Its lifetime may be very brief. If *pnCount is zero on return
    2306          the returned pointer may be NULL or non-NULL.
    2307          """
    2308          return _ogr.Feature_GetFieldAsIntegerList(self, *args)
    2309
    2310 -    def GetFieldAsDoubleList(self, *args):
    2311          """
    2312          GetFieldAsDoubleList(self, int id)
    2313
    2314          const double*
    2315          OGR_F_GetFieldAsDoubleList(OGRFeatureH hFeat, int iField, int
    2316          *pnCount)
    2317
    2318          Fetch field value as a list of doubles.
    2319
    2320          Currently this function only works for OFTRealList fields.
    2321
    2322          This function is the same as the C++ method
    2323          OGRFeature::GetFieldAsDoubleList().
    2324
    2325          Parameters:
    2326          -----------
    2327
    2328          hFeat:  handle to the feature that owned the field.
    2329
    2330          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2331
    2332          pnCount:  an integer to put the list count (number of doubles) into.
    2333
    2334          the field value. This list is internal, and should not be modified, or
    2335          freed. Its lifetime may be very brief. If *pnCount is zero on return
    2336          the returned pointer may be NULL or non-NULL.
    2337          """
    2338          return _ogr.Feature_GetFieldAsDoubleList(self, *args)
    2339
    2340 -    def GetFieldAsStringList(self, *args):
    2341          """
    2342          GetFieldAsStringList(self, int id) -> char
    2343
    2344          char**
    2345          OGR_F_GetFieldAsStringList(OGRFeatureH hFeat, int iField)
    2346
    2347          Fetch field value as a list of strings.
    2348
    2349          Currently this method only works for OFTStringList fields.
    2350
    2351          The returned list is terminated by a NULL pointer. The number of
    2352          elements can also be calculated using CSLCount().
    2353
    2354          This function is the same as the C++ method
    2355          OGRFeature::GetFieldAsStringList().
    2356
    2357          Parameters:
    2358          -----------
    2359
    2360          hFeat:  handle to the feature that owned the field.
    2361
    2362          iField:  the field to fetch, from 0 to GetFieldCount()-1.
    2363
    2364          the field value. This list is internal, and should not be modified, or
    2365          freed. Its lifetime may be very brief.
    2366          """
    2367          return _ogr.Feature_GetFieldAsStringList(self, *args)
    2368
    2369 -    def IsFieldSet(self, *args):
    2370          """
    2371          IsFieldSet(self, int id) -> bool
    2372          IsFieldSet(self, char name) -> bool
    2373
    2374          int OGR_F_IsFieldSet(OGRFeatureH
    2375          hFeat, int iField)
    2376
    2377          Test if a field has ever been assigned a value or not.
    2378
    2379          This function is the same as the C++ method OGRFeature::IsFieldSet().
    2380
    2381          Parameters:
    2382          -----------
    2383
    2384          hFeat:  handle to the feature on which the field is.
    2385
    2386          iField:  the field to test.
    2387
    2388          TRUE if the field has been set, otherwise false.
    2389          """
    2390          return _ogr.Feature_IsFieldSet(self, *args)
    2391
    2392 -    def GetFieldIndex(self, *args):
    2393          """
    2394          GetFieldIndex(self, char name) -> int
    2395
    2396          int
    2397          OGR_F_GetFieldIndex(OGRFeatureH hFeat, const char *pszName)
    2398
    2399          Fetch the field index given field name.
    2400
    2401          This is a cover for the OGRFeatureDefn::GetFieldIndex() method.
    2402
    2403          This function is the same as the C++ method
    2404          OGRFeature::GetFieldIndex().
    2405
    2406          Parameters:
    2407          -----------
    2408
    2409          hFeat:  handle to the feature on which the field is found.
    2410
    2411          pszName:  the name of the field to search for.
    2412
    2413          the field index, or -1 if no matching field is found.
    2414          """
    2415          return _ogr.Feature_GetFieldIndex(self, *args)
    2416
    2417 -    def GetFID(self, *args):
    2418          """
    2419          GetFID(self) -> int
    2420
    2421          long OGR_F_GetFID(OGRFeatureH hFeat)
    2422
    2423          Get feature identifier.
    2424
    2425          This function is the same as the C++ method OGRFeature::GetFID().
    2426
    2427          Parameters:
    2428          -----------
    2429
    2430          hFeat:  handle to the feature from which to get the feature
    2431          identifier.
    2432
    2433          feature id or OGRNullFID if none has been assigned.
    2434          """
    2435          return _ogr.Feature_GetFID(self, *args)
    2436
    2437 -    def SetFID(self, *args):
    2438          """
    2439          SetFID(self, int fid) -> OGRErr
    2440
    2441          OGRErr OGR_F_SetFID(OGRFeatureH hFeat,
    2442          long nFID)
    2443
    2444          Set the feature identifier.
    2445
    2446          For specific types of features this operation may fail on illegal
    2447          features ids. Generally it always succeeds. Feature ids should be
    2448          greater than or equal to zero, with the exception of OGRNullFID (-1)
    2449          indicating that the feature id is unknown.
    2450
    2451          This function is the same as the C++ method OGRFeature::SetFID().
    2452
    2453          Parameters:
    2454          -----------
    2455
    2456          hFeat:  handle to the feature to set the feature id to.
    2457
    2458          nFID:  the new feature identifier value to assign.
    2459
    2460          On success OGRERR_NONE, or on failure some other value.
    2461          """
    2462          return _ogr.Feature_SetFID(self, *args)
    2463
    2464 -    def DumpReadable(self, *args):
    2465          """
    2466          DumpReadable(self)
    2467
    2468          void
    2469          OGR_F_DumpReadable(OGRFeatureH hFeat, FILE *fpOut)
    2470
    2471          Dump this feature in a human readable form.
    2472
    2473          This dumps the attributes, and geometry; however, it doesn't
    2474          definition information (other than field types and names), nor does it
    2475          report the geometry spatial reference system.
    2476
    2477          This function is the same as the C++ method
    2478          OGRFeature::DumpReadable().
    2479
    2480          Parameters:
    2481          -----------
    2482
    2483          hFeat:  handle to the feature to dump.
    2484
    2485          fpOut:  the stream to write to, such as strout.
    2486          """
    2487          return _ogr.Feature_DumpReadable(self, *args)
    2488
    2489 -    def UnsetField(self, *args):
    2490          """
    2491          UnsetField(self, int id)
    2492          UnsetField(self, char name)
    2493
    2494          void OGR_F_UnsetField(OGRFeatureH
    2495          hFeat, int iField)
    2496
    2497          Clear a field, marking it as unset.
    2498
    2499          This function is the same as the C++ method OGRFeature::UnsetField().
    2500
    2501          Parameters:
    2502          -----------
    2503
    2504          hFeat:  handle to the feature on which the field is.
    2505
    2506          iField:  the field to unset.
    2507          """
    2508          return _ogr.Feature_UnsetField(self, *args)
    2509
    2510 -    def SetField(self, *args):
    2511          """
    2512          SetField(self, int id, char value)
    2513          SetField(self, char name, char value)
    2514          SetField(self, int id, int value)
    2515          SetField(self, char name, int value)
    2516          SetField(self, int id, double value)
    2517          SetField(self, char name, double value)
    2518          SetField(self, int id, int year, int month, int day, int hour, int minute,
    2519              int second, int tzflag)
    2520          SetField(self, char name, int year, int month, int day, int hour,
    2521              int minute, int second, int tzflag)
    2522          """
    2523          return _ogr.Feature_SetField(self, *args)
    2524
    2525 -    def SetFieldIntegerList(self, *args):
    2526          """
    2527          SetFieldIntegerList(self, int id, int nList)
    2528
    2529          void
    2530          OGR_F_SetFieldIntegerList(OGRFeatureH hFeat, int iField, int nCount,
    2531          int *panValues)
    2532
    2533          Set field to list of integers value.
    2534
    2535          This function currently on has an effect of OFTIntegerList fields.
    2536
    2537          This function is the same as the C++ method OGRFeature::SetField().
    2538
    2539          Parameters:
    2540          -----------
    2541
    2542          hFeat:  handle to the feature that owned the field.
    2543
    2544          iField:  the field to set, from 0 to GetFieldCount()-1.
    2545
    2546          nCount:  the number of values in the list being assigned.
    2547
    2548          panValues:  the values to assign.
    2549          """
    2550          return _ogr.Feature_SetFieldIntegerList(self, *args)
    2551
    2552 -    def SetFieldDoubleList(self, *args):
    2553          """
    2554          SetFieldDoubleList(self, int id, int nList)
    2555
    2556          void
    2557          OGR_F_SetFieldDoubleList(OGRFeatureH hFeat, int iField, int nCount,
    2558          double *padfValues)
    2559
    2560          Set field to list of doubles value.
    2561
    2562          This function currently on has an effect of OFTRealList fields.
    2563
    2564          This function is the same as the C++ method OGRFeature::SetField().
    2565
    2566          Parameters:
    2567          -----------
    2568
    2569          hFeat:  handle to the feature that owned the field.
    2570
    2571          iField:  the field to set, from 0 to GetFieldCount()-1.
    2572
    2573          nCount:  the number of values in the list being assigned.
    2574
    2575          padfValues:  the values to assign.
    2576          """
    2577          return _ogr.Feature_SetFieldDoubleList(self, *args)
    2578
    2579 -    def SetFieldStringList(self, *args):
    2580          """
    2581          SetFieldStringList(self, int id, char pList)
    2582
    2583          void
    2584          OGR_F_SetFieldStringList(OGRFeatureH hFeat, int iField, char
    2585          **papszValues)
    2586
    2587          Set field to list of strings value.
    2588
    2589          This function currently on has an effect of OFTStringList fields.
    2590
    2591          This function is the same as the C++ method OGRFeature::SetField().
    2592
    2593          Parameters:
    2594          -----------
    2595
    2596          hFeat:  handle to the feature that owned the field.
    2597
    2598          iField:  the field to set, from 0 to GetFieldCount()-1.
    2599
    2600          papszValues:  the values to assign.
    2601          """
    2602          return _ogr.Feature_SetFieldStringList(self, *args)
    2603
    2604 -    def SetFrom(self, *args, **kwargs):
    2605          """
    2606          SetFrom(self, Feature other, int forgiving = 1) -> OGRErr
    2607
    2608          OGRErr OGR_F_SetFrom(OGRFeatureH
    2609          hFeat, OGRFeatureH hOtherFeat, int bForgiving)
    2610
    2611          Set one feature from another.
    2612
    2613          Overwrite the contents of this feature from the geometry and
    2614          attributes of another. The hOtherFeature does not need to have the
    2615          same OGRFeatureDefn. Field values are copied by corresponding field
    2616          names. Field types do not have to exactly match. OGR_F_SetField*()
    2617          function conversion rules will be applied as needed.
    2618
    2619          This function is the same as the C++ method OGRFeature::SetFrom().
    2620
    2621          Parameters:
    2622          -----------
    2623
    2624          hFeat:  handle to the feature to set to.
    2625
    2626          hOtherFeat:  handle to the feature from which geometry, and field
    2627          values will be copied.
    2628
    2629          bForgiving:  TRUE if the operation should continue despite lacking
    2630          output fields matching some of the source fields.
    2631
    2632          OGRERR_NONE if the operation succeeds, even if some values are not
    2633          transferred, otherwise an error code.
    2634          """
    2635          return _ogr.Feature_SetFrom(self, *args, **kwargs)
    2636
    2637 -    def SetFromWithMap(self, *args):
    2638          """
    2639          SetFromWithMap(self, Feature other, int forgiving, int nList) -> OGRErr
    2640
    2641          OGRErr
    2642          OGR_F_SetFromWithMap(OGRFeatureH hFeat, OGRFeatureH hOtherFeat, int
    2643          bForgiving, int *panMap)
    2644
    2645          Set one feature from another.
    2646
    2647          Overwrite the contents of this feature from the geometry and
    2648          attributes of another. The hOtherFeature does not need to have the
    2649          same OGRFeatureDefn. Field values are copied according to the provided
    2650          indices map. Field types do not have to exactly match.
    2651          OGR_F_SetField*() function conversion rules will be applied as needed.
    2652          This is more efficient than OGR_F_SetFrom() in that this doesn't
    2653          lookup the fields by their names. Particularly useful when the field
    2654          names don't match.
    2655
    2656          This function is the same as the C++ method OGRFeature::SetFrom().
    2657
    2658          Parameters:
    2659          -----------
    2660
    2661          hFeat:  handle to the feature to set to.
    2662
    2663          hOtherFeat:  handle to the feature from which geometry, and field
    2664          values will be copied.
    2665
    2666          panMap:  Array of the indices of the destination feature's fields
    2667          stored at the corresponding index of the source feature's fields. A
    2668          value of -1 should be used to ignore the source's field. The array
    2669          should not be NULL and be as long as the number of fields in the
    2670          source feature.
    2671
    2672          bForgiving:  TRUE if the operation should continue despite lacking
    2673          output fields matching some of the source fields.
    2674
    2675          OGRERR_NONE if the operation succeeds, even if some values are not
    2676          transferred, otherwise an error code.
    2677          """
    2678          return _ogr.Feature_SetFromWithMap(self, *args)
    2679
    2680 -    def GetStyleString(self, *args):
    2681          """
    2682          GetStyleString(self) -> char
    2683
    2684          const char*
    2685          OGR_F_GetStyleString(OGRFeatureH hFeat)
    2686
    2687          Fetch style string for this feature.
    2688
    2689          Set the OGR Feature Style Specification for details on the format of
    2690          this string, and ogr_featurestyle.h for services available to parse
    2691          it.
    2692
    2693          This function is the same as the C++ method
    2694          OGRFeature::GetStyleString().
    2695
    2696          Parameters:
    2697          -----------
    2698
    2699          hFeat:  handle to the feature to get the style from.
    2700
    2701          a reference to a representation in string format, or NULL if there
    2702          isn't one.
    2703          """
    2704          return _ogr.Feature_GetStyleString(self, *args)
    2705
    2706 -    def SetStyleString(self, *args):
    2707          """
    2708          SetStyleString(self, char the_string)
    2709
    2710          void
    2711          OGR_F_SetStyleString(OGRFeatureH hFeat, const char *pszStyle)
    2712
    2713          Set feature style string. This method operate exactly as
    2714          OGR_F_SetStyleStringDirectly() except that it does not assume
    2715          ownership of the passed string, but instead makes a copy of it.
    2716
    2717          This function is the same as the C++ method
    2718          OGRFeature::SetStyleString().
    2719
    2720          Parameters:
    2721          -----------
    2722
    2723          hFeat:  handle to the feature to set style to.
    2724
    2725          pszStyle:  the style string to apply to this feature, cannot be NULL.
    2726
    2727          """
    2728          return _ogr.Feature_SetStyleString(self, *args)
    2729
    2730 -    def GetFieldType(self, *args):
    2731          """
    2732          GetFieldType(self, int id) -> OGRFieldType
    2733          GetFieldType(self, char name) -> OGRFieldType
    2734          """
    2735          return _ogr.Feature_GetFieldType(self, *args)
    2736
    2737 -    def Reference(self):
    2738        pass
    2739
    2740 -    def Dereference(self):
    2741        pass
    2742
    2743 -    def Destroy(self):
    2744        "Once called, self has effectively been destroyed.  Do not access. For backwards compatiblity only"
    2745        _ogr.delete_Feature( self )
    2746        self.thisown = 0
    2747
    2748 -    def __cmp__(self, other):
    2749          """Compares a feature to another for equality"""
    2750          return self.Equal(other)
    2751
    2752 -    def __copy__(self):
    2753          return self.Clone()
    2754
    2755
    2756
    2757 -    def __getattr__(self, key):
    2758          """Returns the values of fields by the given name"""
    2759          try:
    2760              return self.GetField(key)
    2761          except:
    2762              raise AttributeError(key)
    2763
    2764
    2765
    2766 -    def __setattr__(self, key, value):
    2767          """Set the values of fields by the given name"""
    2768          if key != 'this' and key != 'thisown' and self.GetFieldIndex(key) != -1:
    2769              return self.SetField2(key,value)
    2770          else:
    2771              self.__dict__[key] = value
    2772
    2773
    2774 -    def __getitem__(self, key):
    2775          """Returns the values of fields by the given name / field_index"""
    2776          return self.GetField(key)
    2777
    2778
    2779 -    def __setitem__(self, key, value):
    2780          """Returns the value of a field by field name / index"""
    2781          self.SetField2( key, value )
    2782
    2783 -    def GetField(self, fld_index):
    2784          import types
    2785          if isinstance(fld_index, str):
    2786              fld_index = self.GetFieldIndex(fld_index)
    2787          if (fld_index < 0) or (fld_index > self.GetFieldCount()):
    2788              raise ValueError("Illegal field requested in GetField()")
    2789          if not (self.IsFieldSet(fld_index)):
    2790              return None
    2791          fld_type = self.GetFieldType(fld_index)
    2792          if fld_type == OFTInteger:
    2793              return self.GetFieldAsInteger(fld_index)
    2794          if fld_type == OFTReal:
    2795              return self.GetFieldAsDouble(fld_index)
    2796          if fld_type == OFTStringList:
    2797              return self.GetFieldAsStringList(fld_index)
    2798          if fld_type == OFTIntegerList:
    2799              return self.GetFieldAsIntegerList(fld_index)
    2800          if fld_type == OFTRealList:
    2801              return self.GetFieldAsDoubleList(fld_index)
    2802
    2803
    2804
    2805          return self.GetFieldAsString(fld_index)
    2806
    2807 -    def SetField2(self, fld_index, value):
    2808          if isinstance(fld_index, str):
    2809              fld_index = self.GetFieldIndex(fld_index)
    2810
    2811          if value is None:
    2812              self.UnsetField( fld_index )
    2813              return
    2814
    2815          if isinstance(value,list):
    2816              if len(value) == 0:
    2817                  self.UnsetField( fld_index )
    2818                  return
    2819              if isinstance(value[0],int):
    2820                  self.SetFieldIntegerList(fld_index,value)
    2821                  return
    2822              elif isinstance(value[0],float):
    2823                  self.SetFieldDoubleList(fld_index,value)
    2824                  return
    2825              elif isinstance(value[0],str):
    2826                  self.SetFieldStringList(fld_index,value)
    2827                  return
    2828              else:
    2829                  raise TypeError( 'Unsupported type of list in SetField2()' )
    2830
    2831          try:
    2832              self.SetField( fld_index, value )
    2833          except:
    2834              self.SetField( fld_index, str(value) )
    2835          return
    2836
    2837 -    def keys(self):
    2838          names = []
    2839          for i in range(self.GetFieldCount()):
    2840              fieldname = self.GetFieldDefnRef(i).GetName()
    2841              names.append(fieldname)
    2842          return names
    2843
    2844 -    def items(self):
    2845          keys = self.keys()
    2846          output = {}
    2847          for key in keys:
    2848              output[key] = self.GetField(key)
    2849          return output
    2850 -    def geometry(self):
    2851          return self.GetGeometryRef()
    2852
    2853 -    def ExportToJson(self, as_object = False, options = None):
    2854          """Exports a GeoJSON object which represents the Feature. The
    2855             as_object parameter determines whether the returned value
    2856             should be a Python object instead of a string. Defaults to False.
    2857             The options parameter is passed to Geometry.ExportToJson()"""
    2858
    2859          try:
    2860              import simplejson
    2861          except ImportError:
    2862              try:
    2863                  import json as simplejson
    2864              except ImportError:
    2865                  raise ImportError("Unable to import simplejson or json, needed for ExportToJson.")
    2866
    2867          geom = self.GetGeometryRef()
    2868          if geom is not None:
    2869              if options is None:
    2870                  options = []
    2871              geom_json_string = geom.ExportToJson(options = options)
    2872              geom_json_object = simplejson.loads(geom_json_string)
    2873          else:
    2874              geom_json_object = None
    2875
    2876          output = {'type':'Feature',
    2877                     'geometry': geom_json_object,
    2878                     'properties': {}
    2879                    }
    2880
    2881          fid = self.GetFID()
    2882          if fid:
    2883              output['id'] = fid
    2884
    2885          for key in self.keys():
    2886              output['properties'][key] = self.GetField(key)
    2887
    2888          if not as_object:
    2889              output = simplejson.dumps(output)
    2890
    2891          return output
    2892
    2893
    2894
    2895  Feature_swigregister = _ogr.Feature_swigregister
    2896  Feature_swigregister(Feature)
    2897
    2898 -class FeatureDefn(_object):
    2899      """Proxy of C++ OGRFeatureDefnShadow class"""
    2900      __swig_setmethods__ = {}
    2901      __setattr__ = lambda self, name, value: _swig_setattr(self, FeatureDefn, name, value)
    2902      __swig_getmethods__ = {}
    2903      __getattr__ = lambda self, name: _swig_getattr(self, FeatureDefn, name)
    2904      __repr__ = _swig_repr
    2905      __swig_destroy__ = _ogr.delete_FeatureDefn
    2906      __del__ = lambda self : None;
    2907 -    def __init__(self, *args, **kwargs):
    2908          """__init__(self, char name_null_ok = None) -> FeatureDefn"""
    2909          this = _ogr.new_FeatureDefn(*args, **kwargs)
    2910          try: self.this.append(this)
    2911          except: self.this = this
    2912 -    def GetName(self, *args):
    2913          """
    2914          GetName(self) -> char
    2915
    2916          const char*
    2917          OGR_FD_GetName(OGRFeatureDefnH hDefn)
    2918
    2919          Get name of the OGRFeatureDefn passed as an argument.
    2920
    2921          This function is the same as the C++ method OGRFeatureDefn::GetName().
    2922
    2923          Parameters:
    2924          -----------
    2925
    2926          hDefn:  handle to the feature definition to get the name from.
    2927
    2928          the name. This name is internal and should not be modified, or freed.
    2929
    2930          """
    2931          return _ogr.FeatureDefn_GetName(self, *args)
    2932
    2933 -    def GetFieldCount(self, *args):
    2934          """
    2935          GetFieldCount(self) -> int
    2936
    2937          int
    2938          OGR_FD_GetFieldCount(OGRFeatureDefnH hDefn)
    2939
    2940          Fetch number of fields on the passed feature definition.
    2941
    2942          This function is the same as the C++ OGRFeatureDefn::GetFieldCount().
    2943
    2944          Parameters:
    2945          -----------
    2946
    2947          hDefn:  handle to the feature definition to get the fields count from.
    2948
    2949          count of fields.
    2950          """
    2951          return _ogr.FeatureDefn_GetFieldCount(self, *args)
    2952
    2953 -    def GetFieldDefn(self, *args):
    2954          """
    2955          GetFieldDefn(self, int i) -> FieldDefn
    2956
    2957          OGRFieldDefnH
    2958          OGR_FD_GetFieldDefn(OGRFeatureDefnH hDefn, int iField)
    2959
    2960          Fetch field definition of the passed feature definition.
    2961
    2962          This function is the same as the C++ method
    2963          OGRFeatureDefn::GetFieldDefn().
    2964
    2965          Starting with GDAL 1.7.0, this method will also issue an error if the
    2966          index is not valid.
    2967
    2968          Parameters:
    2969          -----------
    2970
    2971          hDefn:  handle to the feature definition to get the field definition
    2972          from.
    2973
    2974          iField:  the field to fetch, between 0 and GetFieldCount()-1.
    2975
    2976          an handle to an internal field definition object or NULL if invalid
    2977          index. This object should not be modified or freed by the application.
    2978
    2979          """
    2980          return _ogr.FeatureDefn_GetFieldDefn(self, *args)
    2981
    2982 -    def GetFieldIndex(self, *args):
    2983          """
    2984          GetFieldIndex(self, char name) -> int
    2985
    2986          int
    2987          OGR_FD_GetFieldIndex(OGRFeatureDefnH hDefn, const char *pszFieldName)
    2988
    2989          Find field by name.
    2990
    2991          The field index of the first field matching the passed field name
    2992          (case insensitively) is returned.
    2993
    2994          This function is the same as the C++ method
    2995          OGRFeatureDefn::GetFieldIndex.
    2996
    2997          Parameters:
    2998          -----------
    2999
    3000          hDefn:  handle to the feature definition to get field index from.
    3001
    3002          pszFieldName:  the field name to search for.
    3003
    3004          the field index, or -1 if no match found.
    3005          """
    3006          return _ogr.FeatureDefn_GetFieldIndex(self, *args)
    3007
    3008 -    def AddFieldDefn(self, *args):
    3009          """
    3010          AddFieldDefn(self, FieldDefn defn)
    3011
    3012          void
    3013          OGR_FD_AddFieldDefn(OGRFeatureDefnH hDefn, OGRFieldDefnH hNewField)
    3014
    3015          Add a new field definition to the passed feature definition.
    3016
    3017          To add a new field definition to a layer definition, do not use this
    3018          function directly, but use OGR_L_CreateField() instead.
    3019
    3020          This function should only be called while there are no OGRFeature
    3021          objects in existance based on this OGRFeatureDefn. The OGRFieldDefn
    3022          passed in is copied, and remains the responsibility of the caller.
    3023
    3024          This function is the same as the C++ method
    3025          OGRFeatureDefn::AddFieldDefn().
    3026
    3027          Parameters:
    3028          -----------
    3029
    3030          hDefn:  handle to the feature definition to add the field definition
    3031          to.
    3032
    3033          hNewField:  handle to the new field definition.
    3034          """
    3035          return _ogr.FeatureDefn_AddFieldDefn(self, *args)
    3036
    3037 -    def GetGeomType(self, *args):
    3038          """
    3039          GetGeomType(self) -> OGRwkbGeometryType
    3040
    3041          OGRwkbGeometryType
    3042          OGR_FD_GetGeomType(OGRFeatureDefnH hDefn)
    3043
    3044          Fetch the geometry base type of the passed feature definition.
    3045
    3046          This function is the same as the C++ method
    3047          OGRFeatureDefn::GetGeomType().
    3048
    3049          Parameters:
    3050          -----------
    3051
    3052          hDefn:  handle to the feature definition to get the geometry type
    3053          from.
    3054
    3055          the base type for all geometry related to this definition.
    3056          """
    3057          return _ogr.FeatureDefn_GetGeomType(self, *args)
    3058
    3059 -    def SetGeomType(self, *args):
    3060          """
    3061          SetGeomType(self, OGRwkbGeometryType geom_type)
    3062
    3063          void
    3064          OGR_FD_SetGeomType(OGRFeatureDefnH hDefn, OGRwkbGeometryType eType)
    3065
    3066          Assign the base geometry type for the passed layer (the same as the
    3067          feature definition).
    3068
    3069          All geometry objects using this type must be of the defined type or a
    3070          derived type. The default upon creation is wkbUnknown which allows for
    3071          any geometry type. The geometry type should generally not be changed
    3072          after any OGRFeatures have been created against this definition.
    3073
    3074          This function is the same as the C++ method
    3075          OGRFeatureDefn::SetGeomType().
    3076
    3077          Parameters:
    3078          -----------
    3079
    3080          hDefn:  handle to the layer or feature definition to set the geometry
    3081          type to.
    3082
    3083          eType:  the new type to assign.
    3084          """
    3085          return _ogr.FeatureDefn_SetGeomType(self, *args)
    3086
    3087 -    def GetReferenceCount(self, *args):
    3088          """
    3089          GetReferenceCount(self) -> int
    3090
    3091          int
    3092          OGR_FD_GetReferenceCount(OGRFeatureDefnH hDefn)
    3093
    3094          Fetch current reference count.
    3095
    3096          This function is the same as the C++ method
    3097          OGRFeatureDefn::GetReferenceCount().
    3098
    3099          Parameters:
    3100          -----------
    3101
    3102          hDefn:  hanlde to the feature definition on witch OGRFeature are based
    3103          on.
    3104
    3105          the current reference count.
    3106          """
    3107          return _ogr.FeatureDefn_GetReferenceCount(self, *args)
    3108
    3109 -    def IsGeometryIgnored(self, *args):
    3110          """
    3111          IsGeometryIgnored(self) -> int
    3112
    3113          int
    3114          OGR_FD_IsGeometryIgnored(OGRFeatureDefnH hDefn)
    3115
    3116          Determine whether the geometry can be omitted when fetching features.
    3117
    3118          This function is the same as the C++ method
    3119          OGRFeatureDefn::IsGeometryIgnored().
    3120
    3121          Parameters:
    3122          -----------
    3123
    3124          hDefn:  hanlde to the feature definition on witch OGRFeature are based
    3125          on.
    3126
    3127          ignore state
    3128          """
    3129          return _ogr.FeatureDefn_IsGeometryIgnored(self, *args)
    3130
    3131 -    def SetGeometryIgnored(self, *args):
    3132          """
    3133          SetGeometryIgnored(self, int bIgnored)
    3134
    3135          void
    3136          OGR_FD_SetGeometryIgnored(OGRFeatureDefnH hDefn, int bIgnore)
    3137
    3138          Set whether the geometry can be omitted when fetching features.
    3139
    3140          This function is the same as the C++ method
    3141          OGRFeatureDefn::SetGeometryIgnored().
    3142
    3143          Parameters:
    3144          -----------
    3145
    3146          hDefn:  hanlde to the feature definition on witch OGRFeature are based
    3147          on.
    3148
    3149          bIgnore:  ignore state
    3150          """
    3151          return _ogr.FeatureDefn_SetGeometryIgnored(self, *args)
    3152
    3153 -    def IsStyleIgnored(self, *args):
    3154          """
    3155          IsStyleIgnored(self) -> int
    3156
    3157          int
    3158          OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn)
    3159
    3160          Determine whether the style can be omitted when fetching features.
    3161
    3162          This function is the same as the C++ method
    3163          OGRFeatureDefn::IsStyleIgnored().
    3164
    3165          Parameters:
    3166          -----------
    3167
    3168          hDefn:  handle to the feature definition on which OGRFeature are based
    3169          on.
    3170
    3171          ignore state
    3172          """
    3173          return _ogr.FeatureDefn_IsStyleIgnored(self, *args)
    3174
    3175 -    def SetStyleIgnored(self, *args):
    3176          """
    3177          SetStyleIgnored(self, int bIgnored)
    3178
    3179          void
    3180          OGR_FD_SetStyleIgnored(OGRFeatureDefnH hDefn, int bIgnore)
    3181
    3182          Set whether the style can be omitted when fetching features.
    3183
    3184          This function is the same as the C++ method
    3185          OGRFeatureDefn::SetStyleIgnored().
    3186
    3187          Parameters:
    3188          -----------
    3189
    3190          hDefn:  hanlde to the feature definition on witch OGRFeature are based
    3191          on.
    3192
    3193          bIgnore:  ignore state
    3194          """
    3195          return _ogr.FeatureDefn_SetStyleIgnored(self, *args)
    3196
    3197 -    def Destroy(self):
    3198        "Once called, self has effectively been destroyed.  Do not access. For backwards compatiblity only"
    3199        _ogr.delete_FeatureDefn( self )
    3200        self.thisown = 0
    3201
    3202
    3203  FeatureDefn_swigregister = _ogr.FeatureDefn_swigregister
    3204  FeatureDefn_swigregister(FeatureDefn)
    3205
    3206 -class FieldDefn(_object):
    3207      """Proxy of C++ OGRFieldDefnShadow class"""
    3208      __swig_setmethods__ = {}
    3209      __setattr__ = lambda self, name, value: _swig_setattr(self, FieldDefn, name, value)
    3210      __swig_getmethods__ = {}
    3211      __getattr__ = lambda self, name: _swig_getattr(self, FieldDefn, name)
    3212      __repr__ = _swig_repr
    3213      __swig_destroy__ = _ogr.delete_FieldDefn
    3214      __del__ = lambda self : None;
    3215 -    def __init__(self, *args, **kwargs):
    3216          """__init__(self, char name_null_ok = "unnamed", OGRFieldType field_type = OFTString) -> FieldDefn"""
    3217          this = _ogr.new_FieldDefn(*args, **kwargs)
    3218          try: self.this.append(this)
    3219          except: self.this = this
    3220 -    def GetName(self, *args):
    3221          """GetName(self) -> char"""
    3222          return _ogr.FieldDefn_GetName(self, *args)
    3223
    3224 -    def GetNameRef(self, *args):
    3225          """
    3226          GetNameRef(self) -> char
    3227
    3228          const char*
    3229          OGR_Fld_GetNameRef(OGRFieldDefnH hDefn)
    3230
    3231          Fetch name of this field.
    3232
    3233          This function is the same as the CPP method
    3234          OGRFieldDefn::GetNameRef().
    3235
    3236          Parameters:
    3237          -----------
    3238
    3239          hDefn:  handle to the field definition.
    3240
    3241          the name of the field definition.
    3242          """
    3243          return _ogr.FieldDefn_GetNameRef(self, *args)
    3244
    3245 -    def SetName(self, *args):
    3246          """
    3247          SetName(self, char name)
    3248
    3249          void OGR_Fld_SetName(OGRFieldDefnH
    3250          hDefn, const char *pszName)
    3251
    3252          Reset the name of this field.
    3253
    3254          This function is the same as the CPP method OGRFieldDefn::SetName().
    3255
    3256          Parameters:
    3257          -----------
    3258
    3259          hDefn:  handle to the field definition to apply the new name to.
    3260
    3261          pszName:  the new name to apply.
    3262          """
    3263          return _ogr.FieldDefn_SetName(self, *args)
    3264
    3265 -    def GetType(self, *args):
    3266          """
    3267          GetType(self) -> OGRFieldType
    3268
    3269          OGRFieldType
    3270          OGR_Fld_GetType(OGRFieldDefnH hDefn)
    3271
    3272          Fetch type of this field.
    3273
    3274          This function is the same as the CPP method OGRFieldDefn::GetType().
    3275
    3276          Parameters:
    3277          -----------
    3278
    3279          hDefn:  handle to the field definition to get type from.
    3280
    3281          field type.
    3282          """
    3283          return _ogr.FieldDefn_GetType(self, *args)
    3284
    3285 -    def SetType(self, *args):
    3286          """
    3287          SetType(self, OGRFieldType type)
    3288
    3289          void OGR_Fld_SetType(OGRFieldDefnH
    3290          hDefn, OGRFieldType eType)
    3291
    3292          Set the type of this field. This should never be done to an
    3293          OGRFieldDefn that is already part of an OGRFeatureDefn.
    3294
    3295          This function is the same as the CPP method OGRFieldDefn::SetType().
    3296
    3297          Parameters:
    3298          -----------
    3299
    3300          hDefn:  handle to the field definition to set type to.
    3301
    3302          eType:  the new field type.
    3303          """
    3304          return _ogr.FieldDefn_SetType(self, *args)
    3305
    3306 -    def GetJustify(self, *args):
    3307          """
    3308          GetJustify(self) -> OGRJustification
    3309
    3310          OGRJustification
    3311          OGR_Fld_GetJustify(OGRFieldDefnH hDefn)
    3312
    3313          Get the justification for this field.
    3314
    3315          This function is the same as the CPP method
    3316          OGRFieldDefn::GetJustify().
    3317
    3318          Parameters:
    3319          -----------
    3320
    3321          hDefn:  handle to the field definition to get justification from.
    3322
    3323          the justification.
    3324          """
    3325          return _ogr.FieldDefn_GetJustify(self, *args)
    3326
    3327 -    def SetJustify(self, *args):
    3328          """
    3329          SetJustify(self, OGRJustification justify)
    3330
    3331          void
    3332          OGR_Fld_SetJustify(OGRFieldDefnH hDefn, OGRJustification eJustify)
    3333
    3334          Set the justification for this field.
    3335
    3336          This function is the same as the CPP method
    3337          OGRFieldDefn::SetJustify().
    3338
    3339          Parameters:
    3340          -----------
    3341
    3342          hDefn:  handle to the field definition to set justification to.
    3343
    3344          eJustify:  the new justification.
    3345          """
    3346          return _ogr.FieldDefn_SetJustify(self, *args)
    3347
    3348 -    def GetWidth(self, *args):
    3349          """
    3350          GetWidth(self) -> int
    3351
    3352          int OGR_Fld_GetWidth(OGRFieldDefnH
    3353          hDefn)
    3354
    3355          Get the formatting width for this field.
    3356
    3357          This function is the same as the CPP method OGRFieldDefn::GetWidth().
    3358
    3359          Parameters:
    3360          -----------
    3361
    3362          hDefn:  handle to the field definition to get width from.
    3363
    3364          the width, zero means no specified width.
    3365          """
    3366          return _ogr.FieldDefn_GetWidth(self, *args)
    3367
    3368 -    def SetWidth(self, *args):
    3369          """
    3370          SetWidth(self, int width)
    3371
    3372          void OGR_Fld_SetWidth(OGRFieldDefnH
    3373          hDefn, int nNewWidth)
    3374
    3375          Set the formatting width for this field in characters.
    3376
    3377          This function is the same as the CPP method OGRFieldDefn::SetWidth().
    3378
    3379          Parameters:
    3380          -----------
    3381
    3382          hDefn:  handle to the field definition to set width to.
    3383
    3384          nNewWidth:  the new width.
    3385          """
    3386          return _ogr.FieldDefn_SetWidth(self, *args)
    3387
    3388 -    def GetPrecision(self, *args):
    3389          """
    3390          GetPrecision(self) -> int
    3391
    3392          int
    3393          OGR_Fld_GetPrecision(OGRFieldDefnH hDefn)
    3394
    3395          Get the formatting precision for this field. This should normally be
    3396          zero for fields of types other than OFTReal.
    3397
    3398          This function is the same as the CPP method
    3399          OGRFieldDefn::GetPrecision().
    3400
    3401          Parameters:
    3402          -----------
    3403
    3404          hDefn:  handle to the field definition to get precision from.
    3405
    3406          the precision.
    3407          """
    3408          return _ogr.FieldDefn_GetPrecision(self, *args)
    3409
    3410 -    def SetPrecision(self, *args):
    3411          """
    3412          SetPrecision(self, int precision)
    3413
    3414          void
    3415          OGR_Fld_SetPrecision(OGRFieldDefnH hDefn, int nPrecision)
    3416
    3417          Set the formatting precision for this field in characters.
    3418
    3419          This should normally be zero for fields of types other than OFTReal.
    3420
    3421          This function is the same as the CPP method
    3422          OGRFieldDefn::SetPrecision().
    3423
    3424          Parameters:
    3425          -----------
    3426
    3427          hDefn:  handle to the field definition to set precision to.
    3428
    3429          nPrecision:  the new precision.
    3430          """
    3431          return _ogr.FieldDefn_SetPrecision(self, *args)
    3432
    3433 -    def GetTypeName(self, *args):
    3434          """GetTypeName(self) -> char"""
    3435          return _ogr.FieldDefn_GetTypeName(self, *args)
    3436
    3437 -    def GetFieldTypeName(self, *args):
    3438          """GetFieldTypeName(self, OGRFieldType type) -> char"""
    3439          return _ogr.FieldDefn_GetFieldTypeName(self, *args)
    3440
    3441 -    def IsIgnored(self, *args):
    3442          """
    3443          IsIgnored(self) -> int
    3444
    3445          int OGR_Fld_IsIgnored(OGRFieldDefnH
    3446          hDefn)
    3447
    3448          Return whether this field should be omitted when fetching features.
    3449
    3450          This method is the same as the C++ method OGRFieldDefn::IsIgnored().
    3451
    3452          Parameters:
    3453          -----------
    3454
    3455          hDefn:  handle to the field definition
    3456
    3457          ignore state
    3458          """
    3459          return _ogr.FieldDefn_IsIgnored(self, *args)
    3460
    3461 -    def SetIgnored(self, *args):
    3462          """
    3463          SetIgnored(self, int bIgnored)
    3464
    3465          void
    3466          OGR_Fld_SetIgnored(OGRFieldDefnH hDefn, int ignore)
    3467
    3468          Set whether this field should be omitted when fetching features.
    3469
    3470          This method is the same as the C function OGRFieldDefn::SetIgnored().
    3471
    3472          Parameters:
    3473          -----------
    3474
    3475          hDefn:  handle to the field definition
    3476
    3477          ignore:  ignore state
    3478          """
    3479          return _ogr.FieldDefn_SetIgnored(self, *args)
    3480
    3481      width = property(GetWidth, SetWidth)
    3482      type = property(GetType, SetType)
    3483      precision = property(GetPrecision, SetPrecision)
    3484      name = property(GetName, SetName)
    3485      justify = property(GetJustify, SetJustify)
    3486
    3487 -    def Destroy(self):
    3488        "Once called, self has effectively been destroyed.  Do not access. For backwards compatiblity only"
    3489        _ogr.delete_FieldDefn( self )
    3490        self.thisown = 0
    3491
    3492  FieldDefn_swigregister = _ogr.FieldDefn_swigregister
    3493  FieldDefn_swigregister(FieldDefn)
    3494
    3495
    3496 -def CreateGeometryFromWkb(*args, **kwargs):
    3497    """CreateGeometryFromWkb(int len, SpatialReference reference = None) -> Geometry"""
    3498    return _ogr.CreateGeometryFromWkb(*args, **kwargs)
    3499
    3500 -def CreateGeometryFromWkt(*args, **kwargs):
    3501    """CreateGeometryFromWkt(char val, SpatialReference reference = None) -> Geometry"""
    3502    return _ogr.CreateGeometryFromWkt(*args, **kwargs)
    3503
    3504 -def CreateGeometryFromGML(*args):
    3505    """CreateGeometryFromGML(char input_string) -> Geometry"""
    3506    return _ogr.CreateGeometryFromGML(*args)
    3507
    3508 -def CreateGeometryFromJson(*args):
    3509    """CreateGeometryFromJson(char input_string) -> Geometry"""
    3510    return _ogr.CreateGeometryFromJson(*args)
    3511
    3512 -def BuildPolygonFromEdges(*args, **kwargs):
    3513    """
    3514      BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort = 0, int bAutoClose = 0,
    3515          double dfTolerance = 0) -> Geometry
    3516      """
    3517    return _ogr.BuildPolygonFromEdges(*args, **kwargs)
    3518
    3519 -def ApproximateArcAngles(*args, **kwargs):
    3520    """
    3521      ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius,
    3522          double dfSecondaryAxis,
    3523          double dfRotation, double dfStartAngle, double dfEndAngle,
    3524          double dfMaxAngleStepSizeDegrees) -> Geometry
    3525      """
    3526    return _ogr.ApproximateArcAngles(*args, **kwargs)
    3527
    3528 -def ForceToPolygon(*args):
    3529    """ForceToPolygon(Geometry geom_in) -> Geometry"""
    3530    return _ogr.ForceToPolygon(*args)
    3531
    3532 -def ForceToMultiPolygon(*args):
    3533    """ForceToMultiPolygon(Geometry geom_in) -> Geometry"""
    3534    return _ogr.ForceToMultiPolygon(*args)
    3535
    3536 -def ForceToMultiPoint(*args):
    3537    """ForceToMultiPoint(Geometry geom_in) -> Geometry"""
    3538    return _ogr.ForceToMultiPoint(*args)
    3539
    3540 -def ForceToMultiLineString(*args):
    3541    """ForceToMultiLineString(Geometry geom_in) -> Geometry"""
    3542    return _ogr.ForceToMultiLineString(*args)
    3543 -class Geometry(_object):
    3544      """Proxy of C++ OGRGeometryShadow class"""
    3545      __swig_setmethods__ = {}
    3546      __setattr__ = lambda self, name, value: _swig_setattr(self, Geometry, name, value)
    3547      __swig_getmethods__ = {}
    3548      __getattr__ = lambda self, name: _swig_getattr(self, Geometry, name)
    3549      __repr__ = _swig_repr
    3550      __swig_destroy__ = _ogr.delete_Geometry
    3551      __del__ = lambda self : None;
    3552 -    def __init__(self, *args, **kwargs):
    3553          """
    3554          __init__(self, OGRwkbGeometryType type = wkbUnknown, char wkt = None,
    3555              int wkb = 0, char gml = None) -> Geometry
    3556          """
    3557          this = _ogr.new_Geometry(*args, **kwargs)
    3558          try: self.this.append(this)
    3559          except: self.this = this
    3560 -    def ExportToWkt(self, *args):
    3561          """
    3562          ExportToWkt(self) -> OGRErr
    3563
    3564          OGRErr
    3565          OGR_G_ExportToWkt(OGRGeometryH hGeom, char **ppszSrcText)
    3566
    3567          Convert a geometry into well known text format.
    3568
    3569          This function relates to the SFCOM IWks::ExportToWKT() method.
    3570
    3571          This function is the same as the CPP method
    3572          OGRGeometry::exportToWkt().
    3573
    3574          Parameters:
    3575          -----------
    3576
    3577          hGeom:  handle on the geometry to convert to a text format from.
    3578
    3579          ppszSrcText:  a text buffer is allocated by the program, and assigned
    3580          to the passed pointer.
    3581
    3582          Currently OGRERR_NONE is always returned.
    3583          """
    3584          return _ogr.Geometry_ExportToWkt(self, *args)
    3585
    3586 -    def ExportToWkb(self, *args, **kwargs):
    3587          """
    3588          ExportToWkb(self, OGRwkbByteOrder byte_order = wkbXDR) -> OGRErr
    3589
    3590          OGRErr
    3591          OGR_G_ExportToWkb(OGRGeometryH hGeom, OGRwkbByteOrder eOrder, unsigned
    3592          char *pabyDstBuffer)
    3593
    3594          Convert a geometry into well known binary format.
    3595
    3596          This function relates to the SFCOM IWks::ExportToWKB() method.
    3597
    3598          This function is the same as the CPP method
    3599          OGRGeometry::exportToWkb().
    3600
    3601          Parameters:
    3602          -----------
    3603
    3604          hGeom:  handle on the geometry to convert to a well know binary data
    3605          from.
    3606
    3607          eOrder:  One of wkbXDR or wkbNDR indicating MSB or LSB byte order
    3608          respectively.
    3609
    3610          pabyDstBuffer:  a buffer into which the binary representation is
    3611          written. This buffer must be at least OGR_G_WkbSize() byte in size.
    3612
    3613          Currently OGRERR_NONE is always returned.
    3614          """
    3615          return _ogr.Geometry_ExportToWkb(self, *args, **kwargs)
    3616
    3617 -    def ExportToGML(self, *args, **kwargs):
    3618          """ExportToGML(self, char options = None) -> retStringAndCPLFree"""
    3619          return _ogr.Geometry_ExportToGML(self, *args, **kwargs)
    3620
    3621 -    def ExportToKML(self, *args):
    3622          """ExportToKML(self, char altitude_mode = None) -> retStringAndCPLFree"""
    3623          return _ogr.Geometry_ExportToKML(self, *args)
    3624
    3625 -    def ExportToJson(self, *args, **kwargs):
    3626          """ExportToJson(self, char options = None) -> retStringAndCPLFree"""
    3627          return _ogr.Geometry_ExportToJson(self, *args, **kwargs)
    3628
    3629 -    def AddPoint(self, *args, **kwargs):
    3630          """AddPoint(self, double x, double y, double z = 0)"""
    3631          return _ogr.Geometry_AddPoint(self, *args, **kwargs)
    3632
    3633 -    def AddPoint_2D(self, *args):
    3634          """AddPoint_2D(self, double x, double y)"""
    3635          return _ogr.Geometry_AddPoint_2D(self, *args)
    3636
    3637 -    def AddGeometryDirectly(self, *args):
    3638          """AddGeometryDirectly(self, Geometry other_disown) -> OGRErr"""
    3639          return _ogr.Geometry_AddGeometryDirectly(self, *args)
    3640
    3641 -    def AddGeometry(self, *args):
    3642          """AddGeometry(self, Geometry other) -> OGRErr"""
    3643          return _ogr.Geometry_AddGeometry(self, *args)
    3644
    3645 -    def Clone(self, *args):
    3646          """
    3647          Clone(self) -> Geometry
    3648
    3649          OGRGeometryH OGR_G_Clone(OGRGeometryH
    3650          hGeom)
    3651
    3652          Make a copy of this object.
    3653
    3654          This function relates to the SFCOM IGeometry::clone() method.
    3655
    3656          This function is the same as the CPP method OGRGeometry::clone().
    3657
    3658          Parameters:
    3659          -----------
    3660
    3661          hGeom:  handle on the geometry to clone from.
    3662
    3663          an handle on the copy of the geometry with the spatial reference
    3664          system as the original.
    3665          """
    3666          return _ogr.Geometry_Clone(self, *args)
    3667
    3668 -    def GetGeometryType(self, *args):
    3669          """
    3670          GetGeometryType(self) -> OGRwkbGeometryType
    3671
    3672          OGRwkbGeometryType
    3673          OGR_G_GetGeometryType(OGRGeometryH hGeom)
    3674
    3675          Fetch geometry type.
    3676
    3677          Note that the geometry type may include the 2.5D flag. To get a 2D
    3678          flattened version of the geometry type apply the wkbFlatten() macro to
    3679          the return result.
    3680
    3681          This function is the same as the CPP method
    3682          OGRGeometry::getGeometryType().
    3683
    3684          Parameters:
    3685          -----------
    3686
    3687          hGeom:  handle on the geometry to get type from.
    3688
    3689          the geometry type code.
    3690          """
    3691          return _ogr.Geometry_GetGeometryType(self, *args)
    3692
    3693 -    def GetGeometryName(self, *args):
    3694          """
    3695          GetGeometryName(self) -> char
    3696
    3697          const char*
    3698          OGR_G_GetGeometryName(OGRGeometryH hGeom)
    3699
    3700          Fetch WKT name for geometry type.
    3701
    3702          There is no SFCOM analog to this function.
    3703
    3704          This function is the same as the CPP method
    3705          OGRGeometry::getGeometryName().
    3706
    3707          Parameters:
    3708          -----------
    3709
    3710          hGeom:  handle on the geometry to get name from.
    3711
    3712          name used for this geometry type in well known text format.
    3713          """
    3714          return _ogr.Geometry_GetGeometryName(self, *args)
    3715
    3716 -    def Length(self, *args):
    3717          """Length(self) -> double"""
    3718          return _ogr.Geometry_Length(self, *args)
    3719
    3720 -    def Area(self, *args):
    3721          """Area(self) -> double"""
    3722          return _ogr.Geometry_Area(self, *args)
    3723
    3724 -    def GetArea(self, *args):
    3725          """GetArea(self) -> double"""
    3726          return _ogr.Geometry_GetArea(self, *args)
    3727
    3728 -    def GetPointCount(self, *args):
    3729          """GetPointCount(self) -> int"""
    3730          return _ogr.Geometry_GetPointCount(self, *args)
    3731
    3732 -    def GetPoints(self, *args, **kwargs):
    3733          """GetPoints(self, int nCoordDimension = 0)"""
    3734          return _ogr.Geometry_GetPoints(self, *args, **kwargs)
    3735
    3736 -    def GetX(self, *args, **kwargs):
    3737          """GetX(self, int point = 0) -> double"""
    3738          return _ogr.Geometry_GetX(self, *args, **kwargs)
    3739
    3740 -    def GetY(self, *args, **kwargs):
    3741          """GetY(self, int point = 0) -> double"""
    3742          return _ogr.Geometry_GetY(self, *args, **kwargs)
    3743
    3744 -    def GetZ(self, *args, **kwargs):
    3745          """GetZ(self, int point = 0) -> double"""
    3746          return _ogr.Geometry_GetZ(self, *args, **kwargs)
    3747
    3748 -    def GetPoint(self, *args):
    3749          """GetPoint(self, int iPoint = 0)"""
    3750          return _ogr.Geometry_GetPoint(self, *args)
    3751
    3752 -    def GetPoint_2D(self, *args):
    3753          """GetPoint_2D(self, int iPoint = 0)"""
    3754          return _ogr.Geometry_GetPoint_2D(self, *args)
    3755
    3756 -    def GetGeometryCount(self, *args):
    3757          """GetGeometryCount(self) -> int"""
    3758          return _ogr.Geometry_GetGeometryCount(self, *args)
    3759
    3760 -    def SetPoint(self, *args, **kwargs):
    3761          """SetPoint(self, int point, double x, double y, double z = 0)"""
    3762          return _ogr.Geometry_SetPoint(self, *args, **kwargs)
    3763
    3764 -    def SetPoint_2D(self, *args, **kwargs):
    3765          """SetPoint_2D(self, int point, double x, double y)"""
    3766          return _ogr.Geometry_SetPoint_2D(self, *args, **kwargs)
    3767
    3768 -    def GetGeometryRef(self, *args):
    3769          """GetGeometryRef(self, int geom) -> Geometry"""
    3770          return _ogr.Geometry_GetGeometryRef(self, *args)
    3771
    3772 -    def Simplify(self, *args):
    3773          """
    3774          Simplify(self, double tolerance) -> Geometry
    3775
    3776          OGRGeometryH
    3777          OGR_G_Simplify(OGRGeometryH hThis, double dTolerance)
    3778
    3779          Compute a simplified geometry.
    3780
    3781          This function is the same as the C++ method OGRGeometry::Simplify().
    3782
    3783          This function is built on the GEOS library, check it for the
    3784          definition of the geometry operation. If OGR is built without the GEOS
    3785          library, this function will always fail, issuing a CPLE_NotSupported
    3786          error.
    3787
    3788          Parameters:
    3789          -----------
    3790
    3791          hThis:  the geometry.
    3792
    3793          dTolerance:  the distance tolerance for the simplification.
    3794
    3795          the simplified geometry or NULL if an error occurs.
    3796
    3797          OGR 1.8.0
    3798          """
    3799          return _ogr.Geometry_Simplify(self, *args)
    3800
    3801 -    def SimplifyPreserveTopology(self, *args):
    3802          """
    3803          SimplifyPreserveTopology(self, double tolerance) -> Geometry
    3804
    3805          OGRGeometryH
    3806          OGR_G_SimplifyPreserveTopology(OGRGeometryH hThis, double dTolerance)
    3807
    3808          Compute a simplified geometry.
    3809
    3810          This function is the same as the C++ method
    3811          OGRGeometry::SimplifyPreserveTopology().
    3812
    3813          This function is built on the GEOS library, check it for the
    3814          definition of the geometry operation. If OGR is built without the GEOS
    3815          library, this function will always fail, issuing a CPLE_NotSupported
    3816          error.
    3817
    3818          Parameters:
    3819          -----------
    3820
    3821          hThis:  the geometry.
    3822
    3823          dTolerance:  the distance tolerance for the simplification.
    3824
    3825          the simplified geometry or NULL if an error occurs.
    3826
    3827          OGR 1.9.0
    3828          """
    3829          return _ogr.Geometry_SimplifyPreserveTopology(self, *args)
    3830
    3831 -    def Boundary(self, *args):
    3832          """
    3833          Boundary(self) -> Geometry
    3834
    3835          OGRGeometryH
    3836          OGR_G_Boundary(OGRGeometryH hTarget)
    3837
    3838          Compute boundary.
    3839
    3840          A new geometry object is created and returned containing the boundary
    3841          of the geometry on which the method is invoked.
    3842
    3843          This function is the same as the C++ method OGR_G_Boundary().
    3844
    3845          This function is built on the GEOS library, check it for the
    3846          definition of the geometry operation. If OGR is built without the GEOS
    3847          library, this function will always fail, issuing a CPLE_NotSupported
    3848          error.
    3849
    3850          Parameters:
    3851          -----------
    3852
    3853          hTarget:  The Geometry to calculate the boundary of.
    3854
    3855          a handle to a newly allocated geometry now owned by the caller, or
    3856          NULL on failure.
    3857
    3858          OGR 1.8.0
    3859          """
    3860          return _ogr.Geometry_Boundary(self, *args)
    3861
    3862 -    def GetBoundary(self, *args):
    3863          """
    3864          GetBoundary(self) -> Geometry
    3865
    3866          OGRGeometryH
    3867          OGR_G_GetBoundary(OGRGeometryH hTarget)
    3868
    3869          Compute boundary (deprecated).
    3870
    3871          Deprecated See:   OGR_G_Boundary()
    3872          """
    3873          return _ogr.Geometry_GetBoundary(self, *args)
    3874
    3875 -    def ConvexHull(self, *args):
    3876          """
    3877          ConvexHull(self) -> Geometry
    3878
    3879          OGRGeometryH
    3880          OGR_G_ConvexHull(OGRGeometryH hTarget)
    3881
    3882          Compute convex hull.
    3883
    3884          A new geometry object is created and returned containing the convex
    3885          hull of the geometry on which the method is invoked.
    3886
    3887          This function is the same as the C++ method OGRGeometry::ConvexHull().
    3888
    3889          This function is built on the GEOS library, check it for the
    3890          definition of the geometry operation. If OGR is built without the GEOS
    3891          library, this function will always fail, issuing a CPLE_NotSupported
    3892          error.
    3893
    3894          Parameters:
    3895          -----------
    3896
    3897          hTarget:  The Geometry to calculate the convex hull of.
    3898
    3899          a handle to a newly allocated geometry now owned by the caller, or
    3900          NULL on failure.
    3901          """
    3902          return _ogr.Geometry_ConvexHull(self, *args)
    3903
    3904 -    def Buffer(self, *args, **kwargs):
    3905          """
    3906          Buffer(self, double distance, int quadsecs = 30) -> Geometry
    3907
    3908          OGRGeometryH OGR_G_Buffer(OGRGeometryH
    3909          hTarget, double dfDist, int nQuadSegs)
    3910
    3911          Compute buffer of geometry.
    3912
    3913          Builds a new geometry containing the buffer region around the geometry
    3914          on which it is invoked. The buffer is a polygon containing the region
    3915          within the buffer distance of the original geometry.
    3916
    3917          Some buffer sections are properly described as curves, but are
    3918          converted to approximate polygons. The nQuadSegs parameter can be used
    3919          to control how many segements should be used to define a 90 degree
    3920          curve - a quadrant of a circle. A value of 30 is a reasonable default.
    3921          Large values result in large numbers of vertices in the resulting
    3922          buffer geometry while small numbers reduce the accuracy of the result.
    3923
    3924          This function is the same as the C++ method OGRGeometry::Buffer().
    3925
    3926          This function is built on the GEOS library, check it for the
    3927          definition of the geometry operation. If OGR is built without the GEOS
    3928          library, this function will always fail, issuing a CPLE_NotSupported
    3929          error.
    3930
    3931          Parameters:
    3932          -----------
    3933
    3934          hTarget:  the geometry.
    3935
    3936          dfDist:  the buffer distance to be applied.
    3937
    3938          nQuadSegs:  the number of segments used to approximate a 90 degree
    3939          (quadrant) of curvature.
    3940
    3941          the newly created geometry, or NULL if an error occurs.
    3942          """
    3943          return _ogr.Geometry_Buffer(self, *args, **kwargs)
    3944
    3945 -    def Intersection(self, *args):
    3946          """
    3947          Intersection(self, Geometry other) -> Geometry
    3948
    3949          OGRGeometryH
    3950          OGR_G_Intersection(OGRGeometryH hThis, OGRGeometryH hOther)
    3951
    3952          Compute intersection.
    3953
    3954          Generates a new geometry which is the region of intersection of the
    3955          two geometries operated on. The OGR_G_Intersects() function can be
    3956          used to test if two geometries intersect.
    3957
    3958          This function is the same as the C++ method
    3959          OGRGeometry::Intersection().
    3960
    3961          This function is built on the GEOS library, check it for the
    3962          definition of the geometry operation. If OGR is built without the GEOS
    3963          library, this function will always fail, issuing a CPLE_NotSupported
    3964          error.
    3965
    3966          Parameters:
    3967          -----------
    3968
    3969          hThis:  the geometry.
    3970
    3971          hOther:  the other geometry.
    3972
    3973          a new geometry representing the intersection or NULL if there is no
    3974          intersection or an error occurs.
    3975          """
    3976          return _ogr.Geometry_Intersection(self, *args)
    3977
    3978 -    def Union(self, *args):
    3979          """
    3980          Union(self, Geometry other) -> Geometry
    3981
    3982          OGRGeometryH OGR_G_Union(OGRGeometryH
    3983          hThis, OGRGeometryH hOther)
    3984
    3985          Compute union.
    3986
    3987          Generates a new geometry which is the region of union of the two
    3988          geometries operated on.
    3989
    3990          This function is the same as the C++ method OGRGeometry::Union().
    3991
    3992          This function is built on the GEOS library, check it for the
    3993          definition of the geometry operation. If OGR is built without the GEOS
    3994          library, this function will always fail, issuing a CPLE_NotSupported
    3995          error.
    3996
    3997          Parameters:
    3998          -----------
    3999
    4000          hThis:  the geometry.
    4001
    4002          hOther:  the other geometry.
    4003
    4004          a new geometry representing the union or NULL if an error occurs.
    4005          """
    4006          return _ogr.Geometry_Union(self, *args)
    4007
    4008 -    def UnionCascaded(self, *args):
    4009          """
    4010          UnionCascaded(self) -> Geometry
    4011
    4012          OGRGeometryH
    4013          OGR_G_UnionCascaded(OGRGeometryH hThis)
    4014
    4015          Compute union using cascading.
    4016
    4017          This function is the same as the C++ method
    4018          OGRGeometry::UnionCascaded().
    4019
    4020          This function is built on the GEOS library, check it for the
    4021          definition of the geometry operation. If OGR is built without the GEOS
    4022          library, this function will always fail, issuing a CPLE_NotSupported
    4023          error.
    4024
    4025          Parameters:
    4026          -----------
    4027
    4028          hThis:  the geometry.
    4029
    4030          a new geometry representing the union or NULL if an error occurs.
    4031          """
    4032          return _ogr.Geometry_UnionCascaded(self, *args)
    4033
    4034 -    def Difference(self, *args):
    4035          """
    4036          Difference(self, Geometry other) -> Geometry
    4037
    4038          OGRGeometryH
    4039          OGR_G_Difference(OGRGeometryH hThis, OGRGeometryH hOther)
    4040
    4041          Compute difference.
    4042
    4043          Generates a new geometry which is the region of this geometry with the
    4044          region of the other geometry removed.
    4045
    4046          This function is the same as the C++ method OGRGeometry::Difference().
    4047
    4048          This function is built on the GEOS library, check it for the
    4049          definition of the geometry operation. If OGR is built without the GEOS
    4050          library, this function will always fail, issuing a CPLE_NotSupported
    4051          error.
    4052
    4053          Parameters:
    4054          -----------
    4055
    4056          hThis:  the geometry.
    4057
    4058          hOther:  the other geometry.
    4059
    4060          a new geometry representing the difference or NULL if the difference
    4061          is empty or an error occurs.
    4062          """
    4063          return _ogr.Geometry_Difference(self, *args)
    4064
    4065 -    def SymDifference(self, *args):
    4066          """
    4067          SymDifference(self, Geometry other) -> Geometry
    4068
    4069          OGRGeometryH
    4070          OGR_G_SymDifference(OGRGeometryH hThis, OGRGeometryH hOther)
    4071
    4072          Compute symmetric difference.
    4073
    4074          Generates a new geometry which is the symmetric difference of this
    4075          geometry and the other geometry.
    4076
    4077          This function is the same as the C++ method
    4078          OGRGeometry::SymmetricDifference().
    4079
    4080          This function is built on the GEOS library, check it for the
    4081          definition of the geometry operation. If OGR is built without the GEOS
    4082          library, this function will always fail, issuing a CPLE_NotSupported
    4083          error.
    4084
    4085          Parameters:
    4086          -----------
    4087
    4088          hThis:  the geometry.
    4089
    4090          hOther:  the other geometry.
    4091
    4092          a new geometry representing the symmetric difference or NULL if the
    4093          difference is empty or an error occurs.
    4094
    4095          OGR 1.8.0
    4096          """
    4097          return _ogr.Geometry_SymDifference(self, *args)
    4098
    4099 -    def SymmetricDifference(self, *args):
    4100          """
    4101          SymmetricDifference(self, Geometry other) -> Geometry
    4102
    4103          OGRGeometryH
    4104          OGR_G_SymmetricDifference(OGRGeometryH hThis, OGRGeometryH hOther)
    4105
    4106          Compute symmetric difference (deprecated).
    4107
    4108          Deprecated See:   OGR_G_SymmetricDifference()
    4109          """
    4110          return _ogr.Geometry_SymmetricDifference(self, *args)
    4111
    4112 -    def Distance(self, *args):
    4113          """
    4114          Distance(self, Geometry other) -> double
    4115
    4116          double OGR_G_Distance(OGRGeometryH
    4117          hFirst, OGRGeometryH hOther)
    4118
    4119          Compute distance between two geometries.
    4120
    4121          Returns the shortest distance between the two geometries.
    4122
    4123          This function is the same as the C++ method OGRGeometry::Distance().
    4124
    4125          This function is built on the GEOS library, check it for the
    4126          definition of the geometry operation. If OGR is built without the GEOS
    4127          library, this function will always fail, issuing a CPLE_NotSupported
    4128          error.
    4129
    4130          Parameters:
    4131          -----------
    4132
    4133          hFirst:  the first geometry to compare against.
    4134
    4135          hOther:  the other geometry to compare against.
    4136
    4137          the distance between the geometries or -1 if an error occurs.
    4138          """
    4139          return _ogr.Geometry_Distance(self, *args)
    4140
    4141 -    def Empty(self, *args):
    4142          """
    4143          Empty(self)
    4144
    4145          void OGR_G_Empty(OGRGeometryH hGeom)
    4146
    4147          Clear geometry information. This restores the geometry to it's initial
    4148          state after construction, and before assignment of actual geometry.
    4149
    4150          This function relates to the SFCOM IGeometry::Empty() method.
    4151
    4152          This function is the same as the CPP method OGRGeometry::empty().
    4153
    4154          Parameters:
    4155          -----------
    4156
    4157          hGeom:  handle on the geometry to empty.
    4158          """
    4159          return _ogr.Geometry_Empty(self, *args)
    4160
    4161 -    def IsEmpty(self, *args):
    4162          """
    4163          IsEmpty(self) -> bool
    4164
    4165          int OGR_G_IsEmpty(OGRGeometryH hGeom)
    4166
    4167          Test if the geometry is empty.
    4168
    4169          This method is the same as the CPP method OGRGeometry::IsEmpty().
    4170
    4171          Parameters:
    4172          -----------
    4173
    4174          hGeom:  The Geometry to test.
    4175
    4176          TRUE if the geometry has no points, otherwise FALSE.
    4177          """
    4178          return _ogr.Geometry_IsEmpty(self, *args)
    4179
    4180 -    def IsValid(self, *args):
    4181          """
    4182          IsValid(self) -> bool
    4183
    4184          int OGR_G_IsValid(OGRGeometryH hGeom)
    4185
    4186          Test if the geometry is valid.
    4187
    4188          This function is the same as the C++ method OGRGeometry::IsValid().
    4189
    4190          This function is built on the GEOS library, check it for the
    4191          definition of the geometry operation. If OGR is built without the GEOS
    4192          library, this function will always return FALSE.
    4193
    4194          Parameters:
    4195          -----------
    4196
    4197          hGeom:  The Geometry to test.
    4198
    4199          TRUE if the geometry has no points, otherwise FALSE.
    4200          """
    4201          return _ogr.Geometry_IsValid(self, *args)
    4202
    4203 -    def IsSimple(self, *args):
    4204          """
    4205          IsSimple(self) -> bool
    4206
    4207          int OGR_G_IsSimple(OGRGeometryH
    4208          hGeom)
    4209
    4210          Returns TRUE if the geometry is simple.
    4211
    4212          Returns TRUE if the geometry has no anomalous geometric points, such
    4213          as self intersection or self tangency. The description of each
    4214          instantiable geometric class will include the specific conditions that
    4215          cause an instance of that class to be classified as not simple.
    4216
    4217          This function is the same as the c++ method OGRGeometry::IsSimple()
    4218          method.
    4219
    4220          If OGR is built without the GEOS library, this function will always
    4221          return FALSE.
    4222
    4223          Parameters:
    4224          -----------
    4225
    4226          hGeom:  The Geometry to test.
    4227
    4228          TRUE if object is simple, otherwise FALSE.
    4229          """
    4230          return _ogr.Geometry_IsSimple(self, *args)
    4231
    4232 -    def IsRing(self, *args):
    4233          """
    4234          IsRing(self) -> bool
    4235
    4236          int OGR_G_IsRing(OGRGeometryH hGeom)
    4237
    4238          Test if the geometry is a ring.
    4239
    4240          This function is the same as the C++ method OGRGeometry::IsRing().
    4241
    4242          This function is built on the GEOS library, check it for the
    4243          definition of the geometry operation. If OGR is built without the GEOS
    4244          library, this function will always return FALSE.
    4245
    4246          Parameters:
    4247          -----------
    4248
    4249          hGeom:  The Geometry to test.
    4250
    4251          TRUE if the geometry has no points, otherwise FALSE.
    4252          """
    4253          return _ogr.Geometry_IsRing(self, *args)
    4254
    4255 -    def Intersects(self, *args):
    4256          """
    4257          Intersects(self, Geometry other) -> bool
    4258
    4259          int OGR_G_Intersects(OGRGeometryH
    4260          hGeom, OGRGeometryH hOtherGeom)
    4261
    4262          Do these features intersect?
    4263
    4264          Currently this is not implemented in a rigerous fashion, and generally
    4265          just tests whether the envelopes of the two features intersect.
    4266          Eventually this will be made rigerous.
    4267
    4268          This function is the same as the CPP method OGRGeometry::Intersects.
    4269
    4270          Parameters:
    4271          -----------
    4272
    4273          hGeom:  handle on the first geometry.
    4274
    4275          hOtherGeom:  handle on the other geometry to test against.
    4276
    4277          TRUE if the geometries intersect, otherwise FALSE.
    4278          """
    4279          return _ogr.Geometry_Intersects(self, *args)
    4280
    4281 -    def Intersect(self, *args):
    4282          """
    4283          Intersect(self, Geometry other) -> bool
    4284
    4285          int OGR_G_Intersect(OGRGeometryH
    4286          hGeom, OGRGeometryH hOtherGeom)
    4287          """
    4288          return _ogr.Geometry_Intersect(self, *args)
    4289
    4290 -    def Equals(self, *args):
    4291          """
    4292          Equals(self, Geometry other) -> bool
    4293
    4294          int OGR_G_Equals(OGRGeometryH hGeom,
    4295          OGRGeometryH hOther)
    4296
    4297          Returns TRUE if two geometries are equivalent.
    4298
    4299          This function is the same as the CPP method OGRGeometry::Equals()
    4300          method.
    4301
    4302          Parameters:
    4303          -----------
    4304
    4305          hGeom:  handle on the first geometry.
    4306
    4307          hOther:  handle on the other geometry to test against.
    4308
    4309          TRUE if equivalent or FALSE otherwise.
    4310          """
    4311          return _ogr.Geometry_Equals(self, *args)
    4312
    4313 -    def Equal(self, *args):
    4314          """
    4315          Equal(self, Geometry other) -> bool
    4316
    4317          int OGR_G_Equal(OGRGeometryH hGeom,
    4318          OGRGeometryH hOther)
    4319          """
    4320          return _ogr.Geometry_Equal(self, *args)
    4321
    4322 -    def Disjoint(self, *args):
    4323          """
    4324          Disjoint(self, Geometry other) -> bool
    4325
    4326          int OGR_G_Disjoint(OGRGeometryH
    4327          hThis, OGRGeometryH hOther)
    4328
    4329          Test for disjointness.
    4330
    4331          Tests if this geometry and the other geometry are disjoint.
    4332
    4333          This function is the same as the C++ method OGRGeometry::Disjoint().
    4334
    4335          This function is built on the GEOS library, check it for the
    4336          definition of the geometry operation. If OGR is built without the GEOS
    4337          library, this function will always fail, issuing a CPLE_NotSupported
    4338          error.
    4339
    4340          Parameters:
    4341          -----------
    4342
    4343          hThis:  the geometry to compare.
    4344
    4345          hOther:  the other geometry to compare.
    4346
    4347          TRUE if they are disjoint, otherwise FALSE.
    4348          """
    4349          return _ogr.Geometry_Disjoint(self, *args)
    4350
    4351 -    def Touches(self, *args):
    4352          """
    4353          Touches(self, Geometry other) -> bool
    4354
    4355          int OGR_G_Touches(OGRGeometryH hThis,
    4356          OGRGeometryH hOther)
    4357
    4358          Test for touching.
    4359
    4360          Tests if this geometry and the other geometry are touching.
    4361
    4362          This function is the same as the C++ method OGRGeometry::Touches().
    4363
    4364          This function is built on the GEOS library, check it for the
    4365          definition of the geometry operation. If OGR is built without the GEOS
    4366          library, this function will always fail, issuing a CPLE_NotSupported
    4367          error.
    4368
    4369          Parameters:
    4370          -----------
    4371
    4372          hThis:  the geometry to compare.
    4373
    4374          hOther:  the other geometry to compare.
    4375
    4376          TRUE if they are touching, otherwise FALSE.
    4377          """
    4378          return _ogr.Geometry_Touches(self, *args)
    4379
    4380 -    def Crosses(self, *args):
    4381          """
    4382          Crosses(self, Geometry other) -> bool
    4383
    4384          int OGR_G_Crosses(OGRGeometryH hThis,
    4385          OGRGeometryH hOther)
    4386
    4387          Test for crossing.
    4388
    4389          Tests if this geometry and the other geometry are crossing.
    4390
    4391          This function is the same as the C++ method OGRGeometry::Crosses().
    4392
    4393          This function is built on the GEOS library, check it for the
    4394          definition of the geometry operation. If OGR is built without the GEOS
    4395          library, this function will always fail, issuing a CPLE_NotSupported
    4396          error.
    4397
    4398          Parameters:
    4399          -----------
    4400
    4401          hThis:  the geometry to compare.
    4402
    4403          hOther:  the other geometry to compare.
    4404
    4405          TRUE if they are crossing, otherwise FALSE.
    4406          """
    4407          return _ogr.Geometry_Crosses(self, *args)
    4408
    4409 -    def Within(self, *args):
    4410          """
    4411          Within(self, Geometry other) -> bool
    4412
    4413          int OGR_G_Within(OGRGeometryH hThis,
    4414          OGRGeometryH hOther)
    4415
    4416          Test for containment.
    4417
    4418          Tests if this geometry is within the other geometry.
    4419
    4420          This function is the same as the C++ method OGRGeometry::Within().
    4421
    4422          This function is built on the GEOS library, check it for the
    4423          definition of the geometry operation. If OGR is built without the GEOS
    4424          library, this function will always fail, issuing a CPLE_NotSupported
    4425          error.
    4426
    4427          Parameters:
    4428          -----------
    4429
    4430          hThis:  the geometry to compare.
    4431
    4432          hOther:  the other geometry to compare.
    4433
    4434          TRUE if hThis is within hOther, otherwise FALSE.
    4435          """
    4436          return _ogr.Geometry_Within(self, *args)
    4437
    4438 -    def Contains(self, *args):
    4439          """
    4440          Contains(self, Geometry other) -> bool
    4441
    4442          int OGR_G_Contains(OGRGeometryH
    4443          hThis, OGRGeometryH hOther)
    4444
    4445          Test for containment.
    4446
    4447          Tests if this geometry contains the other geometry.
    4448
    4449          This function is the same as the C++ method OGRGeometry::Contains().
    4450
    4451          This function is built on the GEOS library, check it for the
    4452          definition of the geometry operation. If OGR is built without the GEOS
    4453          library, this function will always fail, issuing a CPLE_NotSupported
    4454          error.
    4455
    4456          Parameters:
    4457          -----------
    4458
    4459          hThis:  the geometry to compare.
    4460
    4461          hOther:  the other geometry to compare.
    4462
    4463          TRUE if hThis contains hOther geometry, otherwise FALSE.
    4464          """
    4465          return _ogr.Geometry_Contains(self, *args)
    4466
    4467 -    def Overlaps(self, *args):
    4468          """
    4469          Overlaps(self, Geometry other) -> bool
    4470
    4471          int OGR_G_Overlaps(OGRGeometryH
    4472          hThis, OGRGeometryH hOther)
    4473
    4474          Test for overlap.
    4475
    4476          Tests if this geometry and the other geometry overlap, that is their
    4477          intersection has a non-zero area.
    4478
    4479          This function is the same as the C++ method OGRGeometry::Overlaps().
    4480
    4481          This function is built on the GEOS library, check it for the
    4482          definition of the geometry operation. If OGR is built without the GEOS
    4483          library, this function will always fail, issuing a CPLE_NotSupported
    4484          error.
    4485
    4486          Parameters:
    4487          -----------
    4488
    4489          hThis:  the geometry to compare.
    4490
    4491          hOther:  the other geometry to compare.
    4492
    4493          TRUE if they are overlapping, otherwise FALSE.
    4494          """
    4495          return _ogr.Geometry_Overlaps(self, *args)
    4496
    4497 -    def TransformTo(self, *args):
    4498          """
    4499          TransformTo(self, SpatialReference reference) -> OGRErr
    4500
    4501          OGRErr
    4502          OGR_G_TransformTo(OGRGeometryH hGeom, OGRSpatialReferenceH hSRS)
    4503
    4504          Transform geometry to new spatial reference system.
    4505
    4506          This function will transform the coordinates of a geometry from their
    4507          current spatial reference system to a new target spatial reference
    4508          system. Normally this means reprojecting the vectors, but it could
    4509          include datum shifts, and changes of units.
    4510
    4511          This function will only work if the geometry already has an assigned
    4512          spatial reference system, and if it is transformable to the target
    4513          coordinate system.
    4514
    4515          Because this function requires internal creation and initialization of
    4516          an OGRCoordinateTransformation object it is significantly more
    4517          expensive to use this function to transform many geometries than it is
    4518          to create the OGRCoordinateTransformation in advance, and call
    4519          transform() with that transformation. This function exists primarily
    4520          for convenience when only transforming a single geometry.
    4521
    4522          This function is the same as the CPP method OGRGeometry::transformTo.
    4523
    4524          Parameters:
    4525          -----------
    4526
    4527          hGeom:  handle on the geometry to apply the transform to.
    4528
    4529          hSRS:  handle on the spatial reference system to apply.
    4530
    4531          OGRERR_NONE on success, or an error code.
    4532          """
    4533          return _ogr.Geometry_TransformTo(self, *args)
    4534
    4535 -    def Transform(self, *args):
    4536          """
    4537          Transform(self, CoordinateTransformation trans) -> OGRErr
    4538
    4539          OGRErr OGR_G_Transform(OGRGeometryH
    4540          hGeom, OGRCoordinateTransformationH hTransform)
    4541
    4542          Apply arbitrary coordinate transformation to geometry.
    4543
    4544          This function will transform the coordinates of a geometry from their
    4545          current spatial reference system to a new target spatial reference
    4546          system. Normally this means reprojecting the vectors, but it could
    4547          include datum shifts, and changes of units.
    4548
    4549          Note that this function does not require that the geometry already
    4550          have a spatial reference system. It will be assumed that they can be
    4551          treated as having the source spatial reference system of the
    4552          OGRCoordinateTransformation object, and the actual SRS of the geometry
    4553          will be ignored. On successful completion the output
    4554          OGRSpatialReference of the OGRCoordinateTransformation will be
    4555          assigned to the geometry.
    4556
    4557          This function is the same as the CPP method OGRGeometry::transform.
    4558
    4559          Parameters:
    4560          -----------
    4561
    4562          hGeom:  handle on the geometry to apply the transform to.
    4563
    4564          hTransform:  handle on the transformation to apply.
    4565
    4566          OGRERR_NONE on success or an error code.
    4567          """
    4568          return _ogr.Geometry_Transform(self, *args)
    4569
    4570 -    def GetSpatialReference(self, *args):
    4571          """
    4572          GetSpatialReference(self) -> SpatialReference
    4573
    4574          OGRSpatialReferenceH
    4575          OGR_G_GetSpatialReference(OGRGeometryH hGeom)
    4576
    4577          Returns spatial reference system for geometry.
    4578
    4579          This function relates to the SFCOM IGeometry::get_SpatialReference()
    4580          method.
    4581
    4582          This function is the same as the CPP method
    4583          OGRGeometry::getSpatialReference().
    4584
    4585          Parameters:
    4586          -----------
    4587
    4588          hGeom:  handle on the geometry to get spatial reference from.
    4589
    4590          a reference to the spatial reference geometry.
    4591          """
    4592          return _ogr.Geometry_GetSpatialReference(self, *args)
    4593
    4594 -    def AssignSpatialReference(self, *args):
    4595          """
    4596          AssignSpatialReference(self, SpatialReference reference)
    4597
    4598          void
    4599          OGR_G_AssignSpatialReference(OGRGeometryH hGeom, OGRSpatialReferenceH
    4600          hSRS)
    4601
    4602          Assign spatial reference to this object.
    4603
    4604          Any existing spatial reference is replaced, but under no circumstances
    4605          does this result in the object being reprojected. It is just changing
    4606          the interpretation of the existing geometry. Note that assigning a
    4607          spatial reference increments the reference count on the
    4608          OGRSpatialReference, but does not copy it.
    4609
    4610          This is similar to the SFCOM IGeometry::put_SpatialReference() method.
    4611
    4612          This function is the same as the CPP method
    4613          OGRGeometry::assignSpatialReference.
    4614
    4615          Parameters:
    4616          -----------
    4617
    4618          hGeom:  handle on the geometry to apply the new spatial reference
    4619          system.
    4620
    4621          hSRS:  handle on the new spatial reference system to apply.
    4622          """
    4623          return _ogr.Geometry_AssignSpatialReference(self, *args)
    4624
    4625 -    def CloseRings(self, *args):
    4626          """
    4627          CloseRings(self)
    4628
    4629          void OGR_G_CloseRings(OGRGeometryH
    4630          hGeom)
    4631
    4632          Force rings to be closed.
    4633
    4634          If this geometry, or any contained geometries has polygon rings that
    4635          are not closed, they will be closed by adding the starting point at
    4636          the end.
    4637
    4638          Parameters:
    4639          -----------
    4640
    4641          hGeom:  handle to the geometry.
    4642          """
    4643          return _ogr.Geometry_CloseRings(self, *args)
    4644
    4645 -    def FlattenTo2D(self, *args):
    4646          """
    4647          FlattenTo2D(self)
    4648
    4649          void
    4650          OGR_G_FlattenTo2D(OGRGeometryH hGeom)
    4651
    4652          Convert geometry to strictly 2D. In a sense this converts all Z
    4653          coordinates to 0.0.
    4654
    4655          This function is the same as the CPP method
    4656          OGRGeometry::flattenTo2D().
    4657
    4658          Parameters:
    4659          -----------
    4660
    4661          hGeom:  handle on the geometry to convert.
    4662          """
    4663          return _ogr.Geometry_FlattenTo2D(self, *args)
    4664
    4665 -    def Segmentize(self, *args):
    4666          """
    4667          Segmentize(self, double dfMaxLength)
    4668
    4669          void OGR_G_Segmentize(OGRGeometryH
    4670          hGeom, double dfMaxLength)
    4671
    4672          Modify the geometry such it has no segment longer then the given
    4673          distance.
    4674
    4675          Interpolated points will have Z and M values (if needed) set to 0.
    4676          Distance computation is performed in 2d only
    4677
    4678          This function is the same as the CPP method OGRGeometry::segmentize().
    4679
    4680          Parameters:
    4681          -----------
    4682
    4683          hGeom:  handle on the geometry to segmentize
    4684
    4685          dfMaxLength:  the maximum distance between 2 points after
    4686          segmentization
    4687          """
    4688          return _ogr.Geometry_Segmentize(self, *args)
    4689
    4690 -    def GetEnvelope(self, *args):
    4691          """
    4692          GetEnvelope(self)
    4693
    4694          void
    4695          OGR_G_GetEnvelope(OGRGeometryH hGeom, OGREnvelope *psEnvelope)
    4696
    4697          Computes and returns the bounding envelope for this geometry in the
    4698          passed psEnvelope structure.
    4699
    4700          This function is the same as the CPP method
    4701          OGRGeometry::getEnvelope().
    4702
    4703          Parameters:
    4704          -----------
    4705
    4706          hGeom:  handle of the geometry to get envelope from.
    4707
    4708          psEnvelope:  the structure in which to place the results.
    4709          """
    4710          return _ogr.Geometry_GetEnvelope(self, *args)
    4711
    4712 -    def GetEnvelope3D(self, *args):
    4713          """
    4714          GetEnvelope3D(self)
    4715
    4716          void
    4717          OGR_G_GetEnvelope3D(OGRGeometryH hGeom, OGREnvelope3D *psEnvelope)
    4718
    4719          Computes and returns the bounding envelope (3D) for this geometry in
    4720          the passed psEnvelope structure.
    4721
    4722          This function is the same as the CPP method
    4723          OGRGeometry::getEnvelope().
    4724
    4725          Parameters:
    4726          -----------
    4727
    4728          hGeom:  handle of the geometry to get envelope from.
    4729
    4730          psEnvelope:  the structure in which to place the results.
    4731
    4732          OGR 1.9.0
    4733          """
    4734          return _ogr.Geometry_GetEnvelope3D(self, *args)
    4735
    4736 -    def Centroid(self, *args):
    4737          """
    4738          Centroid(self) -> Geometry
    4739
    4740          int OGR_G_Centroid(OGRGeometryH
    4741          hGeom, OGRGeometryH hCentroidPoint)
    4742
    4743          Compute the geometry centroid.
    4744
    4745          The centroid location is applied to the passed in OGRPoint object. The
    4746          centroid is not necessarily within the geometry.
    4747
    4748          This method relates to the SFCOM ISurface::get_Centroid() method
    4749          however the current implementation based on GEOS can operate on other
    4750          geometry types such as multipoint, linestring, geometrycollection such
    4751          as multipolygons. OGC SF SQL 1.1 defines the operation for surfaces
    4752          (polygons). SQL/MM-Part 3 defines the operation for surfaces and
    4753          multisurfaces (multipolygons).
    4754
    4755          This function is the same as the C++ method OGRGeometry::Centroid().
    4756
    4757          This function is built on the GEOS library, check it for the
    4758          definition of the geometry operation. If OGR is built without the GEOS
    4759          library, this function will always fail, issuing a CPLE_NotSupported
    4760          error.
    4761
    4762          OGRERR_NONE on success or OGRERR_FAILURE on error.
    4763          """
    4764          return _ogr.Geometry_Centroid(self, *args)
    4765
    4766 -    def WkbSize(self, *args):
    4767          """
    4768          WkbSize(self) -> int
    4769
    4770          int OGR_G_WkbSize(OGRGeometryH hGeom)
    4771
    4772          Returns size of related binary representation.
    4773
    4774          This function returns the exact number of bytes required to hold the
    4775          well known binary representation of this geometry object. Its
    4776          computation may be slightly expensive for complex geometries.
    4777
    4778          This function relates to the SFCOM IWks::WkbSize() method.
    4779
    4780          This function is the same as the CPP method OGRGeometry::WkbSize().
    4781
    4782          Parameters:
    4783          -----------
    4784
    4785          hGeom:  handle on the geometry to get the binary size from.
    4786
    4787          size of binary representation in bytes.
    4788          """
    4789          return _ogr.Geometry_WkbSize(self, *args)
    4790
    4791 -    def GetCoordinateDimension(self, *args):
    4792          """
    4793          GetCoordinateDimension(self) -> int
    4794
    4795          int
    4796          OGR_G_GetCoordinateDimension(OGRGeometryH hGeom)
    4797
    4798          Get the dimension of the coordinates in this geometry.
    4799
    4800          This function corresponds to the SFCOM IGeometry::GetDimension()
    4801          method.
    4802
    4803          This function is the same as the CPP method
    4804          OGRGeometry::getCoordinateDimension().
    4805
    4806          Parameters:
    4807          -----------
    4808
    4809          hGeom:  handle on the geometry to get the dimension of the coordinates
    4810          from.
    4811
    4812          in practice this will return 2 or 3. It can also return 0 in the case
    4813          of an empty point.
    4814          """
    4815          return _ogr.Geometry_GetCoordinateDimension(self, *args)
    4816
    4817 -    def SetCoordinateDimension(self, *args):
    4818          """
    4819          SetCoordinateDimension(self, int dimension)
    4820
    4821          void
    4822          OGR_G_SetCoordinateDimension(OGRGeometryH hGeom, int nNewDimension)
    4823
    4824          Set the coordinate dimension.
    4825
    4826          This method sets the explicit coordinate dimension. Setting the
    4827          coordinate dimension of a geometry to 2 should zero out any existing Z
    4828          values. Setting the dimension of a geometry collection will not
    4829          necessarily affect the children geometries.
    4830
    4831          Parameters:
    4832          -----------
    4833
    4834          hGeom:  handle on the geometry to set the dimension of the
    4835          coordinates.
    4836
    4837          nNewDimension:  New coordinate dimension value, either 2 or 3.
    4838          """
    4839          return _ogr.Geometry_SetCoordinateDimension(self, *args)
    4840
    4841 -    def GetDimension(self, *args):
    4842          """
    4843          GetDimension(self) -> int
    4844
    4845          int
    4846          OGR_G_GetDimension(OGRGeometryH hGeom)
    4847
    4848          Get the dimension of this geometry.
    4849
    4850          This function corresponds to the SFCOM IGeometry::GetDimension()
    4851          method. It indicates the dimension of the geometry, but does not
    4852          indicate the dimension of the underlying space (as indicated by
    4853          OGR_G_GetCoordinateDimension() function).
    4854
    4855          This function is the same as the CPP method
    4856          OGRGeometry::getDimension().
    4857
    4858          Parameters:
    4859          -----------
    4860
    4861          hGeom:  handle on the geometry to get the dimension from.
    4862
    4863          0 for points, 1 for lines and 2 for surfaces.
    4864          """
    4865          return _ogr.Geometry_GetDimension(self, *args)
    4866
    4867 -    def Destroy(self):
    4868        self.__swig_destroy__(self)
    4869        self.__del__()
    4870        self.thisown = 0
    4871
    4872 -    def __str__(self):
    4873        return self.ExportToWkt()
    4874
    4875
    4876 -    def __reduce__(self):
    4877        return (self.__class__, (), self.ExportToWkb())
    4878
    4879 -    def __setstate__(self, state):
    4880          result = CreateGeometryFromWkb(state)
    4881          self.this = result.this
    4882
    4883 -    def __iter__(self):
    4884          self.iter_subgeom = 0
    4885          return self
    4886
    4887 -    def next(self):
    4888          if self.iter_subgeom < self.GetGeometryCount():
    4889              subgeom = self.GetGeometryRef(self.iter_subgeom)
    4890              self.iter_subgeom += 1
    4891              return subgeom
    4892          else:
    4893              raise StopIteration
    4894
    4895  Geometry_swigregister = _ogr.Geometry_swigregister
    4896  Geometry_swigregister(Geometry)
    4897
    4898
    4899 -def GetDriverCount(*args):
    4900    """GetDriverCount() -> int"""
    4901    return _ogr.GetDriverCount(*args)
    4902
    4903 -def GetOpenDSCount(*args):
    4904    """GetOpenDSCount() -> int"""
    4905    return _ogr.GetOpenDSCount(*args)
    4906
    4907 -def SetGenerate_DB2_V72_BYTE_ORDER(*args):
    4908    """SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER) -> OGRErr"""
    4909    return _ogr.SetGenerate_DB2_V72_BYTE_ORDER(*args)
    4910
    4911 -def RegisterAll(*args):
    4912    """RegisterAll()"""
    4913    return _ogr.RegisterAll(*args)
    4914
    4915 -def GeometryTypeToName(*args):
    4916    """GeometryTypeToName(OGRwkbGeometryType eType) -> char"""
    4917    return _ogr.GeometryTypeToName(*args)
    4918
    4919 -def GetFieldTypeName(*args):
    4920    """GetFieldTypeName(OGRFieldType type) -> char"""
    4921    return _ogr.GetFieldTypeName(*args)
    4922
    4923 -def GetOpenDS(*args):
    4924    """GetOpenDS(int ds_number) -> DataSource"""
    4925    return _ogr.GetOpenDS(*args)
    4926
    4927 -def Open(*args, **kwargs):
    4928    """Open(char utf8_path, int update = 0) -> DataSource"""
    4929    return _ogr.Open(*args, **kwargs)
    4930
    4931 -def OpenShared(*args, **kwargs):
    4932    """OpenShared(char utf8_path, int update = 0) -> DataSource"""
    4933    return _ogr.OpenShared(*args, **kwargs)
    4934
    4935 -def GetDriverByName(*args):
    4936    """GetDriverByName(char name) -> Driver"""
    4937    return _ogr.GetDriverByName(*args)
    4938
    4939 -def GetDriver(*args):
    4940    """GetDriver(int driver_number) -> Driver"""
    4941    return _ogr.GetDriver(*args)
    4942
    4943 -def GeneralCmdLineProcessor(*args):
    4944    """GeneralCmdLineProcessor(char papszArgv, int nOptions = 0) -> char"""
    4945    return _ogr.GeneralCmdLineProcessor(*args)
    4946