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 4.0.1 
   3  # 
   4  # Do not make changes to this file unless you know what you are doing--modify 
   5  # the SWIG interface file instead. 
   6   
   7  from sys import version_info as _swig_python_version_info 
   8  if _swig_python_version_info < (2, 7, 0): 
   9      raise RuntimeError("Python 2.7 or later required") 
  10   
  11  # Import the low-level C/C++ module 
  12  if __package__ or "." in __name__: 
  13      from . import _ogr 
  14  else: 
  15      import _ogr 
  16   
  17  try: 
  18      import builtins as __builtin__ 
  19  except ImportError: 
  20      import __builtin__ 
  21   
22 -def _swig_repr(self):
23 try: 24 strthis = "proxy of " + self.this.__repr__() 25 except __builtin__.Exception: 26 strthis = "" 27 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
28 29
30 -def _swig_setattr_nondynamic_instance_variable(set):
31 def set_instance_attr(self, name, value): 32 if name == "thisown": 33 self.this.own(value) 34 elif name == "this": 35 set(self, name, value) 36 elif hasattr(self, name) and isinstance(getattr(type(self), name), property): 37 set(self, name, value) 38 else: 39 raise AttributeError("You cannot add instance attributes to %s" % self)
40 return set_instance_attr 41 42
43 -def _swig_setattr_nondynamic_class_variable(set):
44 def set_class_attr(cls, name, value): 45 if hasattr(cls, name) and not isinstance(getattr(cls, name), property): 46 set(cls, name, value) 47 else: 48 raise AttributeError("You cannot add class attributes to %s" % cls)
49 return set_class_attr 50 51
52 -def _swig_add_metaclass(metaclass):
53 """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass""" 54 def wrapper(cls): 55 return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
56 return wrapper 57 58
59 -class _SwigNonDynamicMeta(type):
60 """Meta class to enforce nondynamic attributes (no new attributes) for a class""" 61 __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
62 63 64 wkb25DBit = _ogr.wkb25DBit 65 66 wkb25Bit = _ogr.wkb25Bit 67 68 wkbUnknown = _ogr.wkbUnknown 69 70 wkbPoint = _ogr.wkbPoint 71 72 wkbLineString = _ogr.wkbLineString 73 74 wkbPolygon = _ogr.wkbPolygon 75 76 wkbMultiPoint = _ogr.wkbMultiPoint 77 78 wkbMultiLineString = _ogr.wkbMultiLineString 79 80 wkbMultiPolygon = _ogr.wkbMultiPolygon 81 82 wkbGeometryCollection = _ogr.wkbGeometryCollection 83 84 wkbCircularString = _ogr.wkbCircularString 85 86 wkbCompoundCurve = _ogr.wkbCompoundCurve 87 88 wkbCurvePolygon = _ogr.wkbCurvePolygon 89 90 wkbMultiCurve = _ogr.wkbMultiCurve 91 92 wkbMultiSurface = _ogr.wkbMultiSurface 93 94 wkbCurve = _ogr.wkbCurve 95 96 wkbSurface = _ogr.wkbSurface 97 98 wkbPolyhedralSurface = _ogr.wkbPolyhedralSurface 99 100 wkbTIN = _ogr.wkbTIN 101 102 wkbTriangle = _ogr.wkbTriangle 103 104 wkbNone = _ogr.wkbNone 105 106 wkbLinearRing = _ogr.wkbLinearRing 107 108 wkbCircularStringZ = _ogr.wkbCircularStringZ 109 110 wkbCompoundCurveZ = _ogr.wkbCompoundCurveZ 111 112 wkbCurvePolygonZ = _ogr.wkbCurvePolygonZ 113 114 wkbMultiCurveZ = _ogr.wkbMultiCurveZ 115 116 wkbMultiSurfaceZ = _ogr.wkbMultiSurfaceZ 117 118 wkbCurveZ = _ogr.wkbCurveZ 119 120 wkbSurfaceZ = _ogr.wkbSurfaceZ 121 122 wkbPolyhedralSurfaceZ = _ogr.wkbPolyhedralSurfaceZ 123 124 wkbTINZ = _ogr.wkbTINZ 125 126 wkbTriangleZ = _ogr.wkbTriangleZ 127 128 wkbPointM = _ogr.wkbPointM 129 130 wkbLineStringM = _ogr.wkbLineStringM 131 132 wkbPolygonM = _ogr.wkbPolygonM 133 134 wkbMultiPointM = _ogr.wkbMultiPointM 135 136 wkbMultiLineStringM = _ogr.wkbMultiLineStringM 137 138 wkbMultiPolygonM = _ogr.wkbMultiPolygonM 139 140 wkbGeometryCollectionM = _ogr.wkbGeometryCollectionM 141 142 wkbCircularStringM = _ogr.wkbCircularStringM 143 144 wkbCompoundCurveM = _ogr.wkbCompoundCurveM 145 146 wkbCurvePolygonM = _ogr.wkbCurvePolygonM 147 148 wkbMultiCurveM = _ogr.wkbMultiCurveM 149 150 wkbMultiSurfaceM = _ogr.wkbMultiSurfaceM 151 152 wkbCurveM = _ogr.wkbCurveM 153 154 wkbSurfaceM = _ogr.wkbSurfaceM 155 156 wkbPolyhedralSurfaceM = _ogr.wkbPolyhedralSurfaceM 157 158 wkbTINM = _ogr.wkbTINM 159 160 wkbTriangleM = _ogr.wkbTriangleM 161 162 wkbPointZM = _ogr.wkbPointZM 163 164 wkbLineStringZM = _ogr.wkbLineStringZM 165 166 wkbPolygonZM = _ogr.wkbPolygonZM 167 168 wkbMultiPointZM = _ogr.wkbMultiPointZM 169 170 wkbMultiLineStringZM = _ogr.wkbMultiLineStringZM 171 172 wkbMultiPolygonZM = _ogr.wkbMultiPolygonZM 173 174 wkbGeometryCollectionZM = _ogr.wkbGeometryCollectionZM 175 176 wkbCircularStringZM = _ogr.wkbCircularStringZM 177 178 wkbCompoundCurveZM = _ogr.wkbCompoundCurveZM 179 180 wkbCurvePolygonZM = _ogr.wkbCurvePolygonZM 181 182 wkbMultiCurveZM = _ogr.wkbMultiCurveZM 183 184 wkbMultiSurfaceZM = _ogr.wkbMultiSurfaceZM 185 186 wkbCurveZM = _ogr.wkbCurveZM 187 188 wkbSurfaceZM = _ogr.wkbSurfaceZM 189 190 wkbPolyhedralSurfaceZM = _ogr.wkbPolyhedralSurfaceZM 191 192 wkbTINZM = _ogr.wkbTINZM 193 194 wkbTriangleZM = _ogr.wkbTriangleZM 195 196 wkbPoint25D = _ogr.wkbPoint25D 197 198 wkbLineString25D = _ogr.wkbLineString25D 199 200 wkbPolygon25D = _ogr.wkbPolygon25D 201 202 wkbMultiPoint25D = _ogr.wkbMultiPoint25D 203 204 wkbMultiLineString25D = _ogr.wkbMultiLineString25D 205 206 wkbMultiPolygon25D = _ogr.wkbMultiPolygon25D 207 208 wkbGeometryCollection25D = _ogr.wkbGeometryCollection25D 209 210 OFTInteger = _ogr.OFTInteger 211 212 OFTIntegerList = _ogr.OFTIntegerList 213 214 OFTReal = _ogr.OFTReal 215 216 OFTRealList = _ogr.OFTRealList 217 218 OFTString = _ogr.OFTString 219 220 OFTStringList = _ogr.OFTStringList 221 222 OFTWideString = _ogr.OFTWideString 223 224 OFTWideStringList = _ogr.OFTWideStringList 225 226 OFTBinary = _ogr.OFTBinary 227 228 OFTDate = _ogr.OFTDate 229 230 OFTTime = _ogr.OFTTime 231 232 OFTDateTime = _ogr.OFTDateTime 233 234 OFTInteger64 = _ogr.OFTInteger64 235 236 OFTInteger64List = _ogr.OFTInteger64List 237 238 OFSTNone = _ogr.OFSTNone 239 240 OFSTBoolean = _ogr.OFSTBoolean 241 242 OFSTInt16 = _ogr.OFSTInt16 243 244 OFSTFloat32 = _ogr.OFSTFloat32 245 246 OFSTJSON = _ogr.OFSTJSON 247 248 OFSTUUID = _ogr.OFSTUUID 249 250 OJUndefined = _ogr.OJUndefined 251 252 OJLeft = _ogr.OJLeft 253 254 OJRight = _ogr.OJRight 255 256 OFDT_CODED = _ogr.OFDT_CODED 257 258 OFDT_RANGE = _ogr.OFDT_RANGE 259 260 OFDT_GLOB = _ogr.OFDT_GLOB 261 262 OFDSP_DEFAULT_VALUE = _ogr.OFDSP_DEFAULT_VALUE 263 264 OFDSP_DUPLICATE = _ogr.OFDSP_DUPLICATE 265 266 OFDSP_GEOMETRY_RATIO = _ogr.OFDSP_GEOMETRY_RATIO 267 268 OFDMP_DEFAULT_VALUE = _ogr.OFDMP_DEFAULT_VALUE 269 270 OFDMP_SUM = _ogr.OFDMP_SUM 271 272 OFDMP_GEOMETRY_WEIGHTED = _ogr.OFDMP_GEOMETRY_WEIGHTED 273 274 wkbXDR = _ogr.wkbXDR 275 276 wkbNDR = _ogr.wkbNDR 277 278 NullFID = _ogr.NullFID 279 280 ALTER_NAME_FLAG = _ogr.ALTER_NAME_FLAG 281 282 ALTER_TYPE_FLAG = _ogr.ALTER_TYPE_FLAG 283 284 ALTER_WIDTH_PRECISION_FLAG = _ogr.ALTER_WIDTH_PRECISION_FLAG 285 286 ALTER_NULLABLE_FLAG = _ogr.ALTER_NULLABLE_FLAG 287 288 ALTER__FLAG = _ogr.ALTER__FLAG 289 290 ALTER_DEFAULT_FLAG = _ogr.ALTER_DEFAULT_FLAG 291 292 ALTER_UNIQUE_FLAG = _ogr.ALTER_UNIQUE_FLAG 293 294 ALTER_DOMAIN_FLAG = _ogr.ALTER_DOMAIN_FLAG 295 296 ALTER_ALL_FLAG = _ogr.ALTER_ALL_FLAG 297 298 F_VAL_NULL = _ogr.F_VAL_NULL 299 300 F_VAL_GEOM_TYPE = _ogr.F_VAL_GEOM_TYPE 301 302 F_VAL_WIDTH = _ogr.F_VAL_WIDTH 303 304 F_VAL_ALLOW_NULL_WHEN_DEFAULT = _ogr.F_VAL_ALLOW_NULL_WHEN_DEFAULT 305 306 F_VAL_ALL = _ogr.F_VAL_ALL 307 308 OLCRandomRead = _ogr.OLCRandomRead 309 310 OLCSequentialWrite = _ogr.OLCSequentialWrite 311 312 OLCRandomWrite = _ogr.OLCRandomWrite 313 314 OLCFastSpatialFilter = _ogr.OLCFastSpatialFilter 315 316 OLCFastFeatureCount = _ogr.OLCFastFeatureCount 317 318 OLCFastGetExtent = _ogr.OLCFastGetExtent 319 320 OLCCreateField = _ogr.OLCCreateField 321 322 OLCDeleteField = _ogr.OLCDeleteField 323 324 OLCReorderFields = _ogr.OLCReorderFields 325 326 OLCAlterFieldDefn = _ogr.OLCAlterFieldDefn 327 328 OLCTransactions = _ogr.OLCTransactions 329 330 OLCDeleteFeature = _ogr.OLCDeleteFeature 331 332 OLCFastSetNextByIndex = _ogr.OLCFastSetNextByIndex 333 334 OLCStringsAsUTF8 = _ogr.OLCStringsAsUTF8 335 336 OLCIgnoreFields = _ogr.OLCIgnoreFields 337 338 OLCCreateGeomField = _ogr.OLCCreateGeomField 339 340 OLCCurveGeometries = _ogr.OLCCurveGeometries 341 342 OLCMeasuredGeometries = _ogr.OLCMeasuredGeometries 343 344 ODsCCreateLayer = _ogr.ODsCCreateLayer 345 346 ODsCDeleteLayer = _ogr.ODsCDeleteLayer 347 348 ODsCCreateGeomFieldAfterCreateLayer = _ogr.ODsCCreateGeomFieldAfterCreateLayer 349 350 ODsCCurveGeometries = _ogr.ODsCCurveGeometries 351 352 ODsCTransactions = _ogr.ODsCTransactions 353 354 ODsCEmulatedTransactions = _ogr.ODsCEmulatedTransactions 355 356 ODsCMeasuredGeometries = _ogr.ODsCMeasuredGeometries 357 358 ODsCRandomLayerRead = _ogr.ODsCRandomLayerRead 359 360 ODsCRandomLayerWrite = _ogr.ODsCRandomLayerWrite 361 362 ODsCAddFieldDomain = _ogr.ODsCAddFieldDomain 363 364 ODrCCreateDataSource = _ogr.ODrCCreateDataSource 365 366 ODrCDeleteDataSource = _ogr.ODrCDeleteDataSource 367 368 OLMD_FID64 = _ogr.OLMD_FID64 369 370 OGRERR_NONE = _ogr.OGRERR_NONE 371 372 OGRERR_NOT_ENOUGH_DATA = _ogr.OGRERR_NOT_ENOUGH_DATA 373 374 OGRERR_NOT_ENOUGH_MEMORY = _ogr.OGRERR_NOT_ENOUGH_MEMORY 375 376 OGRERR_UNSUPPORTED_GEOMETRY_TYPE = _ogr.OGRERR_UNSUPPORTED_GEOMETRY_TYPE 377 378 OGRERR_UNSUPPORTED_OPERATION = _ogr.OGRERR_UNSUPPORTED_OPERATION 379 380 OGRERR_CORRUPT_DATA = _ogr.OGRERR_CORRUPT_DATA 381 382 OGRERR_FAILURE = _ogr.OGRERR_FAILURE 383 384 OGRERR_UNSUPPORTED_SRS = _ogr.OGRERR_UNSUPPORTED_SRS 385 386 OGRERR_INVALID_HANDLE = _ogr.OGRERR_INVALID_HANDLE 387 388 OGRERR_NON_EXISTING_FEATURE = _ogr.OGRERR_NON_EXISTING_FEATURE 389 390
391 -def GetUseExceptions(*args):
392 r"""GetUseExceptions() -> int""" 393 return _ogr.GetUseExceptions(*args)
394
395 -def UseExceptions(*args):
396 r"""UseExceptions()""" 397 return _ogr.UseExceptions(*args)
398
399 -def DontUseExceptions(*args):
400 r"""DontUseExceptions()""" 401 return _ogr.DontUseExceptions(*args)
402 from . import osr
403 -class MajorObject(object):
404 r"""Proxy of C++ GDALMajorObjectShadow class.""" 405 406 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 407
408 - def __init__(self, *args, **kwargs):
409 raise AttributeError("No constructor defined")
410 __repr__ = _swig_repr 411
412 - def GetDescription(self, *args):
413 r"""GetDescription(MajorObject self) -> char const *""" 414 return _ogr.MajorObject_GetDescription(self, *args)
415
416 - def SetDescription(self, *args):
417 r"""SetDescription(MajorObject self, char const * pszNewDesc)""" 418 return _ogr.MajorObject_SetDescription(self, *args)
419
420 - def GetMetadataDomainList(self, *args):
421 r"""GetMetadataDomainList(MajorObject self) -> char **""" 422 return _ogr.MajorObject_GetMetadataDomainList(self, *args)
423
424 - def GetMetadata_Dict(self, *args):
425 r"""GetMetadata_Dict(MajorObject self, char const * pszDomain="") -> char **""" 426 return _ogr.MajorObject_GetMetadata_Dict(self, *args)
427
428 - def GetMetadata_List(self, *args):
429 r"""GetMetadata_List(MajorObject self, char const * pszDomain="") -> char **""" 430 return _ogr.MajorObject_GetMetadata_List(self, *args)
431
432 - def SetMetadata(self, *args):
433 r""" 434 SetMetadata(MajorObject self, char ** papszMetadata, char const * pszDomain="") -> CPLErr 435 SetMetadata(MajorObject self, char * pszMetadataString, char const * pszDomain="") -> CPLErr 436 """ 437 return _ogr.MajorObject_SetMetadata(self, *args)
438
439 - def GetMetadataItem(self, *args):
440 r"""GetMetadataItem(MajorObject self, char const * pszName, char const * pszDomain="") -> char const *""" 441 return _ogr.MajorObject_GetMetadataItem(self, *args)
442
443 - def SetMetadataItem(self, *args):
444 r"""SetMetadataItem(MajorObject self, char const * pszName, char const * pszValue, char const * pszDomain="") -> CPLErr""" 445 return _ogr.MajorObject_SetMetadataItem(self, *args)
446
447 - def GetMetadata(self, domain=''):
448 if domain[:4] == 'xml:': 449 return self.GetMetadata_List(domain) 450 return self.GetMetadata_Dict(domain)
451 452 453 # Register MajorObject in _ogr: 454 _ogr.MajorObject_swigregister(MajorObject) 455
456 -class StyleTable(object):
457 r"""Proxy of C++ OGRStyleTableShadow class.""" 458 459 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 460 __repr__ = _swig_repr 461
462 - def __init__(self, *args):
463 r"""__init__(StyleTable self) -> StyleTable""" 464 _ogr.StyleTable_swiginit(self, _ogr.new_StyleTable(*args))
465 __swig_destroy__ = _ogr.delete_StyleTable 466
467 - def AddStyle(self, *args):
468 r"""AddStyle(StyleTable self, char const * pszName, char const * pszStyleString) -> int""" 469 return _ogr.StyleTable_AddStyle(self, *args)
470
471 - def LoadStyleTable(self, *args):
472 r"""LoadStyleTable(StyleTable self, char const * utf8_path) -> int""" 473 return _ogr.StyleTable_LoadStyleTable(self, *args)
474
475 - def SaveStyleTable(self, *args):
476 r"""SaveStyleTable(StyleTable self, char const * utf8_path) -> int""" 477 return _ogr.StyleTable_SaveStyleTable(self, *args)
478
479 - def Find(self, *args):
480 r"""Find(StyleTable self, char const * pszName) -> char const *""" 481 return _ogr.StyleTable_Find(self, *args)
482
483 - def ResetStyleStringReading(self, *args):
484 r"""ResetStyleStringReading(StyleTable self)""" 485 return _ogr.StyleTable_ResetStyleStringReading(self, *args)
486
487 - def GetNextStyle(self, *args):
488 r"""GetNextStyle(StyleTable self) -> char const *""" 489 return _ogr.StyleTable_GetNextStyle(self, *args)
490
491 - def GetLastStyleName(self, *args):
492 r"""GetLastStyleName(StyleTable self) -> char const *""" 493 return _ogr.StyleTable_GetLastStyleName(self, *args)
494 495 # Register StyleTable in _ogr: 496 _ogr.StyleTable_swigregister(StyleTable) 497
498 -class Driver(MajorObject):
499 r"""Proxy of C++ OGRDriverShadow class.""" 500 501 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 502
503 - def __init__(self, *args, **kwargs):
504 raise AttributeError("No constructor defined")
505 __repr__ = _swig_repr 506 name = property(_ogr.Driver_name_get, doc=r"""name : p.q(const).char""") 507
508 - def CreateDataSource(self, *args, **kwargs):
509 r"""CreateDataSource(Driver self, char const * utf8_path, char ** options=None) -> DataSource""" 510 return _ogr.Driver_CreateDataSource(self, *args, **kwargs)
511
512 - def CopyDataSource(self, *args, **kwargs):
513 r"""CopyDataSource(Driver self, DataSource copy_ds, char const * utf8_path, char ** options=None) -> DataSource""" 514 return _ogr.Driver_CopyDataSource(self, *args, **kwargs)
515
516 - def Open(self, *args, **kwargs):
517 r"""Open(Driver self, char const * utf8_path, int update=0) -> DataSource""" 518 return _ogr.Driver_Open(self, *args, **kwargs)
519
520 - def DeleteDataSource(self, *args):
521 r"""DeleteDataSource(Driver self, char const * utf8_path) -> int""" 522 return _ogr.Driver_DeleteDataSource(self, *args)
523
524 - def TestCapability(self, *args):
525 r"""TestCapability(Driver self, char const * cap) -> bool""" 526 return _ogr.Driver_TestCapability(self, *args)
527
528 - def GetName(self, *args):
529 r"""GetName(Driver self) -> char const *""" 530 return _ogr.Driver_GetName(self, *args)
531
532 - def Register(self, *args):
533 r"""Register(Driver self)""" 534 return _ogr.Driver_Register(self, *args)
535
536 - def Deregister(self, *args):
537 r"""Deregister(Driver self)""" 538 return _ogr.Driver_Deregister(self, *args)
539 540 # Register Driver in _ogr: 541 _ogr.Driver_swigregister(Driver) 542
543 -class DataSource(MajorObject):
544 r"""Proxy of C++ OGRDataSourceShadow class.""" 545 546 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 547
548 - def __init__(self, *args, **kwargs):
549 raise AttributeError("No constructor defined")
550 __repr__ = _swig_repr 551 name = property(_ogr.DataSource_name_get, doc=r"""name : p.q(const).char""") 552 __swig_destroy__ = _ogr.delete_DataSource 553
554 - def GetRefCount(self, *args):
555 r""" 556 GetRefCount(DataSource self) -> int 557 int 558 OGR_DS_GetRefCount(OGRDataSourceH hDataSource) 559 """ 560 return _ogr.DataSource_GetRefCount(self, *args)
561
562 - def GetSummaryRefCount(self, *args):
563 r""" 564 GetSummaryRefCount(DataSource self) -> int 565 int 566 OGR_DS_GetSummaryRefCount(OGRDataSourceH hDataSource) 567 """ 568 return _ogr.DataSource_GetSummaryRefCount(self, *args)
569
570 - def GetLayerCount(self, *args):
571 r""" 572 GetLayerCount(DataSource self) -> int 573 int 574 OGR_DS_GetLayerCount(OGRDataSourceH hDS) 575 576 Get the number of layers in this data source. 577 578 Deprecated Use GDALDatasetGetLayerCount() in GDAL 2.0 579 580 Parameters: 581 ----------- 582 583 hDS: handle to the data source from which to get the number of 584 layers. 585 586 layer count. 587 """ 588 return _ogr.DataSource_GetLayerCount(self, *args)
589
590 - def GetDriver(self, *args):
591 r""" 592 GetDriver(DataSource self) -> Driver 593 OGRSFDriverH 594 OGR_DS_GetDriver(OGRDataSourceH hDS) 595 596 Returns the driver that the dataset was opened with. 597 598 NOTE: Starting with GDAL 2.0, it is NOT safe to cast the returned 599 handle to OGRSFDriver*. If a C++ object is needed, the handle should 600 be cast to GDALDriver*. 601 602 Deprecated Use GDALGetDatasetDriver() in GDAL 2.0 603 604 Parameters: 605 ----------- 606 607 hDS: handle to the datasource 608 609 NULL if driver info is not available, or pointer to a driver owned by 610 the OGRSFDriverManager. 611 """ 612 return _ogr.DataSource_GetDriver(self, *args)
613
614 - def GetName(self, *args):
615 r""" 616 GetName(DataSource self) -> char const * 617 const char* 618 OGR_DS_GetName(OGRDataSourceH hDS) 619 620 Returns the name of the data source. 621 622 This string should be sufficient to open the data source if passed to 623 the same OGRSFDriver that this data source was opened with, but it 624 need not be exactly the same string that was used to open the data 625 source. Normally this is a filename. 626 627 Deprecated Use GDALGetDescription() in GDAL 2.0 628 629 Parameters: 630 ----------- 631 632 hDS: handle to the data source to get the name from. 633 634 pointer to an internal name string which should not be modified or 635 freed by the caller. 636 """ 637 return _ogr.DataSource_GetName(self, *args)
638
639 - def DeleteLayer(self, *args):
640 r""" 641 DeleteLayer(DataSource self, int index) -> OGRErr 642 OGRErr 643 OGR_DS_DeleteLayer(OGRDataSourceH hDS, int iLayer) 644 645 Delete the indicated layer from the datasource. 646 647 If this method is supported the ODsCDeleteLayer capability will test 648 TRUE on the OGRDataSource. 649 650 Deprecated Use GDALDatasetDeleteLayer() in GDAL 2.0 651 652 Parameters: 653 ----------- 654 655 hDS: handle to the datasource 656 657 iLayer: the index of the layer to delete. 658 659 OGRERR_NONE on success, or OGRERR_UNSUPPORTED_OPERATION if deleting 660 layers is not supported for this datasource. 661 """ 662 return _ogr.DataSource_DeleteLayer(self, *args)
663
664 - def SyncToDisk(self, *args):
665 r""" 666 SyncToDisk(DataSource self) -> OGRErr 667 OGRErr 668 OGR_DS_SyncToDisk(OGRDataSourceH hDS) 669 670 Flush pending changes to disk. 671 672 See GDALDataset::FlushCache() 673 """ 674 return _ogr.DataSource_SyncToDisk(self, *args)
675
676 - def FlushCache(self, *args):
677 r"""FlushCache(DataSource self)""" 678 return _ogr.DataSource_FlushCache(self, *args)
679
680 - def CreateLayer(self, *args, **kwargs):
681 r""" 682 CreateLayer(DataSource self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown, char ** options=None) -> Layer 683 OGRLayerH 684 OGR_DS_CreateLayer(OGRDataSourceH hDS, const char *pszName, 685 OGRSpatialReferenceH hSpatialRef, OGRwkbGeometryType eType, char 686 **papszOptions) 687 688 This function attempts to create a new layer on the data source with 689 the indicated name, coordinate system, geometry type. 690 691 The papszOptions argument can be used to control driver specific 692 creation options. These options are normally documented in the format 693 specific documentation. 694 695 Deprecated Use GDALDatasetCreateLayer() in GDAL 2.0 696 697 Parameters: 698 ----------- 699 700 hDS: The dataset handle. 701 702 pszName: the name for the new layer. This should ideally not match 703 any existing layer on the datasource. 704 705 hSpatialRef: handle to the coordinate system to use for the new 706 layer, or NULL if no coordinate system is available. The driver might 707 only increase the reference counter of the object to take ownership, 708 and not make a full copy, so do not use OSRDestroySpatialReference(), 709 but OSRRelease() instead when you are done with the object. 710 711 eType: the geometry type for the layer. Use wkbUnknown if there are 712 no constraints on the types geometry to be written. 713 714 papszOptions: a StringList of name=value options. Options are driver 715 specific, and driver information can be found at the following 716 url:http://www.gdal.org/ogr_formats.html 717 718 NULL is returned on failure, or a new OGRLayer handle on success. 719 Example: 720 """ 721 return _ogr.DataSource_CreateLayer(self, *args, **kwargs)
722
723 - def CopyLayer(self, *args, **kwargs):
724 r""" 725 CopyLayer(DataSource self, Layer src_layer, char const * new_name, char ** options=None) -> Layer 726 OGRLayerH 727 OGR_DS_CopyLayer(OGRDataSourceH hDS, OGRLayerH hSrcLayer, const char 728 *pszNewName, char **papszOptions) 729 730 Duplicate an existing layer. 731 732 This function creates a new layer, duplicate the field definitions of 733 the source layer and then duplicate each features of the source layer. 734 The papszOptions argument can be used to control driver specific 735 creation options. These options are normally documented in the format 736 specific documentation. The source layer may come from another 737 dataset. 738 739 Deprecated Use GDALDatasetCopyLayer() in GDAL 2.0 740 741 Parameters: 742 ----------- 743 744 hDS: handle to the data source where to create the new layer 745 746 hSrcLayer: handle to the source layer. 747 748 pszNewName: the name of the layer to create. 749 750 papszOptions: a StringList of name=value options. Options are driver 751 specific. 752 753 a handle to the layer, or NULL if an error occurs. 754 """ 755 return _ogr.DataSource_CopyLayer(self, *args, **kwargs)
756
757 - def GetLayerByIndex(self, *args):
758 r"""GetLayerByIndex(DataSource self, int index=0) -> Layer""" 759 return _ogr.DataSource_GetLayerByIndex(self, *args)
760
761 - def GetLayerByName(self, *args):
762 r""" 763 GetLayerByName(DataSource self, char const * layer_name) -> Layer 764 OGRLayerH 765 OGR_DS_GetLayerByName(OGRDataSourceH hDS, const char *pszName) 766 767 Fetch a layer by name. 768 769 The returned layer remains owned by the OGRDataSource and should not 770 be deleted by the application. 771 772 Deprecated Use GDALDatasetGetLayerByName() in GDAL 2.0 773 774 Parameters: 775 ----------- 776 777 hDS: handle to the data source from which to get the layer. 778 779 pszLayerName: Layer the layer name of the layer to fetch. 780 781 a handle to the layer, or NULL if the layer is not found or an error 782 occurs. 783 """ 784 return _ogr.DataSource_GetLayerByName(self, *args)
785
786 - def TestCapability(self, *args):
787 r""" 788 TestCapability(DataSource self, char const * cap) -> bool 789 int 790 OGR_DS_TestCapability(OGRDataSourceH hDS, const char *pszCap) 791 792 Test if capability is available. 793 794 One of the following data source capability names can be passed into 795 this function, and a TRUE or FALSE value will be returned indicating 796 whether or not the capability is available for this object. 797 798 ODsCCreateLayer: True if this datasource can create new layers. 799 800 ODsCDeleteLayer: True if this datasource can delete existing layers. 801 802 ODsCCreateGeomFieldAfterCreateLayer: True if the layers of this 803 datasource support CreateGeomField() just after layer creation. 804 805 ODsCCurveGeometries: True if this datasource supports writing curve 806 geometries. (GDAL 2.0). In that case, OLCCurveGeometries must also be 807 declared in layers of that dataset. 808 809 The #define macro forms of the capability names should be used in 810 preference to the strings themselves to avoid misspelling. 811 812 Deprecated Use GDALDatasetTestCapability() in GDAL 2.0 813 814 Parameters: 815 ----------- 816 817 hDS: handle to the data source against which to test the capability. 818 819 pszCapability: the capability to test. 820 821 TRUE if capability available otherwise FALSE. 822 """ 823 return _ogr.DataSource_TestCapability(self, *args)
824
825 - def ExecuteSQL(self, *args, **kwargs):
826 r""" 827 ExecuteSQL(DataSource self, char const * statement, Geometry spatialFilter=None, char const * dialect="") -> Layer 828 OGRLayerH 829 OGR_DS_ExecuteSQL(OGRDataSourceH hDS, const char *pszStatement, 830 OGRGeometryH hSpatialFilter, const char *pszDialect) 831 832 Execute an SQL statement against the data store. 833 834 The result of an SQL query is either NULL for statements that are in 835 error, or that have no results set, or an OGRLayer handle representing 836 a results set from the query. Note that this OGRLayer is in addition 837 to the layers in the data store and must be destroyed with 838 OGR_DS_ReleaseResultSet() before the data source is closed 839 (destroyed). 840 841 For more information on the SQL dialect supported internally by OGR 842 review theOGR SQL document. Some drivers (i.e. Oracle and PostGIS) 843 pass the SQL directly through to the underlying RDBMS. 844 845 Starting with OGR 1.10, theSQLITE dialect can also be used. 846 847 Deprecated Use GDALDatasetExecuteSQL() in GDAL 2.0 848 849 Parameters: 850 ----------- 851 852 hDS: handle to the data source on which the SQL query is executed. 853 854 pszSQLCommand: the SQL statement to execute. 855 856 hSpatialFilter: handle to a geometry which represents a spatial 857 filter. Can be NULL. 858 859 pszDialect: allows control of the statement dialect. If set to NULL, 860 the OGR SQL engine will be used, except for RDBMS drivers that will 861 use their dedicated SQL engine, unless OGRSQL is explicitly passed as 862 the dialect. Starting with OGR 1.10, the SQLITE dialect can also be 863 used. 864 865 a handle to a OGRLayer containing the results of the query. 866 Deallocate with OGR_DS_ReleaseResultSet(). 867 """ 868 return _ogr.DataSource_ExecuteSQL(self, *args, **kwargs)
869
870 - def AbortSQL(self, *args):
871 r"""AbortSQL(DataSource self) -> OGRErr""" 872 return _ogr.DataSource_AbortSQL(self, *args)
873
874 - def ReleaseResultSet(self, *args):
875 r""" 876 ReleaseResultSet(DataSource self, Layer layer) 877 void 878 OGR_DS_ReleaseResultSet(OGRDataSourceH hDS, OGRLayerH hLayer) 879 880 Release results of OGR_DS_ExecuteSQL(). 881 882 This function should only be used to deallocate OGRLayers resulting 883 from an OGR_DS_ExecuteSQL() call on the same OGRDataSource. Failure to 884 deallocate a results set before destroying the OGRDataSource may cause 885 errors. 886 887 Deprecated Use GDALDatasetReleaseResultSet() in GDAL 2.0 888 889 Parameters: 890 ----------- 891 892 hDS: a handle to the data source on which was executed an SQL query. 893 894 hLayer: handle to the result of a previous OGR_DS_ExecuteSQL() call. 895 896 """ 897 return _ogr.DataSource_ReleaseResultSet(self, *args)
898
899 - def GetStyleTable(self, *args):
900 r""" 901 GetStyleTable(DataSource self) -> StyleTable 902 OGRStyleTableH 903 OGR_DS_GetStyleTable(OGRDataSourceH hDS) 904 905 Get style table. 906 """ 907 return _ogr.DataSource_GetStyleTable(self, *args)
908
909 - def SetStyleTable(self, *args):
910 r""" 911 SetStyleTable(DataSource self, StyleTable table) 912 void 913 OGR_DS_SetStyleTable(OGRDataSourceH hDS, OGRStyleTableH hStyleTable) 914 915 Set style table. 916 """ 917 return _ogr.DataSource_SetStyleTable(self, *args)
918
919 - def StartTransaction(self, *args, **kwargs):
920 r"""StartTransaction(DataSource self, int force=FALSE) -> OGRErr""" 921 return _ogr.DataSource_StartTransaction(self, *args, **kwargs)
922
923 - def CommitTransaction(self, *args):
924 r"""CommitTransaction(DataSource self) -> OGRErr""" 925 return _ogr.DataSource_CommitTransaction(self, *args)
926
927 - def RollbackTransaction(self, *args):
928 r"""RollbackTransaction(DataSource self) -> OGRErr""" 929 return _ogr.DataSource_RollbackTransaction(self, *args)
930
931 - def Destroy(self):
932 "Once called, self has effectively been destroyed. Do not access. For backwards compatibility only" 933 _ogr.delete_DataSource(self) 934 self.thisown = 0
935
936 - def Release(self):
937 "Once called, self has effectively been destroyed. Do not access. For backwards compatibility only" 938 _ogr.delete_DataSource(self) 939 self.thisown = 0
940
941 - def Reference(self):
942 "For backwards compatibility only." 943 return self.Reference()
944
945 - def Dereference(self):
946 "For backwards compatibility only." 947 self.Dereference()
948
949 - def __len__(self):
950 """Returns the number of layers on the datasource""" 951 return self.GetLayerCount()
952
953 - def __getitem__(self, value):
954 """Support dictionary, list, and slice -like access to the datasource. 955 ds[0] would return the first layer on the datasource. 956 ds['aname'] would return the layer named "aname". 957 ds[0:4] would return a list of the first four layers.""" 958 if isinstance(value, slice): 959 output = [] 960 step = value.step if value.step else 1 961 for i in range(value.start, value.stop, step): 962 lyr = self.GetLayer(i) 963 if lyr is None: 964 return output 965 output.append(lyr) 966 return output 967 if isinstance(value, int): 968 if value > len(self) - 1: 969 raise IndexError 970 return self.GetLayer(value) 971 elif isinstance(value, str): 972 return self.GetLayer(value) 973 else: 974 raise TypeError('Input %s is not of String or Int type' % type(value))
975
976 - def GetLayer(self, iLayer=0):
977 """Return the layer given an index or a name""" 978 if isinstance(iLayer, str): 979 return self.GetLayerByName(str(iLayer)) 980 elif isinstance(iLayer, int): 981 return self.GetLayerByIndex(iLayer) 982 else: 983 raise TypeError("Input %s is not of String or Int type" % type(iLayer))
984
985 - def DeleteLayer(self, value):
986 """Deletes the layer given an index or layer name""" 987 if isinstance(value, str): 988 for i in range(self.GetLayerCount()): 989 name = self.GetLayer(i).GetName() 990 if name == value: 991 return _ogr.DataSource_DeleteLayer(self, i) 992 raise ValueError("Layer %s not found to delete" % value) 993 elif isinstance(value, int): 994 return _ogr.DataSource_DeleteLayer(self, value) 995 else: 996 raise TypeError("Input %s is not of String or Int type" % type(value))
997 998 999 # Register DataSource in _ogr: 1000 _ogr.DataSource_swigregister(DataSource) 1001
1002 -class Layer(MajorObject):
1003 r"""Proxy of C++ OGRLayerShadow class.""" 1004 1005 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 1006
1007 - def __init__(self, *args, **kwargs):
1008 raise AttributeError("No constructor defined")
1009 __repr__ = _swig_repr 1010
1011 - def GetRefCount(self, *args):
1012 r""" 1013 GetRefCount(Layer self) -> int 1014 int OGR_L_GetRefCount(OGRLayerH 1015 hLayer) 1016 """ 1017 return _ogr.Layer_GetRefCount(self, *args)
1018
1019 - def SetSpatialFilter(self, *args):
1020 r""" 1021 SetSpatialFilter(Layer self, Geometry filter) 1022 SetSpatialFilter(Layer self, int iGeomField, Geometry filter) 1023 void 1024 OGR_L_SetSpatialFilter(OGRLayerH hLayer, OGRGeometryH hGeom) 1025 1026 Set a new spatial filter. 1027 1028 This function set the geometry to be used as a spatial filter when 1029 fetching features via the OGR_L_GetNextFeature() function. Only 1030 features that geometrically intersect the filter geometry will be 1031 returned. 1032 1033 Currently this test is may be inaccurately implemented, but it is 1034 guaranteed that all features whose envelope (as returned by 1035 OGR_G_GetEnvelope()) overlaps the envelope of the spatial filter will 1036 be returned. This can result in more shapes being returned that should 1037 strictly be the case. 1038 1039 Starting with GDAL 2.3, features with null or empty geometries will 1040 never be considered as matching a spatial filter. 1041 1042 This function makes an internal copy of the passed geometry. The 1043 passed geometry remains the responsibility of the caller, and may be 1044 safely destroyed. 1045 1046 For the time being the passed filter geometry should be in the same 1047 SRS as the layer (as returned by OGR_L_GetSpatialRef()). In the future 1048 this may be generalized. 1049 1050 This function is the same as the C++ method 1051 OGRLayer::SetSpatialFilter. 1052 1053 Parameters: 1054 ----------- 1055 1056 hLayer: handle to the layer on which to set the spatial filter. 1057 1058 hGeom: handle to the geometry to use as a filtering region. NULL may 1059 be passed indicating that the current spatial filter should be 1060 cleared, but no new one instituted. 1061 """ 1062 return _ogr.Layer_SetSpatialFilter(self, *args)
1063
1064 - def SetSpatialFilterRect(self, *args):
1065 r""" 1066 SetSpatialFilterRect(Layer self, double minx, double miny, double maxx, double maxy) 1067 SetSpatialFilterRect(Layer self, int iGeomField, double minx, double miny, double maxx, double maxy) 1068 void 1069 OGR_L_SetSpatialFilterRect(OGRLayerH hLayer, double dfMinX, double 1070 dfMinY, double dfMaxX, double dfMaxY) 1071 1072 Set a new rectangular spatial filter. 1073 1074 This method set rectangle to be used as a spatial filter when fetching 1075 features via the OGR_L_GetNextFeature() method. Only features that 1076 geometrically intersect the given rectangle will be returned. 1077 1078 The x/y values should be in the same coordinate system as the layer as 1079 a whole (as returned by OGRLayer::GetSpatialRef()). Internally this 1080 method is normally implemented as creating a 5 vertex closed 1081 rectangular polygon and passing it to OGRLayer::SetSpatialFilter(). It 1082 exists as a convenience. 1083 1084 The only way to clear a spatial filter set with this method is to call 1085 OGRLayer::SetSpatialFilter(NULL). 1086 1087 This method is the same as the C++ method 1088 OGRLayer::SetSpatialFilterRect(). 1089 1090 Parameters: 1091 ----------- 1092 1093 hLayer: handle to the layer on which to set the spatial filter. 1094 1095 dfMinX: the minimum X coordinate for the rectangular region. 1096 1097 dfMinY: the minimum Y coordinate for the rectangular region. 1098 1099 dfMaxX: the maximum X coordinate for the rectangular region. 1100 1101 dfMaxY: the maximum Y coordinate for the rectangular region. 1102 """ 1103 return _ogr.Layer_SetSpatialFilterRect(self, *args)
1104
1105 - def GetSpatialFilter(self, *args):
1106 r""" 1107 GetSpatialFilter(Layer self) -> Geometry 1108 OGRGeometryH 1109 OGR_L_GetSpatialFilter(OGRLayerH hLayer) 1110 1111 This function returns the current spatial filter for this layer. 1112 1113 The returned pointer is to an internally owned object, and should not 1114 be altered or deleted by the caller. 1115 1116 This function is the same as the C++ method 1117 OGRLayer::GetSpatialFilter(). 1118 1119 Parameters: 1120 ----------- 1121 1122 hLayer: handle to the layer to get the spatial filter from. 1123 1124 a handle to the spatial filter geometry. 1125 """ 1126 return _ogr.Layer_GetSpatialFilter(self, *args)
1127
1128 - def SetAttributeFilter(self, *args):
1129 r""" 1130 SetAttributeFilter(Layer self, char * filter_string) -> OGRErr 1131 OGRErr 1132 OGR_L_SetAttributeFilter(OGRLayerH hLayer, const char *pszQuery) 1133 1134 Set a new attribute query. 1135 1136 This function sets the attribute query string to be used when fetching 1137 features via the OGR_L_GetNextFeature() function. Only features for 1138 which the query evaluates as true will be returned. 1139 1140 The query string should be in the format of an SQL WHERE clause. For 1141 instance "population > 1000000 and population < 5000000" where 1142 population is an attribute in the layer. The query format is a 1143 restricted form of SQL WHERE clause as defined 1144 "eq_format=restricted_where" about half way through this document: 1145 1146 http://ogdi.sourceforge.net/prop/6.2.CapabilitiesMetadata.html 1147 1148 Note that installing a query string will generally result in resetting 1149 the current reading position (ala OGR_L_ResetReading()). 1150 1151 This function is the same as the C++ method 1152 OGRLayer::SetAttributeFilter(). 1153 1154 Parameters: 1155 ----------- 1156 1157 hLayer: handle to the layer on which attribute query will be 1158 executed. 1159 1160 pszQuery: query in restricted SQL WHERE format, or NULL to clear the 1161 current query. 1162 1163 OGRERR_NONE if successfully installed, or an error code if the query 1164 expression is in error, or some other failure occurs. 1165 """ 1166 return _ogr.Layer_SetAttributeFilter(self, *args)
1167
1168 - def ResetReading(self, *args):
1169 r""" 1170 ResetReading(Layer self) 1171 void 1172 OGR_L_ResetReading(OGRLayerH hLayer) 1173 1174 Reset feature reading to start on the first feature. 1175 1176 This affects GetNextFeature(). 1177 1178 This function is the same as the C++ method OGRLayer::ResetReading(). 1179 1180 Parameters: 1181 ----------- 1182 1183 hLayer: handle to the layer on which features are read. 1184 """ 1185 return _ogr.Layer_ResetReading(self, *args)
1186
1187 - def GetName(self, *args):
1188 r""" 1189 GetName(Layer self) -> char const * 1190 const char* OGR_L_GetName(OGRLayerH 1191 hLayer) 1192 1193 Return the layer name. 1194 1195 This returns the same content as 1196 OGR_FD_GetName(OGR_L_GetLayerDefn(hLayer)), but for a few drivers, 1197 calling OGR_L_GetName() directly can avoid lengthy layer definition 1198 initialization. 1199 1200 This function is the same as the C++ method OGRLayer::GetName(). 1201 1202 Parameters: 1203 ----------- 1204 1205 hLayer: handle to the layer. 1206 1207 the layer name (must not been freed) 1208 1209 OGR 1.8.0 1210 """ 1211 return _ogr.Layer_GetName(self, *args)
1212
1213 - def GetGeomType(self, *args):
1214 r""" 1215 GetGeomType(Layer self) -> OGRwkbGeometryType 1216 OGRwkbGeometryType 1217 OGR_L_GetGeomType(OGRLayerH hLayer) 1218 1219 Return the layer geometry type. 1220 1221 This returns the same result as 1222 OGR_FD_GetGeomType(OGR_L_GetLayerDefn(hLayer)), but for a few drivers, 1223 calling OGR_L_GetGeomType() directly can avoid lengthy layer 1224 definition initialization. 1225 1226 For layers with multiple geometry fields, this method only returns the 1227 geometry type of the first geometry column. For other columns, use 1228 OGR_GFld_GetType(OGR_FD_GetGeomFieldDefn(OGR_L_GetLayerDefn(hLayer), 1229 i)). For layers without any geometry field, this method returns 1230 wkbNone. 1231 1232 This function is the same as the C++ method OGRLayer::GetGeomType(). 1233 1234 Parameters: 1235 ----------- 1236 1237 hLayer: handle to the layer. 1238 1239 the geometry type 1240 1241 OGR 1.8.0 1242 """ 1243 return _ogr.Layer_GetGeomType(self, *args)
1244
1245 - def GetGeometryColumn(self, *args):
1246 r""" 1247 GetGeometryColumn(Layer self) -> char const * 1248 const char* 1249 OGR_L_GetGeometryColumn(OGRLayerH hLayer) 1250 1251 This method returns the name of the underlying database column being 1252 used as the geometry column, or "" if not supported. 1253 1254 For layers with multiple geometry fields, this method only returns the 1255 geometry type of the first geometry column. For other columns, use OGR 1256 _GFld_GetNameRef(OGR_FD_GetGeomFieldDefn(OGR_L_GetLayerDefn(hLayer), 1257 i)). 1258 1259 This method is the same as the C++ method 1260 OGRLayer::GetGeometryColumn() 1261 1262 Parameters: 1263 ----------- 1264 1265 hLayer: handle to the layer 1266 1267 geometry column name. 1268 """ 1269 return _ogr.Layer_GetGeometryColumn(self, *args)
1270
1271 - def GetFIDColumn(self, *args):
1272 r""" 1273 GetFIDColumn(Layer self) -> char const * 1274 const char* 1275 OGR_L_GetFIDColumn(OGRLayerH hLayer) 1276 1277 This method returns the name of the underlying database column being 1278 used as the FID column, or "" if not supported. 1279 1280 This method is the same as the C++ method OGRLayer::GetFIDColumn() 1281 1282 Parameters: 1283 ----------- 1284 1285 hLayer: handle to the layer 1286 1287 fid column name. 1288 """ 1289 return _ogr.Layer_GetFIDColumn(self, *args)
1290
1291 - def GetFeature(self, *args):
1292 r""" 1293 GetFeature(Layer self, GIntBig fid) -> Feature 1294 OGRFeatureH 1295 OGR_L_GetFeature(OGRLayerH hLayer, GIntBig nFeatureId) 1296 1297 Fetch a feature by its identifier. 1298 1299 This function will attempt to read the identified feature. The nFID 1300 value cannot be OGRNullFID. Success or failure of this operation is 1301 unaffected by the spatial or attribute filters (and specialized 1302 implementations in drivers should make sure that they do not take into 1303 account spatial or attribute filters). 1304 1305 If this function returns a non-NULL feature, it is guaranteed that its 1306 feature id ( OGR_F_GetFID()) will be the same as nFID. 1307 1308 Use OGR_L_TestCapability(OLCRandomRead) to establish if this layer 1309 supports efficient random access reading via OGR_L_GetFeature(); 1310 however, the call should always work if the feature exists as a 1311 fallback implementation just scans all the features in the layer 1312 looking for the desired feature. 1313 1314 Sequential reads (with OGR_L_GetNextFeature()) are generally 1315 considered interrupted by a OGR_L_GetFeature() call. 1316 1317 The returned feature should be free with OGR_F_Destroy(). 1318 1319 This function is the same as the C++ method OGRLayer::GetFeature( ). 1320 1321 Parameters: 1322 ----------- 1323 1324 hLayer: handle to the layer that owned the feature. 1325 1326 nFeatureId: the feature id of the feature to read. 1327 1328 a handle to a feature now owned by the caller, or NULL on failure. 1329 """ 1330 return _ogr.Layer_GetFeature(self, *args)
1331
1332 - def GetNextFeature(self, *args):
1333 r""" 1334 GetNextFeature(Layer self) -> Feature 1335 OGRFeatureH 1336 OGR_L_GetNextFeature(OGRLayerH hLayer) 1337 1338 Fetch the next available feature from this layer. 1339 1340 The returned feature becomes the responsibility of the caller to 1341 delete with OGR_F_Destroy(). It is critical that all features 1342 associated with an OGRLayer (more specifically an OGRFeatureDefn) be 1343 deleted before that layer/datasource is deleted. 1344 1345 Only features matching the current spatial filter (set with 1346 SetSpatialFilter()) will be returned. 1347 1348 This function implements sequential access to the features of a layer. 1349 The OGR_L_ResetReading() function can be used to start at the 1350 beginning again. 1351 1352 Features returned by OGR_GetNextFeature() may or may not be affected 1353 by concurrent modifications depending on drivers. A guaranteed way of 1354 seeing modifications in effect is to call OGR_L_ResetReading() on 1355 layers where OGR_GetNextFeature() has been called, before reading 1356 again. Structural changes in layers (field addition, deletion, ...) 1357 when a read is in progress may or may not be possible depending on 1358 drivers. If a transaction is committed/aborted, the current sequential 1359 reading may or may not be valid after that operation and a call to 1360 OGR_L_ResetReading() might be needed. 1361 1362 This function is the same as the C++ method 1363 OGRLayer::GetNextFeature(). 1364 1365 Parameters: 1366 ----------- 1367 1368 hLayer: handle to the layer from which feature are read. 1369 1370 a handle to a feature, or NULL if no more features are available. 1371 """ 1372 return _ogr.Layer_GetNextFeature(self, *args)
1373
1374 - def SetNextByIndex(self, *args):
1375 r""" 1376 SetNextByIndex(Layer self, GIntBig new_index) -> OGRErr 1377 OGRErr 1378 OGR_L_SetNextByIndex(OGRLayerH hLayer, GIntBig nIndex) 1379 1380 Move read cursor to the nIndex'th feature in the current resultset. 1381 1382 This method allows positioning of a layer such that the 1383 GetNextFeature() call will read the requested feature, where nIndex is 1384 an absolute index into the current result set. So, setting it to 3 1385 would mean the next feature read with GetNextFeature() would have been 1386 the 4th feature to have been read if sequential reading took place 1387 from the beginning of the layer, including accounting for spatial and 1388 attribute filters. 1389 1390 Only in rare circumstances is SetNextByIndex() efficiently 1391 implemented. In all other cases the default implementation which calls 1392 ResetReading() and then calls GetNextFeature() nIndex times is used. 1393 To determine if fast seeking is available on the current layer use the 1394 TestCapability() method with a value of OLCFastSetNextByIndex. 1395 1396 This method is the same as the C++ method OGRLayer::SetNextByIndex() 1397 1398 Parameters: 1399 ----------- 1400 1401 hLayer: handle to the layer 1402 1403 nIndex: the index indicating how many steps into the result set to 1404 seek. 1405 1406 OGRERR_NONE on success or an error code. 1407 """ 1408 return _ogr.Layer_SetNextByIndex(self, *args)
1409
1410 - def SetFeature(self, *args):
1411 r""" 1412 SetFeature(Layer self, Feature feature) -> OGRErr 1413 OGRErr OGR_L_SetFeature(OGRLayerH 1414 hLayer, OGRFeatureH hFeat) 1415 1416 Rewrite an existing feature. 1417 1418 This function will write a feature to the layer, based on the feature 1419 id within the OGRFeature. 1420 1421 Use OGR_L_TestCapability(OLCRandomWrite) to establish if this layer 1422 supports random access writing via OGR_L_SetFeature(). 1423 1424 This function is the same as the C++ method OGRLayer::SetFeature(). 1425 1426 Parameters: 1427 ----------- 1428 1429 hLayer: handle to the layer to write the feature. 1430 1431 hFeat: the feature to write. 1432 1433 OGRERR_NONE if the operation works, otherwise an appropriate error 1434 code (e.g OGRERR_NON_EXISTING_FEATURE if the feature does not exist). 1435 1436 """ 1437 return _ogr.Layer_SetFeature(self, *args)
1438
1439 - def CreateFeature(self, *args):
1440 r""" 1441 CreateFeature(Layer self, Feature feature) -> OGRErr 1442 OGRErr 1443 OGR_L_CreateFeature(OGRLayerH hLayer, OGRFeatureH hFeat) 1444 1445 Create and write a new feature within a layer. 1446 1447 The passed feature is written to the layer as a new feature, rather 1448 than overwriting an existing one. If the feature has a feature id 1449 other than OGRNullFID, then the native implementation may use that as 1450 the feature id of the new feature, but not necessarily. Upon 1451 successful return the passed feature will have been updated with the 1452 new feature id. 1453 1454 This function is the same as the C++ method OGRLayer::CreateFeature(). 1455 1456 Parameters: 1457 ----------- 1458 1459 hLayer: handle to the layer to write the feature to. 1460 1461 hFeat: the handle of the feature to write to disk. 1462 1463 OGRERR_NONE on success. 1464 """ 1465 return _ogr.Layer_CreateFeature(self, *args)
1466
1467 - def DeleteFeature(self, *args):
1468 r""" 1469 DeleteFeature(Layer self, GIntBig fid) -> OGRErr 1470 OGRErr 1471 OGR_L_DeleteFeature(OGRLayerH hLayer, GIntBig nFID) 1472 1473 Delete feature from layer. 1474 1475 The feature with the indicated feature id is deleted from the layer if 1476 supported by the driver. Most drivers do not support feature deletion, 1477 and will return OGRERR_UNSUPPORTED_OPERATION. The 1478 OGR_L_TestCapability() function may be called with OLCDeleteFeature to 1479 check if the driver supports feature deletion. 1480 1481 This method is the same as the C++ method OGRLayer::DeleteFeature(). 1482 1483 Parameters: 1484 ----------- 1485 1486 hLayer: handle to the layer 1487 1488 nFID: the feature id to be deleted from the layer 1489 1490 OGRERR_NONE if the operation works, otherwise an appropriate error 1491 code (e.g OGRERR_NON_EXISTING_FEATURE if the feature does not exist). 1492 1493 """ 1494 return _ogr.Layer_DeleteFeature(self, *args)
1495
1496 - def SyncToDisk(self, *args):
1497 r""" 1498 SyncToDisk(Layer self) -> OGRErr 1499 OGRErr OGR_L_SyncToDisk(OGRLayerH 1500 hLayer) 1501 1502 Flush pending changes to disk. 1503 1504 This call is intended to force the layer to flush any pending writes 1505 to disk, and leave the disk file in a consistent state. It would not 1506 normally have any effect on read-only datasources. 1507 1508 Some layers do not implement this method, and will still return 1509 OGRERR_NONE. The default implementation just returns OGRERR_NONE. An 1510 error is only returned if an error occurs while attempting to flush to 1511 disk. 1512 1513 In any event, you should always close any opened datasource with 1514 OGR_DS_Destroy() that will ensure all data is correctly flushed. 1515 1516 This method is the same as the C++ method OGRLayer::SyncToDisk() 1517 1518 Parameters: 1519 ----------- 1520 1521 hLayer: handle to the layer 1522 1523 OGRERR_NONE if no error occurs (even if nothing is done) or an error 1524 code. 1525 """ 1526 return _ogr.Layer_SyncToDisk(self, *args)
1527
1528 - def GetLayerDefn(self, *args):
1529 r""" 1530 GetLayerDefn(Layer self) -> FeatureDefn 1531 OGRFeatureDefnH 1532 OGR_L_GetLayerDefn(OGRLayerH hLayer) 1533 1534 Fetch the schema information for this layer. 1535 1536 The returned handle to the OGRFeatureDefn is owned by the OGRLayer, 1537 and should not be modified or freed by the application. It 1538 encapsulates the attribute schema of the features of the layer. 1539 1540 This function is the same as the C++ method OGRLayer::GetLayerDefn(). 1541 1542 Parameters: 1543 ----------- 1544 1545 hLayer: handle to the layer to get the schema information. 1546 1547 a handle to the feature definition. 1548 """ 1549 return _ogr.Layer_GetLayerDefn(self, *args)
1550
1551 - def GetFeatureCount(self, *args, **kwargs):
1552 r""" 1553 GetFeatureCount(Layer self, int force=1) -> GIntBig 1554 GIntBig 1555 OGR_L_GetFeatureCount(OGRLayerH hLayer, int bForce) 1556 1557 Fetch the feature count in this layer. 1558 1559 Returns the number of features in the layer. For dynamic databases the 1560 count may not be exact. If bForce is FALSE, and it would be expensive 1561 to establish the feature count a value of -1 may be returned 1562 indicating that the count isn't know. If bForce is TRUE some 1563 implementations will actually scan the entire layer once to count 1564 objects. 1565 1566 The returned count takes the spatial filter into account. 1567 1568 Note that some implementations of this method may alter the read 1569 cursor of the layer. 1570 1571 This function is the same as the CPP OGRLayer::GetFeatureCount(). 1572 1573 Note: since GDAL 2.0, this method returns a GIntBig (previously a int) 1574 1575 Parameters: 1576 ----------- 1577 1578 hLayer: handle to the layer that owned the features. 1579 1580 bForce: Flag indicating whether the count should be computed even if 1581 it is expensive. 1582 1583 feature count, -1 if count not known. 1584 """ 1585 return _ogr.Layer_GetFeatureCount(self, *args, **kwargs)
1586
1587 - def GetExtent(self, *args, **kwargs):
1588 r""" 1589 GetExtent(Layer self, int force=1, int can_return_null=0, int geom_field=0) 1590 OGRErr OGR_L_GetExtent(OGRLayerH 1591 hLayer, OGREnvelope *psExtent, int bForce) 1592 1593 Fetch the extent of this layer. 1594 1595 Returns the extent (MBR) of the data in the layer. If bForce is FALSE, 1596 and it would be expensive to establish the extent then OGRERR_FAILURE 1597 will be returned indicating that the extent isn't know. If bForce is 1598 TRUE then some implementations will actually scan the entire layer 1599 once to compute the MBR of all the features in the layer. 1600 1601 Depending on the drivers, the returned extent may or may not take the 1602 spatial filter into account. So it is safer to call OGR_L_GetExtent() 1603 without setting a spatial filter. 1604 1605 Layers without any geometry may return OGRERR_FAILURE just indicating 1606 that no meaningful extents could be collected. 1607 1608 Note that some implementations of this method may alter the read 1609 cursor of the layer. 1610 1611 This function is the same as the C++ method OGRLayer::GetExtent(). 1612 1613 Parameters: 1614 ----------- 1615 1616 hLayer: handle to the layer from which to get extent. 1617 1618 psExtent: the structure in which the extent value will be returned. 1619 1620 bForce: Flag indicating whether the extent should be computed even if 1621 it is expensive. 1622 1623 OGRERR_NONE on success, OGRERR_FAILURE if extent not known. 1624 """ 1625 return _ogr.Layer_GetExtent(self, *args, **kwargs)
1626
1627 - def TestCapability(self, *args):
1628 r""" 1629 TestCapability(Layer self, char const * cap) -> bool 1630 int 1631 OGR_L_TestCapability(OGRLayerH hLayer, const char *pszCap) 1632 1633 Test if this layer supported the named capability. 1634 1635 The capability codes that can be tested are represented as strings, 1636 but #defined constants exists to ensure correct spelling. Specific 1637 layer types may implement class specific capabilities, but this can't 1638 generally be discovered by the caller. 1639 1640 OLCRandomRead / "RandomRead": TRUE if the GetFeature() method is 1641 implemented in an optimized way for this layer, as opposed to the 1642 default implementation using ResetReading() and GetNextFeature() to 1643 find the requested feature id. 1644 1645 OLCSequentialWrite / "SequentialWrite": TRUE if the CreateFeature() 1646 method works for this layer. Note this means that this particular 1647 layer is writable. The same OGRLayer class may returned FALSE for 1648 other layer instances that are effectively read-only. 1649 1650 OLCRandomWrite / "RandomWrite": TRUE if the SetFeature() method is 1651 operational on this layer. Note this means that this particular layer 1652 is writable. The same OGRLayer class may returned FALSE for other 1653 layer instances that are effectively read-only. 1654 1655 OLCFastSpatialFilter / "FastSpatialFilter": TRUE if this layer 1656 implements spatial filtering efficiently. Layers that effectively read 1657 all features, and test them with the OGRFeature intersection methods 1658 should return FALSE. This can be used as a clue by the application 1659 whether it should build and maintain its own spatial index for 1660 features in this layer. 1661 1662 OLCFastFeatureCount / "FastFeatureCount": TRUE if this layer can 1663 return a feature count (via OGR_L_GetFeatureCount()) efficiently, i.e. 1664 without counting the features. In some cases this will return TRUE 1665 until a spatial filter is installed after which it will return FALSE. 1666 1667 OLCFastGetExtent / "FastGetExtent": TRUE if this layer can return 1668 its data extent (via OGR_L_GetExtent()) efficiently, i.e. without 1669 scanning all the features. In some cases this will return TRUE until a 1670 spatial filter is installed after which it will return FALSE. 1671 1672 OLCFastSetNextByIndex / "FastSetNextByIndex": TRUE if this layer can 1673 perform the SetNextByIndex() call efficiently, otherwise FALSE. 1674 1675 OLCCreateField / "CreateField": TRUE if this layer can create new 1676 fields on the current layer using CreateField(), otherwise FALSE. 1677 1678 OLCCreateGeomField / "CreateGeomField": (GDAL >= 1.11) TRUE if this 1679 layer can create new geometry fields on the current layer using 1680 CreateGeomField(), otherwise FALSE. 1681 1682 OLCDeleteField / "DeleteField": TRUE if this layer can delete 1683 existing fields on the current layer using DeleteField(), otherwise 1684 FALSE. 1685 1686 OLCReorderFields / "ReorderFields": TRUE if this layer can reorder 1687 existing fields on the current layer using ReorderField() or 1688 ReorderFields(), otherwise FALSE. 1689 1690 OLCAlterFieldDefn / "AlterFieldDefn": TRUE if this layer can alter 1691 the definition of an existing field on the current layer using 1692 AlterFieldDefn(), otherwise FALSE. 1693 1694 OLCDeleteFeature / "DeleteFeature": TRUE if the DeleteFeature() 1695 method is supported on this layer, otherwise FALSE. 1696 1697 OLCStringsAsUTF8 / "StringsAsUTF8": TRUE if values of OFTString 1698 fields are assured to be in UTF-8 format. If FALSE the encoding of 1699 fields is uncertain, though it might still be UTF-8. 1700 1701 OLCTransactions / "Transactions": TRUE if the StartTransaction(), 1702 CommitTransaction() and RollbackTransaction() methods work in a 1703 meaningful way, otherwise FALSE. 1704 1705 OLCCurveGeometries / "CurveGeometries": TRUE if this layer supports 1706 writing curve geometries or may return such geometries. (GDAL 2.0). 1707 1708 This function is the same as the C++ method 1709 OGRLayer::TestCapability(). 1710 1711 Parameters: 1712 ----------- 1713 1714 hLayer: handle to the layer to get the capability from. 1715 1716 pszCap: the name of the capability to test. 1717 1718 TRUE if the layer has the requested capability, or FALSE otherwise. 1719 OGRLayers will return FALSE for any unrecognized capabilities. 1720 """ 1721 return _ogr.Layer_TestCapability(self, *args)
1722
1723 - def CreateField(self, *args, **kwargs):
1724 r""" 1725 CreateField(Layer self, FieldDefn field_def, int approx_ok=1) -> OGRErr 1726 OGRErr 1727 OGR_L_CreateField(OGRLayerH hLayer, OGRFieldDefnH hField, int 1728 bApproxOK) 1729 1730 Create a new field on a layer. 1731 1732 You must use this to create new fields on a real layer. Internally the 1733 OGRFeatureDefn for the layer will be updated to reflect the new field. 1734 Applications should never modify the OGRFeatureDefn used by a layer 1735 directly. 1736 1737 This function should not be called while there are feature objects in 1738 existence that were obtained or created with the previous layer 1739 definition. 1740 1741 Not all drivers support this function. You can query a layer to check 1742 if it supports it with the OLCCreateField capability. Some drivers may 1743 only support this method while there are still no features in the 1744 layer. When it is supported, the existing features of the backing 1745 file/database should be updated accordingly. 1746 1747 Drivers may or may not support not-null constraints. If they support 1748 creating fields with not-null constraints, this is generally before 1749 creating any feature to the layer. 1750 1751 This function is the same as the C++ method OGRLayer::CreateField(). 1752 1753 Parameters: 1754 ----------- 1755 1756 hLayer: handle to the layer to write the field definition. 1757 1758 hField: handle of the field definition to write to disk. 1759 1760 bApproxOK: If TRUE, the field may be created in a slightly different 1761 form depending on the limitations of the format driver. 1762 1763 OGRERR_NONE on success. 1764 """ 1765 return _ogr.Layer_CreateField(self, *args, **kwargs)
1766
1767 - def DeleteField(self, *args):
1768 r""" 1769 DeleteField(Layer self, int iField) -> OGRErr 1770 OGRErr 1771 OGR_L_DeleteField(OGRLayerH hLayer, int iField) 1772 1773 Delete an existing field on a layer. 1774 1775 You must use this to delete existing fields on a real layer. 1776 Internally the OGRFeatureDefn for the layer will be updated to reflect 1777 the deleted field. Applications should never modify the OGRFeatureDefn 1778 used by a layer directly. 1779 1780 This function should not be called while there are feature objects in 1781 existence that were obtained or created with the previous layer 1782 definition. 1783 1784 Not all drivers support this function. You can query a layer to check 1785 if it supports it with the OLCDeleteField capability. Some drivers may 1786 only support this method while there are still no features in the 1787 layer. When it is supported, the existing features of the backing 1788 file/database should be updated accordingly. 1789 1790 This function is the same as the C++ method OGRLayer::DeleteField(). 1791 1792 Parameters: 1793 ----------- 1794 1795 hLayer: handle to the layer. 1796 1797 iField: index of the field to delete. 1798 1799 OGRERR_NONE on success. 1800 1801 OGR 1.9.0 1802 """ 1803 return _ogr.Layer_DeleteField(self, *args)
1804
1805 - def ReorderField(self, *args):
1806 r""" 1807 ReorderField(Layer self, int iOldFieldPos, int iNewFieldPos) -> OGRErr 1808 OGRErr 1809 OGR_L_ReorderField(OGRLayerH hLayer, int iOldFieldPos, int 1810 iNewFieldPos) 1811 1812 Reorder an existing field on a layer. 1813 1814 This function is a convenience wrapper of OGR_L_ReorderFields() 1815 dedicated to move a single field. 1816 1817 You must use this to reorder existing fields on a real layer. 1818 Internally the OGRFeatureDefn for the layer will be updated to reflect 1819 the reordering of the fields. Applications should never modify the 1820 OGRFeatureDefn used by a layer directly. 1821 1822 This function should not be called while there are feature objects in 1823 existence that were obtained or created with the previous layer 1824 definition. 1825 1826 The field definition that was at initial position iOldFieldPos will be 1827 moved at position iNewFieldPos, and elements between will be shuffled 1828 accordingly. 1829 1830 For example, let suppose the fields were "0","1","2","3","4" 1831 initially. ReorderField(1, 3) will reorder them as 1832 "0","2","3","1","4". 1833 1834 Not all drivers support this function. You can query a layer to check 1835 if it supports it with the OLCReorderFields capability. Some drivers 1836 may only support this method while there are still no features in the 1837 layer. When it is supported, the existing features of the backing 1838 file/database should be updated accordingly. 1839 1840 This function is the same as the C++ method OGRLayer::ReorderField(). 1841 1842 Parameters: 1843 ----------- 1844 1845 hLayer: handle to the layer. 1846 1847 iOldFieldPos: previous position of the field to move. Must be in the 1848 range [0,GetFieldCount()-1]. 1849 1850 iNewFieldPos: new position of the field to move. Must be in the range 1851 [0,GetFieldCount()-1]. 1852 1853 OGRERR_NONE on success. 1854 1855 OGR 1.9.0 1856 """ 1857 return _ogr.Layer_ReorderField(self, *args)
1858
1859 - def ReorderFields(self, *args):
1860 r""" 1861 ReorderFields(Layer self, int nList) -> OGRErr 1862 OGRErr 1863 OGR_L_ReorderFields(OGRLayerH hLayer, int *panMap) 1864 1865 Reorder all the fields of a layer. 1866 1867 You must use this to reorder existing fields on a real layer. 1868 Internally the OGRFeatureDefn for the layer will be updated to reflect 1869 the reordering of the fields. Applications should never modify the 1870 OGRFeatureDefn used by a layer directly. 1871 1872 This function should not be called while there are feature objects in 1873 existence that were obtained or created with the previous layer 1874 definition. 1875 1876 panMap is such that,for each field definition at position i after 1877 reordering, its position before reordering was panMap[i]. 1878 1879 For example, let suppose the fields were "0","1","2","3","4" 1880 initially. ReorderFields([0,2,3,1,4]) will reorder them as 1881 "0","2","3","1","4". 1882 1883 Not all drivers support this function. You can query a layer to check 1884 if it supports it with the OLCReorderFields capability. Some drivers 1885 may only support this method while there are still no features in the 1886 layer. When it is supported, the existing features of the backing 1887 file/database should be updated accordingly. 1888 1889 This function is the same as the C++ method OGRLayer::ReorderFields(). 1890 1891 Parameters: 1892 ----------- 1893 1894 hLayer: handle to the layer. 1895 1896 panMap: an array of GetLayerDefn()-> OGRFeatureDefn::GetFieldCount() 1897 elements which is a permutation of [0, GetLayerDefn()-> 1898 OGRFeatureDefn::GetFieldCount()-1]. 1899 1900 OGRERR_NONE on success. 1901 1902 OGR 1.9.0 1903 """ 1904 return _ogr.Layer_ReorderFields(self, *args)
1905
1906 - def AlterFieldDefn(self, *args):
1907 r""" 1908 AlterFieldDefn(Layer self, int iField, FieldDefn field_def, int nFlags) -> OGRErr 1909 OGRErr 1910 OGR_L_AlterFieldDefn(OGRLayerH hLayer, int iField, OGRFieldDefnH 1911 hNewFieldDefn, int nFlags) 1912 1913 Alter the definition of an existing field on a layer. 1914 1915 You must use this to alter the definition of an existing field of a 1916 real layer. Internally the OGRFeatureDefn for the layer will be 1917 updated to reflect the altered field. Applications should never modify 1918 the OGRFeatureDefn used by a layer directly. 1919 1920 This function should not be called while there are feature objects in 1921 existence that were obtained or created with the previous layer 1922 definition. 1923 1924 Not all drivers support this function. You can query a layer to check 1925 if it supports it with the OLCAlterFieldDefn capability. Some drivers 1926 may only support this method while there are still no features in the 1927 layer. When it is supported, the existing features of the backing 1928 file/database should be updated accordingly. Some drivers might also 1929 not support all update flags. 1930 1931 This function is the same as the C++ method 1932 OGRLayer::AlterFieldDefn(). 1933 1934 Parameters: 1935 ----------- 1936 1937 hLayer: handle to the layer. 1938 1939 iField: index of the field whose definition must be altered. 1940 1941 hNewFieldDefn: new field definition 1942 1943 nFlags: combination of ALTER_NAME_FLAG, ALTER_TYPE_FLAG, 1944 ALTER_WIDTH_PRECISION_FLAG, ALTER_NULLABLE_FLAG and ALTER_DEFAULT_FLAG 1945 to indicate which of the name and/or type and/or width and precision 1946 fields and/or nullability from the new field definition must be taken 1947 into account. 1948 1949 OGRERR_NONE on success. 1950 1951 OGR 1.9.0 1952 """ 1953 return _ogr.Layer_AlterFieldDefn(self, *args)
1954
1955 - def CreateGeomField(self, *args, **kwargs):
1956 r""" 1957 CreateGeomField(Layer self, GeomFieldDefn field_def, int approx_ok=1) -> OGRErr 1958 OGRErr 1959 OGR_L_CreateGeomField(OGRLayerH hLayer, OGRGeomFieldDefnH hField, int 1960 bApproxOK) 1961 1962 Create a new geometry field on a layer. 1963 1964 You must use this to create new geometry fields on a real layer. 1965 Internally the OGRFeatureDefn for the layer will be updated to reflect 1966 the new field. Applications should never modify the OGRFeatureDefn 1967 used by a layer directly. 1968 1969 This function should not be called while there are feature objects in 1970 existence that were obtained or created with the previous layer 1971 definition. 1972 1973 Not all drivers support this function. You can query a layer to check 1974 if it supports it with the OLCCreateField capability. Some drivers may 1975 only support this method while there are still no features in the 1976 layer. When it is supported, the existing features of the backing 1977 file/database should be updated accordingly. 1978 1979 Drivers may or may not support not-null constraints. If they support 1980 creating fields with not-null constraints, this is generally before 1981 creating any feature to the layer. 1982 1983 This function is the same as the C++ method OGRLayer::CreateField(). 1984 1985 Parameters: 1986 ----------- 1987 1988 hLayer: handle to the layer to write the field definition. 1989 1990 hField: handle of the geometry field definition to write to disk. 1991 1992 bApproxOK: If TRUE, the field may be created in a slightly different 1993 form depending on the limitations of the format driver. 1994 1995 OGRERR_NONE on success. 1996 1997 OGR 1.11 1998 """ 1999 return _ogr.Layer_CreateGeomField(self, *args, **kwargs)
2000
2001 - def StartTransaction(self, *args):
2002 r""" 2003 StartTransaction(Layer self) -> OGRErr 2004 OGRErr 2005 OGR_L_StartTransaction(OGRLayerH hLayer) 2006 2007 For datasources which support transactions, StartTransaction creates a 2008 transaction. 2009 2010 If starting the transaction fails, will return OGRERR_FAILURE. 2011 Datasources which do not support transactions will always return 2012 OGRERR_NONE. 2013 2014 Note: as of GDAL 2.0, use of this API is discouraged when the dataset 2015 offers dataset level transaction with GDALDataset::StartTransaction(). 2016 The reason is that most drivers can only offer transactions at dataset 2017 level, and not layer level. Very few drivers really support 2018 transactions at layer scope. 2019 2020 This function is the same as the C++ method 2021 OGRLayer::StartTransaction(). 2022 2023 Parameters: 2024 ----------- 2025 2026 hLayer: handle to the layer 2027 2028 OGRERR_NONE on success. 2029 """ 2030 return _ogr.Layer_StartTransaction(self, *args)
2031
2032 - def CommitTransaction(self, *args):
2033 r""" 2034 CommitTransaction(Layer self) -> OGRErr 2035 OGRErr 2036 OGR_L_CommitTransaction(OGRLayerH hLayer) 2037 2038 For datasources which support transactions, CommitTransaction commits 2039 a transaction. 2040 2041 If no transaction is active, or the commit fails, will return 2042 OGRERR_FAILURE. Datasources which do not support transactions will 2043 always return OGRERR_NONE. 2044 2045 This function is the same as the C++ method 2046 OGRLayer::CommitTransaction(). 2047 2048 Parameters: 2049 ----------- 2050 2051 hLayer: handle to the layer 2052 2053 OGRERR_NONE on success. 2054 """ 2055 return _ogr.Layer_CommitTransaction(self, *args)
2056
2057 - def RollbackTransaction(self, *args):
2058 r""" 2059 RollbackTransaction(Layer self) -> OGRErr 2060 OGRErr 2061 OGR_L_RollbackTransaction(OGRLayerH hLayer) 2062 2063 For datasources which support transactions, RollbackTransaction will 2064 roll back a datasource to its state before the start of the current 2065 transaction. 2066 2067 If no transaction is active, or the rollback fails, will return 2068 OGRERR_FAILURE. Datasources which do not support transactions will 2069 always return OGRERR_NONE. 2070 2071 This function is the same as the C++ method 2072 OGRLayer::RollbackTransaction(). 2073 2074 Parameters: 2075 ----------- 2076 2077 hLayer: handle to the layer 2078 2079 OGRERR_NONE on success. 2080 """ 2081 return _ogr.Layer_RollbackTransaction(self, *args)
2082
2083 - def FindFieldIndex(self, *args):
2084 r""" 2085 FindFieldIndex(Layer self, char const * pszFieldName, int bExactMatch) -> int 2086 int 2087 OGR_L_FindFieldIndex(OGRLayerH hLayer, const char *pszFieldName, int 2088 bExactMatch) 2089 2090 Find the index of field in a layer. 2091 2092 The returned number is the index of the field in the layers, or -1 if 2093 the field doesn't exist. 2094 2095 If bExactMatch is set to FALSE and the field doesn't exists in the 2096 given form the driver might apply some changes to make it match, like 2097 those it might do if the layer was created (eg. like LAUNDER in the 2098 OCI driver). 2099 2100 This method is the same as the C++ method OGRLayer::FindFieldIndex(). 2101 2102 field index, or -1 if the field doesn't exist 2103 """ 2104 return _ogr.Layer_FindFieldIndex(self, *args)
2105
2106 - def GetSpatialRef(self, *args):
2107 r""" 2108 GetSpatialRef(Layer self) -> SpatialReference 2109 OGRSpatialReferenceH 2110 OGR_L_GetSpatialRef(OGRLayerH hLayer) 2111 2112 Fetch the spatial reference system for this layer. 2113 2114 The returned object is owned by the OGRLayer and should not be 2115 modified or freed by the application. 2116 2117 This function is the same as the C++ method OGRLayer::GetSpatialRef(). 2118 2119 Parameters: 2120 ----------- 2121 2122 hLayer: handle to the layer to get the spatial reference from. 2123 2124 spatial reference, or NULL if there isn't one. 2125 """ 2126 return _ogr.Layer_GetSpatialRef(self, *args)
2127
2128 - def GetFeaturesRead(self, *args):
2129 r""" 2130 GetFeaturesRead(Layer self) -> GIntBig 2131 GIntBig 2132 OGR_L_GetFeaturesRead(OGRLayerH hLayer) 2133 """ 2134 return _ogr.Layer_GetFeaturesRead(self, *args)
2135
2136 - def SetIgnoredFields(self, *args):
2137 r""" 2138 SetIgnoredFields(Layer self, char const ** options) -> OGRErr 2139 OGRErr 2140 OGR_L_SetIgnoredFields(OGRLayerH hLayer, const char **papszFields) 2141 2142 Set which fields can be omitted when retrieving features from the 2143 layer. 2144 2145 If the driver supports this functionality (testable using 2146 OLCIgnoreFields capability), it will not fetch the specified fields in 2147 subsequent calls to GetFeature() / GetNextFeature() and thus save some 2148 processing time and/or bandwidth. 2149 2150 Besides field names of the layers, the following special fields can be 2151 passed: "OGR_GEOMETRY" to ignore geometry and "OGR_STYLE" to 2152 ignore layer style. 2153 2154 By default, no fields are ignored. 2155 2156 This method is the same as the C++ method OGRLayer::SetIgnoredFields() 2157 2158 Parameters: 2159 ----------- 2160 2161 papszFields: an array of field names terminated by NULL item. If NULL 2162 is passed, the ignored list is cleared. 2163 2164 OGRERR_NONE if all field names have been resolved (even if the driver 2165 does not support this method) 2166 """ 2167 return _ogr.Layer_SetIgnoredFields(self, *args)
2168
2169 - def Intersection(self, *args, **kwargs):
2170 r""" 2171 Intersection(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2172 OGRErr 2173 OGR_L_Intersection(OGRLayerH pLayerInput, OGRLayerH pLayerMethod, 2174 OGRLayerH pLayerResult, char **papszOptions, GDALProgressFunc 2175 pfnProgress, void *pProgressArg) 2176 2177 Intersection of two layers. 2178 2179 The result layer contains features whose geometries represent areas 2180 that are common between features in the input layer and in the method 2181 layer. The features in the result layer have attributes from both 2182 input and method layers. The schema of the result layer can be set by 2183 the user or, if it is empty, is initialized to contain all fields in 2184 the input and method layers. 2185 2186 If the schema of the result is set by user and contains fields that 2187 have the same name as a field in input and in method layer, then the 2188 attribute in the result feature will get the value from the feature of 2189 the method layer. 2190 2191 For best performance use the minimum amount of features in the method 2192 layer and copy it into a memory layer. 2193 2194 This method relies on GEOS support. Do not use unless the GEOS support 2195 is compiled in. The recognized list of options is : 2196 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2197 could not be inserted or a GEOS call failed. 2198 2199 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2200 MultiPolygons, or LineStrings to MultiLineStrings. 2201 2202 INPUT_PREFIX=string. Set a prefix for the field names that will be 2203 created from the fields of the input layer. 2204 2205 METHOD_PREFIX=string. Set a prefix for the field names that will be 2206 created from the fields of the method layer. 2207 2208 USE_PREPARED_GEOMETRIES=YES/NO. Set to NO to not use prepared 2209 geometries to pretest intersection of features of method layer with 2210 features of this layer. 2211 2212 PRETEST_CONTAINMENT=YES/NO. Set to YES to pretest the containment of 2213 features of method layer within the features of this layer. This will 2214 speed up the method significantly in some cases. Requires that the 2215 prepared geometries are in effect. 2216 2217 KEEP_LOWER_DIMENSION_GEOMETRIES=YES/NO. Set to NO to skip result 2218 features with lower dimension geometry that would otherwise be added 2219 to the result layer. The default is to add but only if the result 2220 layer has an unknown geometry type. 2221 2222 This function is the same as the C++ method OGRLayer::Intersection(). 2223 2224 Parameters: 2225 ----------- 2226 2227 pLayerInput: the input layer. Should not be NULL. 2228 2229 pLayerMethod: the method layer. Should not be NULL. 2230 2231 pLayerResult: the layer where the features resulting from the 2232 operation are inserted. Should not be NULL. See above the note about 2233 the schema. 2234 2235 papszOptions: NULL terminated list of options (may be NULL). 2236 2237 pfnProgress: a GDALProgressFunc() compatible callback function for 2238 reporting progress or NULL. 2239 2240 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2241 2242 an error code if there was an error or the execution was interrupted, 2243 OGRERR_NONE otherwise. 2244 2245 The first geometry field is always used. 2246 2247 OGR 1.10 2248 """ 2249 return _ogr.Layer_Intersection(self, *args, **kwargs)
2250
2251 - def Union(self, *args, **kwargs):
2252 r""" 2253 Union(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2254 OGRErr OGR_L_Union(OGRLayerH 2255 pLayerInput, OGRLayerH pLayerMethod, OGRLayerH pLayerResult, char 2256 **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg) 2257 2258 Union of two layers. 2259 2260 The result layer contains features whose geometries represent areas 2261 that are in either in the input layer, in the method layer, or in 2262 both. The features in the result layer have attributes from both input 2263 and method layers. For features which represent areas that are only in 2264 the input or in the method layer the respective attributes have 2265 undefined values. The schema of the result layer can be set by the 2266 user or, if it is empty, is initialized to contain all fields in the 2267 input and method layers. 2268 2269 If the schema of the result is set by user and contains fields that 2270 have the same name as a field in input and in method layer, then the 2271 attribute in the result feature will get the value from the feature of 2272 the method layer (even if it is undefined). 2273 2274 For best performance use the minimum amount of features in the method 2275 layer and copy it into a memory layer. 2276 2277 This method relies on GEOS support. Do not use unless the GEOS support 2278 is compiled in. The recognized list of options is : 2279 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2280 could not be inserted or a GEOS call failed. 2281 2282 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2283 MultiPolygons, or LineStrings to MultiLineStrings. 2284 2285 INPUT_PREFIX=string. Set a prefix for the field names that will be 2286 created from the fields of the input layer. 2287 2288 METHOD_PREFIX=string. Set a prefix for the field names that will be 2289 created from the fields of the method layer. 2290 2291 USE_PREPARED_GEOMETRIES=YES/NO. Set to NO to not use prepared 2292 geometries to pretest intersection of features of method layer with 2293 features of this layer. 2294 2295 KEEP_LOWER_DIMENSION_GEOMETRIES=YES/NO. Set to NO to skip result 2296 features with lower dimension geometry that would otherwise be added 2297 to the result layer. The default is to add but only if the result 2298 layer has an unknown geometry type. 2299 2300 This function is the same as the C++ method OGRLayer::Union(). 2301 2302 Parameters: 2303 ----------- 2304 2305 pLayerInput: the input layer. Should not be NULL. 2306 2307 pLayerMethod: the method layer. Should not be NULL. 2308 2309 pLayerResult: the layer where the features resulting from the 2310 operation are inserted. Should not be NULL. See above the note about 2311 the schema. 2312 2313 papszOptions: NULL terminated list of options (may be NULL). 2314 2315 pfnProgress: a GDALProgressFunc() compatible callback function for 2316 reporting progress or NULL. 2317 2318 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2319 2320 an error code if there was an error or the execution was interrupted, 2321 OGRERR_NONE otherwise. 2322 2323 The first geometry field is always used. 2324 2325 OGR 1.10 2326 """ 2327 return _ogr.Layer_Union(self, *args, **kwargs)
2328
2329 - def SymDifference(self, *args, **kwargs):
2330 r""" 2331 SymDifference(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2332 OGRErr 2333 OGR_L_SymDifference(OGRLayerH pLayerInput, OGRLayerH pLayerMethod, 2334 OGRLayerH pLayerResult, char **papszOptions, GDALProgressFunc 2335 pfnProgress, void *pProgressArg) 2336 2337 Symmetrical difference of two layers. 2338 2339 The result layer contains features whose geometries represent areas 2340 that are in either in the input layer or in the method layer but not 2341 in both. The features in the result layer have attributes from both 2342 input and method layers. For features which represent areas that are 2343 only in the input or in the method layer the respective attributes 2344 have undefined values. The schema of the result layer can be set by 2345 the user or, if it is empty, is initialized to contain all fields in 2346 the input and method layers. 2347 2348 If the schema of the result is set by user and contains fields that 2349 have the same name as a field in input and in method layer, then the 2350 attribute in the result feature will get the value from the feature of 2351 the method layer (even if it is undefined). 2352 2353 For best performance use the minimum amount of features in the method 2354 layer and copy it into a memory layer. 2355 2356 This method relies on GEOS support. Do not use unless the GEOS support 2357 is compiled in. The recognized list of options is : 2358 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2359 could not be inserted or a GEOS call failed. 2360 2361 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2362 MultiPolygons, or LineStrings to MultiLineStrings. 2363 2364 INPUT_PREFIX=string. Set a prefix for the field names that will be 2365 created from the fields of the input layer. 2366 2367 METHOD_PREFIX=string. Set a prefix for the field names that will be 2368 created from the fields of the method layer. 2369 2370 This function is the same as the C++ method OGRLayer::SymDifference(). 2371 2372 Parameters: 2373 ----------- 2374 2375 pLayerInput: the input layer. Should not be NULL. 2376 2377 pLayerMethod: the method layer. Should not be NULL. 2378 2379 pLayerResult: the layer where the features resulting from the 2380 operation are inserted. Should not be NULL. See above the note about 2381 the schema. 2382 2383 papszOptions: NULL terminated list of options (may be NULL). 2384 2385 pfnProgress: a GDALProgressFunc() compatible callback function for 2386 reporting progress or NULL. 2387 2388 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2389 2390 an error code if there was an error or the execution was interrupted, 2391 OGRERR_NONE otherwise. 2392 2393 The first geometry field is always used. 2394 2395 OGR 1.10 2396 """ 2397 return _ogr.Layer_SymDifference(self, *args, **kwargs)
2398
2399 - def Identity(self, *args, **kwargs):
2400 r""" 2401 Identity(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2402 OGRErr OGR_L_Identity(OGRLayerH 2403 pLayerInput, OGRLayerH pLayerMethod, OGRLayerH pLayerResult, char 2404 **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg) 2405 2406 Identify the features of this layer with the ones from the identity 2407 layer. 2408 2409 The result layer contains features whose geometries represent areas 2410 that are in the input layer. The features in the result layer have 2411 attributes from both input and method layers. The schema of the result 2412 layer can be set by the user or, if it is empty, is initialized to 2413 contain all fields in input and method layers. 2414 2415 If the schema of the result is set by user and contains fields that 2416 have the same name as a field in input and in method layer, then the 2417 attribute in the result feature will get the value from the feature of 2418 the method layer (even if it is undefined). 2419 2420 For best performance use the minimum amount of features in the method 2421 layer and copy it into a memory layer. 2422 2423 This method relies on GEOS support. Do not use unless the GEOS support 2424 is compiled in. The recognized list of options is : 2425 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2426 could not be inserted or a GEOS call failed. 2427 2428 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2429 MultiPolygons, or LineStrings to MultiLineStrings. 2430 2431 INPUT_PREFIX=string. Set a prefix for the field names that will be 2432 created from the fields of the input layer. 2433 2434 METHOD_PREFIX=string. Set a prefix for the field names that will be 2435 created from the fields of the method layer. 2436 2437 USE_PREPARED_GEOMETRIES=YES/NO. Set to NO to not use prepared 2438 geometries to pretest intersection of features of method layer with 2439 features of this layer. 2440 2441 KEEP_LOWER_DIMENSION_GEOMETRIES=YES/NO. Set to NO to skip result 2442 features with lower dimension geometry that would otherwise be added 2443 to the result layer. The default is to add but only if the result 2444 layer has an unknown geometry type. 2445 2446 This function is the same as the C++ method OGRLayer::Identity(). 2447 2448 Parameters: 2449 ----------- 2450 2451 pLayerInput: the input layer. Should not be NULL. 2452 2453 pLayerMethod: the method layer. Should not be NULL. 2454 2455 pLayerResult: the layer where the features resulting from the 2456 operation are inserted. Should not be NULL. See above the note about 2457 the schema. 2458 2459 papszOptions: NULL terminated list of options (may be NULL). 2460 2461 pfnProgress: a GDALProgressFunc() compatible callback function for 2462 reporting progress or NULL. 2463 2464 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2465 2466 an error code if there was an error or the execution was interrupted, 2467 OGRERR_NONE otherwise. 2468 2469 The first geometry field is always used. 2470 2471 OGR 1.10 2472 """ 2473 return _ogr.Layer_Identity(self, *args, **kwargs)
2474
2475 - def Update(self, *args, **kwargs):
2476 r""" 2477 Update(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2478 OGRErr OGR_L_Update(OGRLayerH 2479 pLayerInput, OGRLayerH pLayerMethod, OGRLayerH pLayerResult, char 2480 **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg) 2481 2482 Update this layer with features from the update layer. 2483 2484 The result layer contains features whose geometries represent areas 2485 that are either in the input layer or in the method layer. The 2486 features in the result layer have areas of the features of the method 2487 layer or those ares of the features of the input layer that are not 2488 covered by the method layer. The features of the result layer get 2489 their attributes from the input layer. The schema of the result layer 2490 can be set by the user or, if it is empty, is initialized to contain 2491 all fields in the input layer. 2492 2493 If the schema of the result is set by user and contains fields that 2494 have the same name as a field in the method layer, then the attribute 2495 in the result feature the originates from the method layer will get 2496 the value from the feature of the method layer. 2497 2498 For best performance use the minimum amount of features in the method 2499 layer and copy it into a memory layer. 2500 2501 This method relies on GEOS support. Do not use unless the GEOS support 2502 is compiled in. The recognized list of options is : 2503 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2504 could not be inserted or a GEOS call failed. 2505 2506 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2507 MultiPolygons, or LineStrings to MultiLineStrings. 2508 2509 INPUT_PREFIX=string. Set a prefix for the field names that will be 2510 created from the fields of the input layer. 2511 2512 METHOD_PREFIX=string. Set a prefix for the field names that will be 2513 created from the fields of the method layer. 2514 2515 This function is the same as the C++ method OGRLayer::Update(). 2516 2517 Parameters: 2518 ----------- 2519 2520 pLayerInput: the input layer. Should not be NULL. 2521 2522 pLayerMethod: the method layer. Should not be NULL. 2523 2524 pLayerResult: the layer where the features resulting from the 2525 operation are inserted. Should not be NULL. See above the note about 2526 the schema. 2527 2528 papszOptions: NULL terminated list of options (may be NULL). 2529 2530 pfnProgress: a GDALProgressFunc() compatible callback function for 2531 reporting progress or NULL. 2532 2533 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2534 2535 an error code if there was an error or the execution was interrupted, 2536 OGRERR_NONE otherwise. 2537 2538 The first geometry field is always used. 2539 2540 OGR 1.10 2541 """ 2542 return _ogr.Layer_Update(self, *args, **kwargs)
2543
2544 - def Clip(self, *args, **kwargs):
2545 r""" 2546 Clip(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2547 OGRErr OGR_L_Clip(OGRLayerH pLayerInput, 2548 OGRLayerH pLayerMethod, OGRLayerH pLayerResult, char **papszOptions, 2549 GDALProgressFunc pfnProgress, void *pProgressArg) 2550 2551 Clip off areas that are not covered by the method layer. 2552 2553 The result layer contains features whose geometries represent areas 2554 that are in the input layer and in the method layer. The features in 2555 the result layer have the (possibly clipped) areas of features in the 2556 input layer and the attributes from the same features. The schema of 2557 the result layer can be set by the user or, if it is empty, is 2558 initialized to contain all fields in the input layer. 2559 2560 For best performance use the minimum amount of features in the method 2561 layer and copy it into a memory layer. 2562 2563 This method relies on GEOS support. Do not use unless the GEOS support 2564 is compiled in. The recognized list of options is : 2565 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2566 could not be inserted or a GEOS call failed. 2567 2568 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2569 MultiPolygons, or LineStrings to MultiLineStrings. 2570 2571 INPUT_PREFIX=string. Set a prefix for the field names that will be 2572 created from the fields of the input layer. 2573 2574 METHOD_PREFIX=string. Set a prefix for the field names that will be 2575 created from the fields of the method layer. 2576 2577 This function is the same as the C++ method OGRLayer::Clip(). 2578 2579 Parameters: 2580 ----------- 2581 2582 pLayerInput: the input layer. Should not be NULL. 2583 2584 pLayerMethod: the method layer. Should not be NULL. 2585 2586 pLayerResult: the layer where the features resulting from the 2587 operation are inserted. Should not be NULL. See above the note about 2588 the schema. 2589 2590 papszOptions: NULL terminated list of options (may be NULL). 2591 2592 pfnProgress: a GDALProgressFunc() compatible callback function for 2593 reporting progress or NULL. 2594 2595 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2596 2597 an error code if there was an error or the execution was interrupted, 2598 OGRERR_NONE otherwise. 2599 2600 The first geometry field is always used. 2601 2602 OGR 1.10 2603 """ 2604 return _ogr.Layer_Clip(self, *args, **kwargs)
2605
2606 - def Erase(self, *args, **kwargs):
2607 r""" 2608 Erase(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, void * callback_data=None) -> OGRErr 2609 OGRErr OGR_L_Erase(OGRLayerH 2610 pLayerInput, OGRLayerH pLayerMethod, OGRLayerH pLayerResult, char 2611 **papszOptions, GDALProgressFunc pfnProgress, void *pProgressArg) 2612 2613 Remove areas that are covered by the method layer. 2614 2615 The result layer contains features whose geometries represent areas 2616 that are in the input layer but not in the method layer. The features 2617 in the result layer have attributes from the input layer. The schema 2618 of the result layer can be set by the user or, if it is empty, is 2619 initialized to contain all fields in the input layer. 2620 2621 For best performance use the minimum amount of features in the method 2622 layer and copy it into a memory layer. 2623 2624 This method relies on GEOS support. Do not use unless the GEOS support 2625 is compiled in. The recognized list of options is : 2626 SKIP_FAILURES=YES/NO. Set it to YES to go on, even when a feature 2627 could not be inserted or a GEOS call failed. 2628 2629 PROMOTE_TO_MULTI=YES/NO. Set it to YES to convert Polygons into 2630 MultiPolygons, or LineStrings to MultiLineStrings. 2631 2632 INPUT_PREFIX=string. Set a prefix for the field names that will be 2633 created from the fields of the input layer. 2634 2635 METHOD_PREFIX=string. Set a prefix for the field names that will be 2636 created from the fields of the method layer. 2637 2638 This function is the same as the C++ method OGRLayer::Erase(). 2639 2640 Parameters: 2641 ----------- 2642 2643 pLayerInput: the input layer. Should not be NULL. 2644 2645 pLayerMethod: the method layer. Should not be NULL. 2646 2647 pLayerResult: the layer where the features resulting from the 2648 operation are inserted. Should not be NULL. See above the note about 2649 the schema. 2650 2651 papszOptions: NULL terminated list of options (may be NULL). 2652 2653 pfnProgress: a GDALProgressFunc() compatible callback function for 2654 reporting progress or NULL. 2655 2656 pProgressArg: argument to be passed to pfnProgress. May be NULL. 2657 2658 an error code if there was an error or the execution was interrupted, 2659 OGRERR_NONE otherwise. 2660 2661 The first geometry field is always used. 2662 2663 OGR 1.10 2664 """ 2665 return _ogr.Layer_Erase(self, *args, **kwargs)
2666
2667 - def GetStyleTable(self, *args):
2668 r""" 2669 GetStyleTable(Layer self) -> StyleTable 2670 OGRStyleTableH 2671 OGR_L_GetStyleTable(OGRLayerH hLayer) 2672 2673 Get style table. 2674 """ 2675 return _ogr.Layer_GetStyleTable(self, *args)
2676
2677 - def SetStyleTable(self, *args):
2678 r""" 2679 SetStyleTable(Layer self, StyleTable table) 2680 void 2681 OGR_L_SetStyleTable(OGRLayerH hLayer, OGRStyleTableH hStyleTable) 2682 2683 Set style table. 2684 """ 2685 return _ogr.Layer_SetStyleTable(self, *args)
2686
2687 - def Reference(self):
2688 "For backwards compatibility only." 2689 pass
2690
2691 - def Dereference(self):
2692 "For backwards compatibility only." 2693 pass
2694
2695 - def __len__(self):
2696 """Returns the number of features in the layer""" 2697 return self.GetFeatureCount()
2698 2699 # To avoid __len__ being called when testing boolean value 2700 # which can have side effects (#4758)
2701 - def __nonzero__(self):
2702 return True
2703 2704 # For Python 3 compat 2705 __bool__ = __nonzero__ 2706
2707 - def __getitem__(self, value):
2708 """Support list and slice -like access to the layer. 2709 layer[0] would return the first feature on the layer. 2710 layer[0:4] would return a list of the first four features.""" 2711 if isinstance(value, slice): 2712 import sys 2713 output = [] 2714 if value.stop == sys.maxsize: 2715 #for an unending slice, sys.maxsize is used 2716 #We need to stop before that or GDAL will write an 2717 ##error to stdout 2718 stop = len(self) - 1 2719 else: 2720 stop = value.stop 2721 for i in range(value.start, stop, value.step): 2722 feature = self.GetFeature(i) 2723 if feature: 2724 output.append(feature) 2725 else: 2726 return output 2727 return output 2728 if isinstance(value, int): 2729 if value > len(self) - 1: 2730 raise IndexError 2731 return self.GetFeature(value) 2732 else: 2733 raise TypeError("Input %s is not of IntType or SliceType" % type(value))
2734
2735 - def CreateFields(self, fields):
2736 """Create a list of fields on the Layer""" 2737 for i in fields: 2738 self.CreateField(i)
2739
2740 - def __iter__(self):
2741 self.ResetReading() 2742 while True: 2743 feature = self.GetNextFeature() 2744 if not feature: 2745 break 2746 yield feature
2747
2748 - def schema(self):
2749 output = [] 2750 defn = self.GetLayerDefn() 2751 for n in range(defn.GetFieldCount()): 2752 output.append(defn.GetFieldDefn(n)) 2753 return output
2754 schema = property(schema)
2755 2756 2757 2758 # Register Layer in _ogr: 2759 _ogr.Layer_swigregister(Layer) 2760
2761 -class Feature(object):
2762 r"""Proxy of C++ OGRFeatureShadow class.""" 2763 2764 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 2765 __repr__ = _swig_repr 2766 __swig_destroy__ = _ogr.delete_Feature 2767
2768 - def __init__(self, *args, **kwargs):
2769 r"""__init__(Feature self, FeatureDefn feature_def) -> Feature""" 2770 _ogr.Feature_swiginit(self, _ogr.new_Feature(*args, **kwargs))
2771
2772 - def GetDefnRef(self, *args):
2773 r""" 2774 GetDefnRef(Feature self) -> FeatureDefn 2775 OGRFeatureDefnH 2776 OGR_F_GetDefnRef(OGRFeatureH hFeat) 2777 2778 Fetch feature definition. 2779 2780 This function is the same as the C++ method OGRFeature::GetDefnRef(). 2781 2782 Parameters: 2783 ----------- 2784 2785 hFeat: handle to the feature to get the feature definition from. 2786 2787 a handle to the feature definition object on which feature depends. 2788 2789 """ 2790 return _ogr.Feature_GetDefnRef(self, *args)
2791
2792 - def SetGeometry(self, *args):
2793 r""" 2794 SetGeometry(Feature self, Geometry geom) -> OGRErr 2795 OGRErr 2796 OGR_F_SetGeometry(OGRFeatureH hFeat, OGRGeometryH hGeom) 2797 2798 Set feature geometry. 2799 2800 This function updates the features geometry, and operate exactly as 2801 SetGeometryDirectly(), except that this function does not assume 2802 ownership of the passed geometry, but instead makes a copy of it. 2803 2804 This function is the same as the C++ OGRFeature::SetGeometry(). 2805 2806 This method has only an effect on the in-memory feature object. If 2807 this object comes from a layer and the modifications must be 2808 serialized back to the datasource, OGR_L_SetFeature() must be used 2809 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 2810 used afterwards. 2811 2812 Parameters: 2813 ----------- 2814 2815 hFeat: handle to the feature on which new geometry is applied to. 2816 2817 hGeom: handle to the new geometry to apply to feature. 2818 2819 OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the 2820 geometry type is illegal for the OGRFeatureDefn (checking not yet 2821 implemented). 2822 """ 2823 return _ogr.Feature_SetGeometry(self, *args)
2824
2825 - def SetGeometryDirectly(self, *args):
2826 r""" 2827 SetGeometryDirectly(Feature self, Geometry geom) -> OGRErr 2828 OGRErr 2829 OGR_F_SetGeometryDirectly(OGRFeatureH hFeat, OGRGeometryH hGeom) 2830 2831 Set feature geometry. 2832 2833 This function updates the features geometry, and operate exactly as 2834 SetGeometry(), except that this function assumes ownership of the 2835 passed geometry (even in case of failure of that function). 2836 2837 This function is the same as the C++ method 2838 OGRFeature::SetGeometryDirectly. 2839 2840 This method has only an effect on the in-memory feature object. If 2841 this object comes from a layer and the modifications must be 2842 serialized back to the datasource, OGR_L_SetFeature() must be used 2843 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 2844 used afterwards. 2845 2846 Parameters: 2847 ----------- 2848 2849 hFeat: handle to the feature on which to apply the geometry. 2850 2851 hGeom: handle to the new geometry to apply to feature. 2852 2853 OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the 2854 geometry type is illegal for the OGRFeatureDefn (checking not yet 2855 implemented). 2856 """ 2857 return _ogr.Feature_SetGeometryDirectly(self, *args)
2858
2859 - def GetGeometryRef(self, *args):
2860 r""" 2861 GetGeometryRef(Feature self) -> Geometry 2862 OGRGeometryH 2863 OGR_F_GetGeometryRef(OGRFeatureH hFeat) 2864 2865 Fetch a handle to feature geometry. 2866 2867 This function is essentially the same as the C++ method 2868 OGRFeature::GetGeometryRef() (the only difference is that this C 2869 function honours OGRGetNonLinearGeometriesEnabledFlag()) 2870 2871 Parameters: 2872 ----------- 2873 2874 hFeat: handle to the feature to get geometry from. 2875 2876 a handle to internal feature geometry. This object should not be 2877 modified. 2878 """ 2879 return _ogr.Feature_GetGeometryRef(self, *args)
2880
2881 - def SetGeomField(self, *args):
2882 r""" 2883 SetGeomField(Feature self, int iField, Geometry geom) -> OGRErr 2884 SetGeomField(Feature self, char const * field_name, Geometry geom) -> OGRErr 2885 OGRErr 2886 OGR_F_SetGeomField(OGRFeatureH hFeat, int iField, OGRGeometryH hGeom) 2887 2888 Set feature geometry of a specified geometry field. 2889 2890 This function updates the features geometry, and operate exactly as 2891 SetGeometryDirectly(), except that this function does not assume 2892 ownership of the passed geometry, but instead makes a copy of it. 2893 2894 This function is the same as the C++ OGRFeature::SetGeomField(). 2895 2896 Parameters: 2897 ----------- 2898 2899 hFeat: handle to the feature on which new geometry is applied to. 2900 2901 iField: geometry field to set. 2902 2903 hGeom: handle to the new geometry to apply to feature. 2904 2905 OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the 2906 geometry type is illegal for the OGRFeatureDefn (checking not yet 2907 implemented). 2908 """ 2909 return _ogr.Feature_SetGeomField(self, *args)
2910
2911 - def SetGeomFieldDirectly(self, *args):
2912 r""" 2913 SetGeomFieldDirectly(Feature self, int iField, Geometry geom) -> OGRErr 2914 SetGeomFieldDirectly(Feature self, char const * field_name, Geometry geom) -> OGRErr 2915 OGRErr 2916 OGR_F_SetGeomFieldDirectly(OGRFeatureH hFeat, int iField, OGRGeometryH 2917 hGeom) 2918 2919 Set feature geometry of a specified geometry field. 2920 2921 This function updates the features geometry, and operate exactly as 2922 SetGeomField(), except that this function assumes ownership of the 2923 passed geometry (even in case of failure of that function). 2924 2925 This function is the same as the C++ method 2926 OGRFeature::SetGeomFieldDirectly. 2927 2928 Parameters: 2929 ----------- 2930 2931 hFeat: handle to the feature on which to apply the geometry. 2932 2933 iField: geometry field to set. 2934 2935 hGeom: handle to the new geometry to apply to feature. 2936 2937 OGRERR_NONE if successful, or OGRERR_FAILURE if the index is invalid, 2938 or OGR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for 2939 the OGRFeatureDefn (checking not yet implemented). 2940 2941 GDAL 1.11 2942 """ 2943 return _ogr.Feature_SetGeomFieldDirectly(self, *args)
2944
2945 - def GetGeomFieldRef(self, *args):
2946 r""" 2947 GetGeomFieldRef(Feature self, int iField) -> Geometry 2948 GetGeomFieldRef(Feature self, char const * field_name) -> Geometry 2949 OGRGeometryH 2950 OGR_F_GetGeomFieldRef(OGRFeatureH hFeat, int iField) 2951 2952 Fetch a handle to feature geometry. 2953 2954 This function is the same as the C++ method 2955 OGRFeature::GetGeomFieldRef(). 2956 2957 Parameters: 2958 ----------- 2959 2960 hFeat: handle to the feature to get geometry from. 2961 2962 iField: geometry field to get. 2963 2964 a handle to internal feature geometry. This object should not be 2965 modified. 2966 2967 GDAL 1.11 2968 """ 2969 return _ogr.Feature_GetGeomFieldRef(self, *args)
2970
2971 - def Clone(self, *args):
2972 r""" 2973 Clone(Feature self) -> Feature 2974 OGRFeatureH OGR_F_Clone(OGRFeatureH 2975 hFeat) 2976 2977 Duplicate feature. 2978 2979 The newly created feature is owned by the caller, and will have its 2980 own reference to the OGRFeatureDefn. 2981 2982 This function is the same as the C++ method OGRFeature::Clone(). 2983 2984 Parameters: 2985 ----------- 2986 2987 hFeat: handle to the feature to clone. 2988 2989 a handle to the new feature, exactly matching this feature. 2990 """ 2991 return _ogr.Feature_Clone(self, *args)
2992
2993 - def Equal(self, *args):
2994 r""" 2995 Equal(Feature self, Feature feature) -> bool 2996 int OGR_F_Equal(OGRFeatureH hFeat, 2997 OGRFeatureH hOtherFeat) 2998 2999 Test if two features are the same. 3000 3001 Two features are considered equal if the share them (handle equality) 3002 same OGRFeatureDefn, have the same field values, and the same geometry 3003 (as tested by OGR_G_Equal()) as well as the same feature id. 3004 3005 This function is the same as the C++ method OGRFeature::Equal(). 3006 3007 Parameters: 3008 ----------- 3009 3010 hFeat: handle to one of the feature. 3011 3012 hOtherFeat: handle to the other feature to test this one against. 3013 3014 TRUE if they are equal, otherwise FALSE. 3015 """ 3016 return _ogr.Feature_Equal(self, *args)
3017
3018 - def GetFieldCount(self, *args):
3019 r""" 3020 GetFieldCount(Feature self) -> int 3021 int 3022 OGR_F_GetFieldCount(OGRFeatureH hFeat) 3023 3024 Fetch number of fields on this feature This will always be the same as 3025 the field count for the OGRFeatureDefn. 3026 3027 This function is the same as the C++ method 3028 OGRFeature::GetFieldCount(). 3029 3030 Parameters: 3031 ----------- 3032 3033 hFeat: handle to the feature to get the fields count from. 3034 3035 count of fields. 3036 """ 3037 return _ogr.Feature_GetFieldCount(self, *args)
3038
3039 - def GetFieldDefnRef(self, *args):
3040 r""" 3041 GetFieldDefnRef(Feature self, int id) -> FieldDefn 3042 GetFieldDefnRef(Feature self, char const * field_name) -> FieldDefn 3043 OGRFieldDefnH 3044 OGR_F_GetFieldDefnRef(OGRFeatureH hFeat, int i) 3045 3046 Fetch definition for this field. 3047 3048 This function is the same as the C++ method 3049 OGRFeature::GetFieldDefnRef(). 3050 3051 Parameters: 3052 ----------- 3053 3054 hFeat: handle to the feature on which the field is found. 3055 3056 i: the field to fetch, from 0 to GetFieldCount()-1. 3057 3058 a handle to the field definition (from the OGRFeatureDefn). This is 3059 an internal reference, and should not be deleted or modified. 3060 """ 3061 return _ogr.Feature_GetFieldDefnRef(self, *args)
3062
3063 - def GetGeomFieldCount(self, *args):
3064 r""" 3065 GetGeomFieldCount(Feature self) -> int 3066 int 3067 OGR_F_GetGeomFieldCount(OGRFeatureH hFeat) 3068 3069 Fetch number of geometry fields on this feature This will always be 3070 the same as the geometry field count for the OGRFeatureDefn. 3071 3072 This function is the same as the C++ method 3073 OGRFeature::GetGeomFieldCount(). 3074 3075 Parameters: 3076 ----------- 3077 3078 hFeat: handle to the feature to get the geometry fields count from. 3079 3080 count of geometry fields. 3081 3082 GDAL 1.11 3083 """ 3084 return _ogr.Feature_GetGeomFieldCount(self, *args)
3085
3086 - def GetGeomFieldDefnRef(self, *args):
3087 r""" 3088 GetGeomFieldDefnRef(Feature self, int id) -> GeomFieldDefn 3089 GetGeomFieldDefnRef(Feature self, char const * field_name) -> GeomFieldDefn 3090 OGRGeomFieldDefnH 3091 OGR_F_GetGeomFieldDefnRef(OGRFeatureH hFeat, int i) 3092 3093 Fetch definition for this geometry field. 3094 3095 This function is the same as the C++ method 3096 OGRFeature::GetGeomFieldDefnRef(). 3097 3098 Parameters: 3099 ----------- 3100 3101 hFeat: handle to the feature on which the field is found. 3102 3103 i: the field to fetch, from 0 to GetGeomFieldCount()-1. 3104 3105 a handle to the field definition (from the OGRFeatureDefn). This is 3106 an internal reference, and should not be deleted or modified. 3107 3108 GDAL 1.11 3109 """ 3110 return _ogr.Feature_GetGeomFieldDefnRef(self, *args)
3111
3112 - def GetFieldAsString(self, *args):
3113 r""" 3114 GetFieldAsString(Feature self, int id) -> char const 3115 GetFieldAsString(Feature self, char const * field_name) -> char const * 3116 const char* 3117 OGR_F_GetFieldAsString(OGRFeatureH hFeat, int iField) 3118 3119 Fetch field value as a string. 3120 3121 OFTReal and OFTInteger fields will be translated to string using 3122 sprintf(), but not necessarily using the established formatting rules. 3123 Other field types, or errors will result in a return value of zero. 3124 3125 This function is the same as the C++ method 3126 OGRFeature::GetFieldAsString(). 3127 3128 Parameters: 3129 ----------- 3130 3131 hFeat: handle to the feature that owned the field. 3132 3133 iField: the field to fetch, from 0 to GetFieldCount()-1. 3134 3135 the field value. This string is internal, and should not be modified, 3136 or freed. Its lifetime may be very brief. 3137 """ 3138 return _ogr.Feature_GetFieldAsString(self, *args)
3139
3140 - def GetFieldAsInteger(self, *args):
3141 r""" 3142 GetFieldAsInteger(Feature self, int id) -> int 3143 GetFieldAsInteger(Feature self, char const * field_name) -> int 3144 int 3145 OGR_F_GetFieldAsInteger(OGRFeatureH hFeat, int iField) 3146 3147 Fetch field value as integer. 3148 3149 OFTString features will be translated using atoi(). OFTReal fields 3150 will be cast to integer. Other field types, or errors will result in a 3151 return value of zero. 3152 3153 This function is the same as the C++ method 3154 OGRFeature::GetFieldAsInteger(). 3155 3156 Parameters: 3157 ----------- 3158 3159 hFeat: handle to the feature that owned the field. 3160 3161 iField: the field to fetch, from 0 to GetFieldCount()-1. 3162 3163 the field value. 3164 """ 3165 return _ogr.Feature_GetFieldAsInteger(self, *args)
3166
3167 - def GetFieldAsInteger64(self, *args):
3168 r""" 3169 GetFieldAsInteger64(Feature self, int id) -> GIntBig 3170 GetFieldAsInteger64(Feature self, char const * field_name) -> GIntBig 3171 GIntBig 3172 OGR_F_GetFieldAsInteger64(OGRFeatureH hFeat, int iField) 3173 3174 Fetch field value as integer 64 bit. 3175 3176 OFTInteger are promoted to 64 bit. OFTString features will be 3177 translated using CPLAtoGIntBig(). OFTReal fields will be cast to 3178 integer. Other field types, or errors will result in a return value of 3179 zero. 3180 3181 This function is the same as the C++ method 3182 OGRFeature::GetFieldAsInteger64(). 3183 3184 Parameters: 3185 ----------- 3186 3187 hFeat: handle to the feature that owned the field. 3188 3189 iField: the field to fetch, from 0 to GetFieldCount()-1. 3190 3191 the field value. 3192 3193 GDAL 2.0 3194 """ 3195 return _ogr.Feature_GetFieldAsInteger64(self, *args)
3196
3197 - def GetFieldAsDouble(self, *args):
3198 r""" 3199 GetFieldAsDouble(Feature self, int id) -> double 3200 GetFieldAsDouble(Feature self, char const * field_name) -> double 3201 double 3202 OGR_F_GetFieldAsDouble(OGRFeatureH hFeat, int iField) 3203 3204 Fetch field value as a double. 3205 3206 OFTString features will be translated using CPLAtof(). OFTInteger 3207 fields will be cast to double. Other field types, or errors will 3208 result in a return value of zero. 3209 3210 This function is the same as the C++ method 3211 OGRFeature::GetFieldAsDouble(). 3212 3213 Parameters: 3214 ----------- 3215 3216 hFeat: handle to the feature that owned the field. 3217 3218 iField: the field to fetch, from 0 to GetFieldCount()-1. 3219 3220 the field value. 3221 """ 3222 return _ogr.Feature_GetFieldAsDouble(self, *args)
3223
3224 - def GetFieldAsDateTime(self, *args):
3225 r""" 3226 GetFieldAsDateTime(Feature self, int id) 3227 GetFieldAsDateTime(Feature self, char const * field_name) 3228 int 3229 OGR_F_GetFieldAsDateTime(OGRFeatureH hFeat, int iField, int *pnYear, 3230 int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, int *pnSecond, 3231 int *pnTZFlag) 3232 3233 Fetch field value as date and time. 3234 3235 Currently this method only works for OFTDate, OFTTime and OFTDateTime 3236 fields. 3237 3238 This function is the same as the C++ method 3239 OGRFeature::GetFieldAsDateTime(). 3240 3241 Parameters: 3242 ----------- 3243 3244 hFeat: handle to the feature that owned the field. 3245 3246 iField: the field to fetch, from 0 to GetFieldCount()-1. 3247 3248 pnYear: (including century) 3249 3250 pnMonth: (1-12) 3251 3252 pnDay: (1-31) 3253 3254 pnHour: (0-23) 3255 3256 pnMinute: (0-59) 3257 3258 pnSecond: (0-59) 3259 3260 pnTZFlag: (0=unknown, 1=localtime, 100=GMT, see data model for 3261 details) 3262 3263 TRUE on success or FALSE on failure. 3264 3265 See: Use OGR_F_GetFieldAsDateTimeEx() for second with millisecond 3266 accuracy. 3267 """ 3268 return _ogr.Feature_GetFieldAsDateTime(self, *args)
3269
3270 - def GetFieldAsIntegerList(self, *args):
3271 r""" 3272 GetFieldAsIntegerList(Feature self, int id) 3273 GetFieldAsIntegerList(Feature self, char const * field_name) 3274 const int* 3275 OGR_F_GetFieldAsIntegerList(OGRFeatureH hFeat, int iField, int 3276 *pnCount) 3277 3278 Fetch field value as a list of integers. 3279 3280 Currently this function only works for OFTIntegerList fields. 3281 3282 This function is the same as the C++ method 3283 OGRFeature::GetFieldAsIntegerList(). 3284 3285 Parameters: 3286 ----------- 3287 3288 hFeat: handle to the feature that owned the field. 3289 3290 iField: the field to fetch, from 0 to GetFieldCount()-1. 3291 3292 pnCount: an integer to put the list count (number of integers) into. 3293 3294 the field value. This list is internal, and should not be modified, or 3295 freed. Its lifetime may be very brief. If *pnCount is zero on return 3296 the returned pointer may be NULL or non-NULL. 3297 """ 3298 return _ogr.Feature_GetFieldAsIntegerList(self, *args)
3299
3300 - def GetFieldAsInteger64List(self, *args):
3301 r""" 3302 GetFieldAsInteger64List(Feature self, int id) 3303 const GIntBig* 3304 OGR_F_GetFieldAsInteger64List(OGRFeatureH hFeat, int iField, int 3305 *pnCount) 3306 3307 Fetch field value as a list of 64 bit integers. 3308 3309 Currently this function only works for OFTInteger64List fields. 3310 3311 This function is the same as the C++ method 3312 OGRFeature::GetFieldAsInteger64List(). 3313 3314 Parameters: 3315 ----------- 3316 3317 hFeat: handle to the feature that owned the field. 3318 3319 iField: the field to fetch, from 0 to GetFieldCount()-1. 3320 3321 pnCount: an integer to put the list count (number of integers) into. 3322 3323 the field value. This list is internal, and should not be modified, or 3324 freed. Its lifetime may be very brief. If *pnCount is zero on return 3325 the returned pointer may be NULL or non-NULL. 3326 3327 GDAL 2.0 3328 """ 3329 return _ogr.Feature_GetFieldAsInteger64List(self, *args)
3330
3331 - def GetFieldAsDoubleList(self, *args):
3332 r""" 3333 GetFieldAsDoubleList(Feature self, int id) 3334 GetFieldAsDoubleList(Feature self, char const * field_name) 3335 const double* 3336 OGR_F_GetFieldAsDoubleList(OGRFeatureH hFeat, int iField, int 3337 *pnCount) 3338 3339 Fetch field value as a list of doubles. 3340 3341 Currently this function only works for OFTRealList fields. 3342 3343 This function is the same as the C++ method 3344 OGRFeature::GetFieldAsDoubleList(). 3345 3346 Parameters: 3347 ----------- 3348 3349 hFeat: handle to the feature that owned the field. 3350 3351 iField: the field to fetch, from 0 to GetFieldCount()-1. 3352 3353 pnCount: an integer to put the list count (number of doubles) into. 3354 3355 the field value. This list is internal, and should not be modified, or 3356 freed. Its lifetime may be very brief. If *pnCount is zero on return 3357 the returned pointer may be NULL or non-NULL. 3358 """ 3359 return _ogr.Feature_GetFieldAsDoubleList(self, *args)
3360
3361 - def GetFieldAsStringList(self, *args):
3362 r""" 3363 GetFieldAsStringList(Feature self, int id) -> char ** 3364 char** 3365 OGR_F_GetFieldAsStringList(OGRFeatureH hFeat, int iField) 3366 3367 Fetch field value as a list of strings. 3368 3369 Currently this method only works for OFTStringList fields. 3370 3371 The returned list is terminated by a NULL pointer. The number of 3372 elements can also be calculated using CSLCount(). 3373 3374 This function is the same as the C++ method 3375 OGRFeature::GetFieldAsStringList(). 3376 3377 Parameters: 3378 ----------- 3379 3380 hFeat: handle to the feature that owned the field. 3381 3382 iField: the field to fetch, from 0 to GetFieldCount()-1. 3383 3384 the field value. This list is internal, and should not be modified, or 3385 freed. Its lifetime may be very brief. 3386 """ 3387 return _ogr.Feature_GetFieldAsStringList(self, *args)
3388
3389 - def GetFieldAsBinary(self, *args):
3390 r""" 3391 GetFieldAsBinary(Feature self, int id) -> OGRErr 3392 GetFieldAsBinary(Feature self, char const * field_name) -> OGRErr 3393 GByte* 3394 OGR_F_GetFieldAsBinary(OGRFeatureH hFeat, int iField, int *pnBytes) 3395 3396 Fetch field value as binary. 3397 3398 This method only works for OFTBinary and OFTString fields. 3399 3400 This function is the same as the C++ method 3401 OGRFeature::GetFieldAsBinary(). 3402 3403 Parameters: 3404 ----------- 3405 3406 hFeat: handle to the feature that owned the field. 3407 3408 iField: the field to fetch, from 0 to GetFieldCount()-1. 3409 3410 pnBytes: location to place count of bytes returned. 3411 3412 the field value. This list is internal, and should not be modified, or 3413 freed. Its lifetime may be very brief. 3414 """ 3415 return _ogr.Feature_GetFieldAsBinary(self, *args)
3416
3417 - def IsFieldSet(self, *args):
3418 r""" 3419 IsFieldSet(Feature self, int id) -> bool 3420 IsFieldSet(Feature self, char const * field_name) -> bool 3421 int OGR_F_IsFieldSet(OGRFeatureH 3422 hFeat, int iField) 3423 3424 Test if a field has ever been assigned a value or not. 3425 3426 This function is the same as the C++ method OGRFeature::IsFieldSet(). 3427 3428 Parameters: 3429 ----------- 3430 3431 hFeat: handle to the feature on which the field is. 3432 3433 iField: the field to test. 3434 3435 TRUE if the field has been set, otherwise false. 3436 """ 3437 return _ogr.Feature_IsFieldSet(self, *args)
3438
3439 - def IsFieldNull(self, *args):
3440 r""" 3441 IsFieldNull(Feature self, int id) -> bool 3442 IsFieldNull(Feature self, char const * field_name) -> bool 3443 int OGR_F_IsFieldNull(OGRFeatureH 3444 hFeat, int iField) 3445 3446 Test if a field is null. 3447 3448 This function is the same as the C++ method OGRFeature::IsFieldNull(). 3449 3450 Parameters: 3451 ----------- 3452 3453 hFeat: handle to the feature on which the field is. 3454 3455 iField: the field to test. 3456 3457 TRUE if the field is null, otherwise false. 3458 3459 GDAL 2.2 3460 """ 3461 return _ogr.Feature_IsFieldNull(self, *args)
3462
3463 - def IsFieldSetAndNotNull(self, *args):
3464 r""" 3465 IsFieldSetAndNotNull(Feature self, int id) -> bool 3466 IsFieldSetAndNotNull(Feature self, char const * field_name) -> bool 3467 int 3468 OGR_F_IsFieldSetAndNotNull(OGRFeatureH hFeat, int iField) 3469 3470 Test if a field is set and not null. 3471 3472 This function is the same as the C++ method 3473 OGRFeature::IsFieldSetAndNotNull(). 3474 3475 Parameters: 3476 ----------- 3477 3478 hFeat: handle to the feature on which the field is. 3479 3480 iField: the field to test. 3481 3482 TRUE if the field is set and not null, otherwise false. 3483 3484 GDAL 2.2 3485 """ 3486 return _ogr.Feature_IsFieldSetAndNotNull(self, *args)
3487
3488 - def GetFieldIndex(self, *args):
3489 r""" 3490 GetFieldIndex(Feature self, char const * field_name) -> int 3491 int 3492 OGR_F_GetFieldIndex(OGRFeatureH hFeat, const char *pszName) 3493 3494 Fetch the field index given field name. 3495 3496 This is a cover for the OGRFeatureDefn::GetFieldIndex() method. 3497 3498 This function is the same as the C++ method 3499 OGRFeature::GetFieldIndex(). 3500 3501 Parameters: 3502 ----------- 3503 3504 hFeat: handle to the feature on which the field is found. 3505 3506 pszName: the name of the field to search for. 3507 3508 the field index, or -1 if no matching field is found. 3509 """ 3510 return _ogr.Feature_GetFieldIndex(self, *args)
3511
3512 - def GetGeomFieldIndex(self, *args):
3513 r""" 3514 GetGeomFieldIndex(Feature self, char const * field_name) -> int 3515 int 3516 OGR_F_GetGeomFieldIndex(OGRFeatureH hFeat, const char *pszName) 3517 3518 Fetch the geometry field index given geometry field name. 3519 3520 This is a cover for the OGRFeatureDefn::GetGeomFieldIndex() method. 3521 3522 This function is the same as the C++ method 3523 OGRFeature::GetGeomFieldIndex(). 3524 3525 Parameters: 3526 ----------- 3527 3528 hFeat: handle to the feature on which the geometry field is found. 3529 3530 pszName: the name of the geometry field to search for. 3531 3532 the geometry field index, or -1 if no matching geometry field is 3533 found. 3534 3535 GDAL 1.11 3536 """ 3537 return _ogr.Feature_GetGeomFieldIndex(self, *args)
3538
3539 - def GetFID(self, *args):
3540 r""" 3541 GetFID(Feature self) -> GIntBig 3542 GIntBig OGR_F_GetFID(OGRFeatureH 3543 hFeat) 3544 3545 Get feature identifier. 3546 3547 This function is the same as the C++ method OGRFeature::GetFID(). 3548 Note: since GDAL 2.0, this method returns a GIntBig (previously a 3549 long) 3550 3551 Parameters: 3552 ----------- 3553 3554 hFeat: handle to the feature from which to get the feature 3555 identifier. 3556 3557 feature id or OGRNullFID if none has been assigned. 3558 """ 3559 return _ogr.Feature_GetFID(self, *args)
3560
3561 - def SetFID(self, *args):
3562 r""" 3563 SetFID(Feature self, GIntBig fid) -> OGRErr 3564 OGRErr OGR_F_SetFID(OGRFeatureH hFeat, 3565 GIntBig nFID) 3566 3567 Set the feature identifier. 3568 3569 For specific types of features this operation may fail on illegal 3570 features ids. Generally it always succeeds. Feature ids should be 3571 greater than or equal to zero, with the exception of OGRNullFID (-1) 3572 indicating that the feature id is unknown. 3573 3574 This function is the same as the C++ method OGRFeature::SetFID(). 3575 3576 Parameters: 3577 ----------- 3578 3579 hFeat: handle to the feature to set the feature id to. 3580 3581 nFID: the new feature identifier value to assign. 3582 3583 On success OGRERR_NONE, or on failure some other value. 3584 """ 3585 return _ogr.Feature_SetFID(self, *args)
3586
3587 - def DumpReadable(self, *args):
3588 r""" 3589 DumpReadable(Feature self) 3590 void 3591 OGR_F_DumpReadable(OGRFeatureH hFeat, FILE *fpOut) 3592 3593 Dump this feature in a human readable form. 3594 3595 This dumps the attributes, and geometry; however, it doesn't 3596 definition information (other than field types and names), nor does it 3597 report the geometry spatial reference system. 3598 3599 This function is the same as the C++ method 3600 OGRFeature::DumpReadable(). 3601 3602 Parameters: 3603 ----------- 3604 3605 hFeat: handle to the feature to dump. 3606 3607 fpOut: the stream to write to, such as strout. 3608 """ 3609 return _ogr.Feature_DumpReadable(self, *args)
3610
3611 - def UnsetField(self, *args):
3612 r""" 3613 UnsetField(Feature self, int id) 3614 UnsetField(Feature self, char const * field_name) 3615 void OGR_F_UnsetField(OGRFeatureH 3616 hFeat, int iField) 3617 3618 Clear a field, marking it as unset. 3619 3620 This function is the same as the C++ method OGRFeature::UnsetField(). 3621 3622 Parameters: 3623 ----------- 3624 3625 hFeat: handle to the feature on which the field is. 3626 3627 iField: the field to unset. 3628 """ 3629 return _ogr.Feature_UnsetField(self, *args)
3630
3631 - def SetFieldNull(self, *args):
3632 r""" 3633 SetFieldNull(Feature self, int id) 3634 SetFieldNull(Feature self, char const * field_name) 3635 void 3636 OGR_F_SetFieldNull(OGRFeatureH hFeat, int iField) 3637 3638 Clear a field, marking it as null. 3639 3640 This function is the same as the C++ method 3641 OGRFeature::SetFieldNull(). 3642 3643 Parameters: 3644 ----------- 3645 3646 hFeat: handle to the feature on which the field is. 3647 3648 iField: the field to set to null. 3649 3650 GDAL 2.2 3651 """ 3652 return _ogr.Feature_SetFieldNull(self, *args)
3653
3654 - def SetFieldInteger64(self, *args):
3655 r""" 3656 SetFieldInteger64(Feature self, int id, GIntBig value) 3657 void 3658 OGR_F_SetFieldInteger64(OGRFeatureH hFeat, int iField, GIntBig nValue) 3659 3660 Set field to 64 bit integer value. 3661 3662 OFTInteger, OFTInteger64 and OFTReal fields will be set directly. 3663 OFTString fields will be assigned a string representation of the 3664 value, but not necessarily taking into account formatting constraints 3665 on this field. Other field types may be unaffected. 3666 3667 This function is the same as the C++ method OGRFeature::SetField(). 3668 3669 This method has only an effect on the in-memory feature object. If 3670 this object comes from a layer and the modifications must be 3671 serialized back to the datasource, OGR_L_SetFeature() must be used 3672 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 3673 used afterwards. 3674 3675 Parameters: 3676 ----------- 3677 3678 hFeat: handle to the feature that owned the field. 3679 3680 iField: the field to fetch, from 0 to GetFieldCount()-1. 3681 3682 nValue: the value to assign. 3683 3684 GDAL 2.0 3685 """ 3686 return _ogr.Feature_SetFieldInteger64(self, *args)
3687
3688 - def SetField(self, *args):
3689 r""" 3690 SetField(Feature self, int id, char const * value) 3691 SetField(Feature self, char const * field_name, char const * value) 3692 SetField(Feature self, int id, double value) 3693 SetField(Feature self, char const * field_name, double value) 3694 SetField(Feature self, int id, int year, int month, int day, int hour, int minute, float second, int tzflag) 3695 SetField(Feature self, char const * field_name, int year, int month, int day, int hour, int minute, float second, int tzflag) 3696 """ 3697 return _ogr.Feature_SetField(self, *args)
3698
3699 - def SetFieldIntegerList(self, *args):
3700 r""" 3701 SetFieldIntegerList(Feature self, int id, int nList) 3702 void 3703 OGR_F_SetFieldIntegerList(OGRFeatureH hFeat, int iField, int nCount, 3704 const int *panValues) 3705 3706 Set field to list of integers value. 3707 3708 This function currently on has an effect of OFTIntegerList, 3709 OFTInteger64List and OFTRealList fields. 3710 3711 This function is the same as the C++ method OGRFeature::SetField(). 3712 3713 This method has only an effect on the in-memory feature object. If 3714 this object comes from a layer and the modifications must be 3715 serialized back to the datasource, OGR_L_SetFeature() must be used 3716 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 3717 used afterwards. 3718 3719 Parameters: 3720 ----------- 3721 3722 hFeat: handle to the feature that owned the field. 3723 3724 iField: the field to set, from 0 to GetFieldCount()-1. 3725 3726 nCount: the number of values in the list being assigned. 3727 3728 panValues: the values to assign. 3729 """ 3730 return _ogr.Feature_SetFieldIntegerList(self, *args)
3731
3732 - def SetFieldInteger64List(self, *args):
3733 r""" 3734 SetFieldInteger64List(Feature self, int id, int nList) 3735 void 3736 OGR_F_SetFieldInteger64List(OGRFeatureH hFeat, int iField, int nCount, 3737 const GIntBig *panValues) 3738 3739 Set field to list of 64 bit integers value. 3740 3741 This function currently on has an effect of OFTIntegerList, 3742 OFTInteger64List and OFTRealList fields. 3743 3744 This function is the same as the C++ method OGRFeature::SetField(). 3745 3746 This method has only an effect on the in-memory feature object. If 3747 this object comes from a layer and the modifications must be 3748 serialized back to the datasource, OGR_L_SetFeature() must be used 3749 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 3750 used afterwards. 3751 3752 Parameters: 3753 ----------- 3754 3755 hFeat: handle to the feature that owned the field. 3756 3757 iField: the field to set, from 0 to GetFieldCount()-1. 3758 3759 nCount: the number of values in the list being assigned. 3760 3761 panValues: the values to assign. 3762 3763 GDAL 2.0 3764 """ 3765 return _ogr.Feature_SetFieldInteger64List(self, *args)
3766
3767 - def SetFieldDoubleList(self, *args):
3768 r""" 3769 SetFieldDoubleList(Feature self, int id, int nList) 3770 void 3771 OGR_F_SetFieldDoubleList(OGRFeatureH hFeat, int iField, int nCount, 3772 const double *padfValues) 3773 3774 Set field to list of doubles value. 3775 3776 This function currently on has an effect of OFTIntegerList, 3777 OFTInteger64List, OFTRealList fields. 3778 3779 This function is the same as the C++ method OGRFeature::SetField(). 3780 3781 This method has only an effect on the in-memory feature object. If 3782 this object comes from a layer and the modifications must be 3783 serialized back to the datasource, OGR_L_SetFeature() must be used 3784 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 3785 used afterwards. 3786 3787 Parameters: 3788 ----------- 3789 3790 hFeat: handle to the feature that owned the field. 3791 3792 iField: the field to set, from 0 to GetFieldCount()-1. 3793 3794 nCount: the number of values in the list being assigned. 3795 3796 padfValues: the values to assign. 3797 """ 3798 return _ogr.Feature_SetFieldDoubleList(self, *args)
3799
3800 - def SetFieldStringList(self, *args):
3801 r""" 3802 SetFieldStringList(Feature self, int id, char ** pList) 3803 void 3804 OGR_F_SetFieldStringList(OGRFeatureH hFeat, int iField, CSLConstList 3805 papszValues) 3806 3807 Set field to list of strings value. 3808 3809 This function currently on has an effect of OFTStringList fields. 3810 3811 This function is the same as the C++ method OGRFeature::SetField(). 3812 3813 This method has only an effect on the in-memory feature object. If 3814 this object comes from a layer and the modifications must be 3815 serialized back to the datasource, OGR_L_SetFeature() must be used 3816 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 3817 used afterwards. 3818 3819 Parameters: 3820 ----------- 3821 3822 hFeat: handle to the feature that owned the field. 3823 3824 iField: the field to set, from 0 to GetFieldCount()-1. 3825 3826 papszValues: the values to assign. List of NUL-terminated string, 3827 ending with a NULL pointer. 3828 """ 3829 return _ogr.Feature_SetFieldStringList(self, *args)
3830
3831 - def SetFieldBinaryFromHexString(self, *args):
3832 r""" 3833 SetFieldBinaryFromHexString(Feature self, int id, char const * pszValue) 3834 SetFieldBinaryFromHexString(Feature self, char const * field_name, char const * pszValue) 3835 """ 3836 return _ogr.Feature_SetFieldBinaryFromHexString(self, *args)
3837
3838 - def SetFrom(self, *args, **kwargs):
3839 r""" 3840 SetFrom(Feature self, Feature other, int forgiving=1) -> OGRErr 3841 OGRErr OGR_F_SetFrom(OGRFeatureH 3842 hFeat, OGRFeatureH hOtherFeat, int bForgiving) 3843 3844 Set one feature from another. 3845 3846 Overwrite the contents of this feature from the geometry and 3847 attributes of another. The hOtherFeature does not need to have the 3848 same OGRFeatureDefn. Field values are copied by corresponding field 3849 names. Field types do not have to exactly match. OGR_F_SetField*() 3850 function conversion rules will be applied as needed. 3851 3852 This function is the same as the C++ method OGRFeature::SetFrom(). 3853 3854 Parameters: 3855 ----------- 3856 3857 hFeat: handle to the feature to set to. 3858 3859 hOtherFeat: handle to the feature from which geometry, and field 3860 values will be copied. 3861 3862 bForgiving: TRUE if the operation should continue despite lacking 3863 output fields matching some of the source fields. 3864 3865 OGRERR_NONE if the operation succeeds, even if some values are not 3866 transferred, otherwise an error code. 3867 """ 3868 return _ogr.Feature_SetFrom(self, *args, **kwargs)
3869
3870 - def SetFromWithMap(self, *args):
3871 r""" 3872 SetFromWithMap(Feature self, Feature other, int forgiving, int nList) -> OGRErr 3873 OGRErr 3874 OGR_F_SetFromWithMap(OGRFeatureH hFeat, OGRFeatureH hOtherFeat, int 3875 bForgiving, const int *panMap) 3876 3877 Set one feature from another. 3878 3879 Overwrite the contents of this feature from the geometry and 3880 attributes of another. The hOtherFeature does not need to have the 3881 same OGRFeatureDefn. Field values are copied according to the provided 3882 indices map. Field types do not have to exactly match. 3883 OGR_F_SetField*() function conversion rules will be applied as needed. 3884 This is more efficient than OGR_F_SetFrom() in that this doesn't 3885 lookup the fields by their names. Particularly useful when the field 3886 names don't match. 3887 3888 This function is the same as the C++ method OGRFeature::SetFrom(). 3889 3890 Parameters: 3891 ----------- 3892 3893 hFeat: handle to the feature to set to. 3894 3895 hOtherFeat: handle to the feature from which geometry, and field 3896 values will be copied. 3897 3898 panMap: Array of the indices of the destination feature's fields 3899 stored at the corresponding index of the source feature's fields. A 3900 value of -1 should be used to ignore the source's field. The array 3901 should not be NULL and be as long as the number of fields in the 3902 source feature. 3903 3904 bForgiving: TRUE if the operation should continue despite lacking 3905 output fields matching some of the source fields. 3906 3907 OGRERR_NONE if the operation succeeds, even if some values are not 3908 transferred, otherwise an error code. 3909 """ 3910 return _ogr.Feature_SetFromWithMap(self, *args)
3911
3912 - def GetStyleString(self, *args):
3913 r""" 3914 GetStyleString(Feature self) -> char const * 3915 const char* 3916 OGR_F_GetStyleString(OGRFeatureH hFeat) 3917 3918 Fetch style string for this feature. 3919 3920 Set the OGR Feature Style Specification for details on the format of 3921 this string, and ogr_featurestyle.h for services available to parse 3922 it. 3923 3924 This function is the same as the C++ method 3925 OGRFeature::GetStyleString(). 3926 3927 Parameters: 3928 ----------- 3929 3930 hFeat: handle to the feature to get the style from. 3931 3932 a reference to a representation in string format, or NULL if there 3933 isn't one. 3934 """ 3935 return _ogr.Feature_GetStyleString(self, *args)
3936
3937 - def SetStyleString(self, *args):
3938 r""" 3939 SetStyleString(Feature self, char const * the_string) 3940 void 3941 OGR_F_SetStyleString(OGRFeatureH hFeat, const char *pszStyle) 3942 3943 Set feature style string. 3944 3945 This method operate exactly as OGR_F_SetStyleStringDirectly() except 3946 that it does not assume ownership of the passed string, but instead 3947 makes a copy of it. 3948 3949 This function is the same as the C++ method 3950 OGRFeature::SetStyleString(). 3951 3952 Parameters: 3953 ----------- 3954 3955 hFeat: handle to the feature to set style to. 3956 3957 pszStyle: the style string to apply to this feature, cannot be NULL. 3958 3959 """ 3960 return _ogr.Feature_SetStyleString(self, *args)
3961
3962 - def GetFieldType(self, *args):
3963 r""" 3964 GetFieldType(Feature self, int id) -> OGRFieldType 3965 GetFieldType(Feature self, char const * field_name) -> OGRFieldType 3966 """ 3967 return _ogr.Feature_GetFieldType(self, *args)
3968
3969 - def Validate(self, *args):
3970 r""" 3971 Validate(Feature self, int flags=OGR_F_VAL_ALL, int bEmitError=TRUE) -> int 3972 int OGR_F_Validate(OGRFeatureH 3973 hFeat, int nValidateFlags, int bEmitError) 3974 3975 Validate that a feature meets constraints of its schema. 3976 3977 The scope of test is specified with the nValidateFlags parameter. 3978 3979 Regarding OGR_F_VAL_WIDTH, the test is done assuming the string width 3980 must be interpreted as the number of UTF-8 characters. Some drivers 3981 might interpret the width as the number of bytes instead. So this test 3982 is rather conservative (if it fails, then it will fail for all 3983 interpretations). 3984 3985 This function is the same as the C++ method OGRFeature::Validate(). 3986 3987 Parameters: 3988 ----------- 3989 3990 hFeat: handle to the feature to validate. 3991 3992 nValidateFlags: OGR_F_VAL_ALL or combination of OGR_F_VAL_NULL, 3993 OGR_F_VAL_GEOM_TYPE, OGR_F_VAL_WIDTH and 3994 OGR_F_VAL_ALLOW_NULL_WHEN_DEFAULT with '|' operator 3995 3996 bEmitError: TRUE if a CPLError() must be emitted when a check fails 3997 3998 TRUE if all enabled validation tests pass. 3999 4000 GDAL 2.0 4001 """ 4002 return _ogr.Feature_Validate(self, *args)
4003
4004 - def FillUnsetWithDefault(self, *args):
4005 r""" 4006 FillUnsetWithDefault(Feature self, int bNotNullableOnly=FALSE, char ** options=None) 4007 void 4008 OGR_F_FillUnsetWithDefault(OGRFeatureH hFeat, int bNotNullableOnly, 4009 char **papszOptions) 4010 4011 Fill unset fields with default values that might be defined. 4012 4013 This function is the same as the C++ method 4014 OGRFeature::FillUnsetWithDefault(). 4015 4016 Parameters: 4017 ----------- 4018 4019 hFeat: handle to the feature. 4020 4021 bNotNullableOnly: if we should fill only unset fields with a not-null 4022 constraint. 4023 4024 papszOptions: unused currently. Must be set to NULL. 4025 4026 GDAL 2.0 4027 """ 4028 return _ogr.Feature_FillUnsetWithDefault(self, *args)
4029
4030 - def GetNativeData(self, *args):
4031 r""" 4032 GetNativeData(Feature self) -> char const * 4033 const char* 4034 OGR_F_GetNativeData(OGRFeatureH hFeat) 4035 4036 Returns the native data for the feature. 4037 4038 The native data is the representation in a "natural" form that comes 4039 from the driver that created this feature, or that is aimed at an 4040 output driver. The native data may be in different format, which is 4041 indicated by OGR_F_GetNativeMediaType(). 4042 4043 Note that most drivers do not support storing the native data in the 4044 feature object, and if they do, generally the NATIVE_DATA open option 4045 must be passed at dataset opening. 4046 4047 The "native data" does not imply it is something more performant or 4048 powerful than what can be obtained with the rest of the API, but it 4049 may be useful in round-tripping scenarios where some characteristics 4050 of the underlying format are not captured otherwise by the OGR 4051 abstraction. 4052 4053 This function is the same as the C++ method 4054 OGRFeature::GetNativeData(). 4055 4056 Parameters: 4057 ----------- 4058 4059 hFeat: handle to the feature. 4060 4061 a string with the native data, or NULL if there is none. 4062 4063 GDAL 2.1 4064 4065 See: 4066 https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr 4067 4068 """ 4069 return _ogr.Feature_GetNativeData(self, *args)
4070
4071 - def GetNativeMediaType(self, *args):
4072 r""" 4073 GetNativeMediaType(Feature self) -> char const * 4074 const char* 4075 OGR_F_GetNativeMediaType(OGRFeatureH hFeat) 4076 4077 Returns the native media type for the feature. 4078 4079 The native media type is the identifier for the format of the native 4080 data. It follows the IANA RFC 2045 4081 (seehttps://en.wikipedia.org/wiki/Media_type), e.g. 4082 "application/vnd.geo+json" for JSon. 4083 4084 This function is the same as the C function 4085 OGR_F_GetNativeMediaType(). 4086 4087 Parameters: 4088 ----------- 4089 4090 hFeat: handle to the feature. 4091 4092 a string with the native media type, or NULL if there is none. 4093 4094 GDAL 2.1 4095 4096 See: 4097 https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr 4098 4099 """ 4100 return _ogr.Feature_GetNativeMediaType(self, *args)
4101
4102 - def SetNativeData(self, *args):
4103 r""" 4104 SetNativeData(Feature self, char const * nativeData) 4105 void 4106 OGR_F_SetNativeData(OGRFeatureH hFeat, const char *pszNativeData) 4107 4108 Sets the native data for the feature. 4109 4110 The native data is the representation in a "natural" form that comes 4111 from the driver that created this feature, or that is aimed at an 4112 output driver. The native data may be in different format, which is 4113 indicated by OGR_F_GetNativeMediaType(). 4114 4115 This function is the same as the C++ method 4116 OGRFeature::SetNativeData(). 4117 4118 Parameters: 4119 ----------- 4120 4121 hFeat: handle to the feature. 4122 4123 pszNativeData: a string with the native data, or NULL if there is 4124 none. 4125 4126 GDAL 2.1 4127 4128 See: 4129 https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr 4130 4131 """ 4132 return _ogr.Feature_SetNativeData(self, *args)
4133
4134 - def SetNativeMediaType(self, *args):
4135 r""" 4136 SetNativeMediaType(Feature self, char const * nativeMediaType) 4137 void 4138 OGR_F_SetNativeMediaType(OGRFeatureH hFeat, const char 4139 *pszNativeMediaType) 4140 4141 Sets the native media type for the feature. 4142 4143 The native media type is the identifier for the format of the native 4144 data. It follows the IANA RFC 2045 4145 (seehttps://en.wikipedia.org/wiki/Media_type), e.g. 4146 "application/vnd.geo+json" for JSon. 4147 4148 This function is the same as the C++ method 4149 OGRFeature::SetNativeMediaType(). 4150 4151 Parameters: 4152 ----------- 4153 4154 hFeat: handle to the feature. 4155 4156 pszNativeMediaType: a string with the native media type, or NULL if 4157 there is none. 4158 4159 GDAL 2.1 4160 4161 See: 4162 https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr 4163 4164 """ 4165 return _ogr.Feature_SetNativeMediaType(self, *args)
4166
4167 - def SetFieldString(self, *args):
4168 r""" 4169 SetFieldString(Feature self, int id, char const * value) 4170 void 4171 OGR_F_SetFieldString(OGRFeatureH hFeat, int iField, const char 4172 *pszValue) 4173 4174 Set field to string value. 4175 4176 OFTInteger fields will be set based on an atoi() conversion of the 4177 string. OFTInteger64 fields will be set based on an CPLAtoGIntBig() 4178 conversion of the string. OFTReal fields will be set based on an 4179 CPLAtof() conversion of the string. Other field types may be 4180 unaffected. 4181 4182 This function is the same as the C++ method OGRFeature::SetField(). 4183 4184 This method has only an effect on the in-memory feature object. If 4185 this object comes from a layer and the modifications must be 4186 serialized back to the datasource, OGR_L_SetFeature() must be used 4187 afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be 4188 used afterwards. 4189 4190 Parameters: 4191 ----------- 4192 4193 hFeat: handle to the feature that owned the field. 4194 4195 iField: the field to fetch, from 0 to GetFieldCount()-1. 4196 4197 pszValue: the value to assign. 4198 """ 4199 return _ogr.Feature_SetFieldString(self, *args)
4200
4201 - def Reference(self):
4202 pass
4203
4204 - def Dereference(self):
4205 pass
4206
4207 - def Destroy(self):
4208 "Once called, self has effectively been destroyed. Do not access. For backwards compatibility only" 4209 _ogr.delete_Feature(self) 4210 self.thisown = 0
4211
4212 - def __cmp__(self, other):
4213 """Compares a feature to another for equality""" 4214 return self.Equal(other)
4215
4216 - def __copy__(self):
4217 return self.Clone()
4218
4219 - def _getfieldindex(self, fieldname):
4220 case_insensitive_idx = -1 4221 fdefn = _ogr.Feature_GetDefnRef(self) 4222 for i in range(fdefn.GetFieldCount()): 4223 name = fdefn.GetFieldDefn(i).GetName() 4224 if name == fieldname: 4225 return i 4226 elif case_insensitive_idx < 0 and name.lower() == fieldname.lower(): 4227 case_insensitive_idx = i 4228 return case_insensitive_idx
4229 4230 # This makes it possible to fetch fields in the form "feature.area". 4231 # This has some risk of name collisions.
4232 - def __getattr__(self, key):
4233 """Returns the values of fields by the given name""" 4234 if key == 'this': 4235 return self.__dict__[key] 4236 4237 idx = self._getfieldindex(key) 4238 if idx < 0: 4239 idx = self.GetGeomFieldIndex(key) 4240 if idx < 0: 4241 raise AttributeError(key) 4242 else: 4243 return self.GetGeomFieldRef(idx) 4244 else: 4245 return self.GetField(idx)
4246 4247 # This makes it possible to set fields in the form "feature.area". 4248 # This has some risk of name collisions.
4249 - def __setattr__(self, key, value):
4250 """Set the values of fields by the given name""" 4251 if key == 'this' or key == 'thisown': 4252 self.__dict__[key] = value 4253 else: 4254 idx = self._getfieldindex(key) 4255 if idx != -1: 4256 self.SetField2(idx, value) 4257 else: 4258 idx = self.GetGeomFieldIndex(key) 4259 if idx != -1: 4260 self.SetGeomField(idx, value) 4261 else: 4262 self.__dict__[key] = value
4263 4264 # This makes it possible to fetch fields in the form "feature['area']".
4265 - def __getitem__(self, key):
4266 """Returns the values of fields by the given name / field_index""" 4267 if isinstance(key, str): 4268 fld_index = self._getfieldindex(key) 4269 else: 4270 fld_index = key 4271 if key == self.GetFieldCount(): 4272 raise IndexError 4273 if fld_index < 0: 4274 if isinstance(key, str): 4275 fld_index = self.GetGeomFieldIndex(key) 4276 if fld_index < 0: 4277 raise KeyError("Illegal field requested in GetField()") 4278 else: 4279 return self.GetGeomFieldRef(fld_index) 4280 else: 4281 return self.GetField(fld_index)
4282 4283 # This makes it possible to set fields in the form "feature['area'] = 123".
4284 - def __setitem__(self, key, value):
4285 """Returns the value of a field by field name / index""" 4286 if isinstance(key, str): 4287 fld_index = self._getfieldindex(key) 4288 else: 4289 fld_index = key 4290 if key == self.GetFieldCount(): 4291 raise IndexError 4292 if fld_index < 0: 4293 if isinstance(key, str): 4294 fld_index = self.GetGeomFieldIndex(key) 4295 if fld_index < 0: 4296 raise KeyError("Illegal field requested in SetField()") 4297 else: 4298 return self.SetGeomField(fld_index, value) 4299 else: 4300 return self.SetField2(fld_index, value)
4301
4302 - def GetField(self, fld_index):
4303 if isinstance(fld_index, str): 4304 fld_index = self._getfieldindex(fld_index) 4305 if (fld_index < 0) or (fld_index > self.GetFieldCount()): 4306 raise KeyError("Illegal field requested in GetField()") 4307 if not (self.IsFieldSet(fld_index)) or self.IsFieldNull(fld_index): 4308 return None 4309 fld_type = self.GetFieldType(fld_index) 4310 if fld_type == OFTInteger: 4311 return self.GetFieldAsInteger(fld_index) 4312 if fld_type == OFTInteger64: 4313 return self.GetFieldAsInteger64(fld_index) 4314 if fld_type == OFTReal: 4315 return self.GetFieldAsDouble(fld_index) 4316 if fld_type == OFTStringList: 4317 return self.GetFieldAsStringList(fld_index) 4318 if fld_type == OFTIntegerList: 4319 return self.GetFieldAsIntegerList(fld_index) 4320 if fld_type == OFTInteger64List: 4321 return self.GetFieldAsInteger64List(fld_index) 4322 if fld_type == OFTRealList: 4323 return self.GetFieldAsDoubleList(fld_index) 4324 ## if fld_type == OFTDateTime or fld_type == OFTDate or fld_type == OFTTime: 4325 # return self.GetFieldAsDate(fld_index) 4326 # default to returning as a string. Should we add more types? 4327 try: 4328 return self.GetFieldAsString(fld_index) 4329 except: 4330 # For Python3 on non-UTF8 strings 4331 return self.GetFieldAsBinary(fld_index)
4332 4333 # With several override, SWIG cannot dispatch automatically unicode strings 4334 # to the right implementation, so we have to do it at hand
4335 - def SetField(self, *args):
4336 """ 4337 SetField(self, int id, char value) 4338 SetField(self, char name, char value) 4339 SetField(self, int id, int value) 4340 SetField(self, char name, int value) 4341 SetField(self, int id, double value) 4342 SetField(self, char name, double value) 4343 SetField(self, int id, int year, int month, int day, int hour, int minute, 4344 int second, int tzflag) 4345 SetField(self, char name, int year, int month, int day, int hour, 4346 int minute, int second, int tzflag) 4347 """ 4348 4349 if len(args) == 2 and args[1] is None: 4350 return _ogr.Feature_SetFieldNull(self, args[0]) 4351 4352 if len(args) == 2 and (type(args[1]) == type(1) or type(args[1]) == type(12345678901234)): 4353 fld_index = args[0] 4354 if isinstance(fld_index, str): 4355 fld_index = self._getfieldindex(fld_index) 4356 return _ogr.Feature_SetFieldInteger64(self, fld_index, args[1]) 4357 4358 4359 if len(args) == 2 and isinstance(args[1], str): 4360 fld_index = args[0] 4361 if isinstance(fld_index, str): 4362 fld_index = self._getfieldindex(fld_index) 4363 return _ogr.Feature_SetFieldString(self, fld_index, args[1]) 4364 4365 return _ogr.Feature_SetField(self, *args)
4366
4367 - def SetField2(self, fld_index, value):
4368 if isinstance(fld_index, str): 4369 fld_index = self._getfieldindex(fld_index) 4370 if (fld_index < 0) or (fld_index > self.GetFieldCount()): 4371 raise KeyError("Illegal field requested in SetField2()") 4372 4373 if value is None: 4374 self.SetFieldNull(fld_index) 4375 return 4376 4377 if isinstance(value, list): 4378 if not value: 4379 self.SetFieldNull(fld_index) 4380 return 4381 if isinstance(value[0], type(1)) or isinstance(value[0], type(12345678901234)): 4382 self.SetFieldInteger64List(fld_index, value) 4383 return 4384 elif isinstance(value[0], float): 4385 self.SetFieldDoubleList(fld_index, value) 4386 return 4387 elif isinstance(value[0], str): 4388 self.SetFieldStringList(fld_index, value) 4389 return 4390 else: 4391 raise TypeError('Unsupported type of list in SetField2(). Type of element is %s' % str(type(value[0]))) 4392 4393 try: 4394 self.SetField(fld_index, value) 4395 except: 4396 self.SetField(fld_index, str(value)) 4397 return
4398
4399 - def keys(self):
4400 names = [] 4401 for i in range(self.GetFieldCount()): 4402 fieldname = self.GetFieldDefnRef(i).GetName() 4403 names.append(fieldname) 4404 return names
4405
4406 - def items(self):
4407 keys = self.keys() 4408 output = {} 4409 for key in keys: 4410 output[key] = self.GetField(key) 4411 return output
4412 - def geometry(self):
4413 return self.GetGeometryRef()
4414
4415 - def ExportToJson(self, as_object=False, options=None):
4416 """Exports a GeoJSON object which represents the Feature. The 4417 as_object parameter determines whether the returned value 4418 should be a Python object instead of a string. Defaults to False. 4419 The options parameter is passed to Geometry.ExportToJson()""" 4420 4421 try: 4422 import simplejson 4423 except ImportError: 4424 try: 4425 import json as simplejson 4426 except ImportError: 4427 raise ImportError("Unable to import simplejson or json, needed for ExportToJson.") 4428 4429 geom = self.GetGeometryRef() 4430 if geom is not None: 4431 if options is None: 4432 options = [] 4433 geom_json_string = geom.ExportToJson(options=options) 4434 geom_json_object = simplejson.loads(geom_json_string) 4435 else: 4436 geom_json_object = None 4437 4438 output = {'type':'Feature', 4439 'geometry': geom_json_object, 4440 'properties': {} 4441 } 4442 4443 fid = self.GetFID() 4444 if fid != NullFID: 4445 output['id'] = fid 4446 4447 for key in self.keys(): 4448 fld_defn = self.GetFieldDefnRef(self.GetFieldIndex(key)) 4449 if fld_defn.GetType() == _ogr.OFTInteger and fld_defn.GetSubType() == _ogr.OFSTBoolean: 4450 output['properties'][key] = bool(self.GetField(key)) 4451 else: 4452 output['properties'][key] = self.GetField(key) 4453 4454 if not as_object: 4455 output = simplejson.dumps(output) 4456 4457 return output
4458 4459 4460 4461 4462 # Register Feature in _ogr: 4463 _ogr.Feature_swigregister(Feature) 4464
4465 -class FeatureDefn(object):
4466 r"""Proxy of C++ OGRFeatureDefnShadow class.""" 4467 4468 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 4469 __repr__ = _swig_repr 4470 __swig_destroy__ = _ogr.delete_FeatureDefn 4471
4472 - def __init__(self, *args, **kwargs):
4473 r"""__init__(FeatureDefn self, char const * name_null_ok=None) -> FeatureDefn""" 4474 _ogr.FeatureDefn_swiginit(self, _ogr.new_FeatureDefn(*args, **kwargs))
4475
4476 - def GetName(self, *args):
4477 r""" 4478 GetName(FeatureDefn self) -> char const * 4479 const char* 4480 OGR_FD_GetName(OGRFeatureDefnH hDefn) 4481 4482 Get name of the OGRFeatureDefn passed as an argument. 4483 4484 This function is the same as the C++ method OGRFeatureDefn::GetName(). 4485 4486 Parameters: 4487 ----------- 4488 4489 hDefn: handle to the feature definition to get the name from. 4490 4491 the name. This name is internal and should not be modified, or freed. 4492 4493 """ 4494 return _ogr.FeatureDefn_GetName(self, *args)
4495
4496 - def GetFieldCount(self, *args):
4497 r""" 4498 GetFieldCount(FeatureDefn self) -> int 4499 int 4500 OGR_FD_GetFieldCount(OGRFeatureDefnH hDefn) 4501 4502 Fetch number of fields on the passed feature definition. 4503 4504 This function is the same as the C++ OGRFeatureDefn::GetFieldCount(). 4505 4506 Parameters: 4507 ----------- 4508 4509 hDefn: handle to the feature definition to get the fields count from. 4510 4511 count of fields. 4512 """ 4513 return _ogr.FeatureDefn_GetFieldCount(self, *args)
4514
4515 - def GetFieldDefn(self, *args):
4516 r""" 4517 GetFieldDefn(FeatureDefn self, int i) -> FieldDefn 4518 OGRFieldDefnH 4519 OGR_FD_GetFieldDefn(OGRFeatureDefnH hDefn, int iField) 4520 4521 Fetch field definition of the passed feature definition. 4522 4523 This function is the same as the C++ method 4524 OGRFeatureDefn::GetFieldDefn(). 4525 4526 Parameters: 4527 ----------- 4528 4529 hDefn: handle to the feature definition to get the field definition 4530 from. 4531 4532 iField: the field to fetch, between 0 and GetFieldCount()-1. 4533 4534 a handle to an internal field definition object or NULL if invalid 4535 index. This object should not be modified or freed by the application. 4536 4537 """ 4538 return _ogr.FeatureDefn_GetFieldDefn(self, *args)
4539
4540 - def GetFieldIndex(self, *args):
4541 r""" 4542 GetFieldIndex(FeatureDefn self, char const * field_name) -> int 4543 int 4544 OGR_FD_GetFieldIndex(OGRFeatureDefnH hDefn, const char *pszFieldName) 4545 4546 Find field by name. 4547 4548 The field index of the first field matching the passed field name 4549 (case insensitively) is returned. 4550 4551 This function is the same as the C++ method 4552 OGRFeatureDefn::GetFieldIndex. 4553 4554 Parameters: 4555 ----------- 4556 4557 hDefn: handle to the feature definition to get field index from. 4558 4559 pszFieldName: the field name to search for. 4560 4561 the field index, or -1 if no match found. 4562 """ 4563 return _ogr.FeatureDefn_GetFieldIndex(self, *args)
4564
4565 - def AddFieldDefn(self, *args):
4566 r""" 4567 AddFieldDefn(FeatureDefn self, FieldDefn defn) 4568 void 4569 OGR_FD_AddFieldDefn(OGRFeatureDefnH hDefn, OGRFieldDefnH hNewField) 4570 4571 Add a new field definition to the passed feature definition. 4572 4573 To add a new field definition to a layer definition, do not use this 4574 function directly, but use OGR_L_CreateField() instead. 4575 4576 This function should only be called while there are no OGRFeature 4577 objects in existence based on this OGRFeatureDefn. The OGRFieldDefn 4578 passed in is copied, and remains the responsibility of the caller. 4579 4580 This function is the same as the C++ method 4581 OGRFeatureDefn::AddFieldDefn(). 4582 4583 Parameters: 4584 ----------- 4585 4586 hDefn: handle to the feature definition to add the field definition 4587 to. 4588 4589 hNewField: handle to the new field definition. 4590 """ 4591 return _ogr.FeatureDefn_AddFieldDefn(self, *args)
4592
4593 - def GetGeomFieldCount(self, *args):
4594 r""" 4595 GetGeomFieldCount(FeatureDefn self) -> int 4596 int 4597 OGR_FD_GetGeomFieldCount(OGRFeatureDefnH hDefn) 4598 4599 Fetch number of geometry fields on the passed feature definition. 4600 4601 This function is the same as the C++ 4602 OGRFeatureDefn::GetGeomFieldCount(). 4603 4604 Parameters: 4605 ----------- 4606 4607 hDefn: handle to the feature definition to get the fields count from. 4608 4609 count of geometry fields. 4610 4611 GDAL 1.11 4612 """ 4613 return _ogr.FeatureDefn_GetGeomFieldCount(self, *args)
4614
4615 - def GetGeomFieldDefn(self, *args):
4616 r""" 4617 GetGeomFieldDefn(FeatureDefn self, int i) -> GeomFieldDefn 4618 OGRGeomFieldDefnH 4619 OGR_FD_GetGeomFieldDefn(OGRFeatureDefnH hDefn, int iGeomField) 4620 4621 Fetch geometry field definition of the passed feature definition. 4622 4623 This function is the same as the C++ method 4624 OGRFeatureDefn::GetGeomFieldDefn(). 4625 4626 Parameters: 4627 ----------- 4628 4629 hDefn: handle to the feature definition to get the field definition 4630 from. 4631 4632 iGeomField: the geometry field to fetch, between 0 and 4633 GetGeomFieldCount() - 1. 4634 4635 a handle to an internal field definition object or NULL if invalid 4636 index. This object should not be modified or freed by the application. 4637 4638 GDAL 1.11 4639 """ 4640 return _ogr.FeatureDefn_GetGeomFieldDefn(self, *args)
4641
4642 - def GetGeomFieldIndex(self, *args):
4643 r""" 4644 GetGeomFieldIndex(FeatureDefn self, char const * field_name) -> int 4645 int 4646 OGR_FD_GetGeomFieldIndex(OGRFeatureDefnH hDefn, const char 4647 *pszGeomFieldName) 4648 4649 Find geometry field by name. 4650 4651 The geometry field index of the first geometry field matching the 4652 passed field name (case insensitively) is returned. 4653 4654 This function is the same as the C++ method 4655 OGRFeatureDefn::GetGeomFieldIndex. 4656 4657 Parameters: 4658 ----------- 4659 4660 hDefn: handle to the feature definition to get field index from. 4661 4662 pszGeomFieldName: the geometry field name to search for. 4663 4664 the geometry field index, or -1 if no match found. 4665 """ 4666 return _ogr.FeatureDefn_GetGeomFieldIndex(self, *args)
4667
4668 - def AddGeomFieldDefn(self, *args):
4669 r""" 4670 AddGeomFieldDefn(FeatureDefn self, GeomFieldDefn defn) 4671 void 4672 OGR_FD_AddGeomFieldDefn(OGRFeatureDefnH hDefn, OGRGeomFieldDefnH 4673 hNewGeomField) 4674 4675 Add a new field definition to the passed feature definition. 4676 4677 To add a new field definition to a layer definition, do not use this 4678 function directly, but use OGR_L_CreateGeomField() instead. 4679 4680 This function should only be called while there are no OGRFeature 4681 objects in existence based on this OGRFeatureDefn. The 4682 OGRGeomFieldDefn passed in is copied, and remains the responsibility 4683 of the caller. 4684 4685 This function is the same as the C++ method 4686 OGRFeatureDefn::AddGeomFieldDefn(). 4687 4688 Parameters: 4689 ----------- 4690 4691 hDefn: handle to the feature definition to add the geometry field 4692 definition to. 4693 4694 hNewGeomField: handle to the new field definition. 4695 4696 GDAL 1.11 4697 """ 4698 return _ogr.FeatureDefn_AddGeomFieldDefn(self, *args)
4699
4700 - def DeleteGeomFieldDefn(self, *args):
4701 r""" 4702 DeleteGeomFieldDefn(FeatureDefn self, int idx) -> OGRErr 4703 OGRErr 4704 OGR_FD_DeleteGeomFieldDefn(OGRFeatureDefnH hDefn, int iGeomField) 4705 4706 Delete an existing geometry field definition. 4707 4708 To delete an existing geometry field definition from a layer 4709 definition, do not use this function directly, but use 4710 OGR_L_DeleteGeomField() instead ( not implemented yet). 4711 4712 This method should only be called while there are no OGRFeature 4713 objects in existence based on this OGRFeatureDefn. 4714 4715 This method is the same as the C++ method 4716 OGRFeatureDefn::DeleteGeomFieldDefn(). 4717 4718 Parameters: 4719 ----------- 4720 4721 hDefn: handle to the feature definition. 4722 4723 iGeomField: the index of the geometry field definition. 4724 4725 OGRERR_NONE in case of success. 4726 4727 GDAL 1.11 4728 """ 4729 return _ogr.FeatureDefn_DeleteGeomFieldDefn(self, *args)
4730
4731 - def GetGeomType(self, *args):
4732 r""" 4733 GetGeomType(FeatureDefn self) -> OGRwkbGeometryType 4734 OGRwkbGeometryType 4735 OGR_FD_GetGeomType(OGRFeatureDefnH hDefn) 4736 4737 Fetch the geometry base type of the passed feature definition. 4738 4739 This function is the same as the C++ method 4740 OGRFeatureDefn::GetGeomType(). 4741 4742 Starting with GDAL 1.11, this method returns 4743 GetGeomFieldDefn(0)->GetType(). 4744 4745 Parameters: 4746 ----------- 4747 4748 hDefn: handle to the feature definition to get the geometry type 4749 from. 4750 4751 the base type for all geometry related to this definition. 4752 """ 4753 return _ogr.FeatureDefn_GetGeomType(self, *args)
4754
4755 - def SetGeomType(self, *args):
4756 r""" 4757 SetGeomType(FeatureDefn self, OGRwkbGeometryType geom_type) 4758 void 4759 OGR_FD_SetGeomType(OGRFeatureDefnH hDefn, OGRwkbGeometryType eType) 4760 4761 Assign the base geometry type for the passed layer (the same as the 4762 feature definition). 4763 4764 All geometry objects using this type must be of the defined type or a 4765 derived type. The default upon creation is wkbUnknown which allows for 4766 any geometry type. The geometry type should generally not be changed 4767 after any OGRFeatures have been created against this definition. 4768 4769 This function is the same as the C++ method 4770 OGRFeatureDefn::SetGeomType(). 4771 4772 Starting with GDAL 1.11, this method calls 4773 GetGeomFieldDefn(0)->SetType(). 4774 4775 Parameters: 4776 ----------- 4777 4778 hDefn: handle to the layer or feature definition to set the geometry 4779 type to. 4780 4781 eType: the new type to assign. 4782 """ 4783 return _ogr.FeatureDefn_SetGeomType(self, *args)
4784
4785 - def GetReferenceCount(self, *args):
4786 r""" 4787 GetReferenceCount(FeatureDefn self) -> int 4788 int 4789 OGR_FD_GetReferenceCount(OGRFeatureDefnH hDefn) 4790 4791 Fetch current reference count. 4792 4793 This function is the same as the C++ method 4794 OGRFeatureDefn::GetReferenceCount(). 4795 4796 Parameters: 4797 ----------- 4798 4799 hDefn: handle to the feature definition on witch OGRFeature are based 4800 on. 4801 4802 the current reference count. 4803 """ 4804 return _ogr.FeatureDefn_GetReferenceCount(self, *args)
4805
4806 - def IsGeometryIgnored(self, *args):
4807 r""" 4808 IsGeometryIgnored(FeatureDefn self) -> int 4809 int 4810 OGR_FD_IsGeometryIgnored(OGRFeatureDefnH hDefn) 4811 4812 Determine whether the geometry can be omitted when fetching features. 4813 4814 This function is the same as the C++ method 4815 OGRFeatureDefn::IsGeometryIgnored(). 4816 4817 Starting with GDAL 1.11, this method returns 4818 GetGeomFieldDefn(0)->IsIgnored(). 4819 4820 Parameters: 4821 ----------- 4822 4823 hDefn: handle to the feature definition on witch OGRFeature are based 4824 on. 4825 4826 ignore state 4827 """ 4828 return _ogr.FeatureDefn_IsGeometryIgnored(self, *args)
4829
4830 - def SetGeometryIgnored(self, *args):
4831 r""" 4832 SetGeometryIgnored(FeatureDefn self, int bIgnored) 4833 void 4834 OGR_FD_SetGeometryIgnored(OGRFeatureDefnH hDefn, int bIgnore) 4835 4836 Set whether the geometry can be omitted when fetching features. 4837 4838 This function is the same as the C++ method 4839 OGRFeatureDefn::SetGeometryIgnored(). 4840 4841 Starting with GDAL 1.11, this method calls 4842 GetGeomFieldDefn(0)->SetIgnored(). 4843 4844 Parameters: 4845 ----------- 4846 4847 hDefn: handle to the feature definition on witch OGRFeature are based 4848 on. 4849 4850 bIgnore: ignore state 4851 """ 4852 return _ogr.FeatureDefn_SetGeometryIgnored(self, *args)
4853
4854 - def IsStyleIgnored(self, *args):
4855 r""" 4856 IsStyleIgnored(FeatureDefn self) -> int 4857 int 4858 OGR_FD_IsStyleIgnored(OGRFeatureDefnH hDefn) 4859 4860 Determine whether the style can be omitted when fetching features. 4861 4862 This function is the same as the C++ method 4863 OGRFeatureDefn::IsStyleIgnored(). 4864 4865 Parameters: 4866 ----------- 4867 4868 hDefn: handle to the feature definition on which OGRFeature are based 4869 on. 4870 4871 ignore state 4872 """ 4873 return _ogr.FeatureDefn_IsStyleIgnored(self, *args)
4874
4875 - def SetStyleIgnored(self, *args):
4876 r""" 4877 SetStyleIgnored(FeatureDefn self, int bIgnored) 4878 void 4879 OGR_FD_SetStyleIgnored(OGRFeatureDefnH hDefn, int bIgnore) 4880 4881 Set whether the style can be omitted when fetching features. 4882 4883 This function is the same as the C++ method 4884 OGRFeatureDefn::SetStyleIgnored(). 4885 4886 Parameters: 4887 ----------- 4888 4889 hDefn: handle to the feature definition on witch OGRFeature are based 4890 on. 4891 4892 bIgnore: ignore state 4893 """ 4894 return _ogr.FeatureDefn_SetStyleIgnored(self, *args)
4895
4896 - def IsSame(self, *args):
4897 r""" 4898 IsSame(FeatureDefn self, FeatureDefn other_defn) -> int 4899 int OGR_FD_IsSame(OGRFeatureDefnH 4900 hFDefn, OGRFeatureDefnH hOtherFDefn) 4901 4902 Test if the feature definition is identical to the other one. 4903 4904 Parameters: 4905 ----------- 4906 4907 hFDefn: handle to the feature definition on witch OGRFeature are 4908 based on. 4909 4910 hOtherFDefn: handle to the other feature definition to compare to. 4911 4912 TRUE if the feature definition is identical to the other one. 4913 4914 OGR 1.11 4915 """ 4916 return _ogr.FeatureDefn_IsSame(self, *args)
4917
4918 - def Destroy(self):
4919 "Once called, self has effectively been destroyed. Do not access. For backwards compatibility only" 4920 _ogr.delete_FeatureDefn(self) 4921 self.thisown = 0
4922 4923 4924 4925 # Register FeatureDefn in _ogr: 4926 _ogr.FeatureDefn_swigregister(FeatureDefn) 4927
4928 -class FieldDefn(object):
4929 r"""Proxy of C++ OGRFieldDefnShadow class.""" 4930 4931 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 4932 __repr__ = _swig_repr 4933 __swig_destroy__ = _ogr.delete_FieldDefn 4934
4935 - def __init__(self, *args, **kwargs):
4936 r"""__init__(FieldDefn self, char const * name_null_ok="unnamed", OGRFieldType field_type=OFTString) -> FieldDefn""" 4937 _ogr.FieldDefn_swiginit(self, _ogr.new_FieldDefn(*args, **kwargs))
4938
4939 - def GetName(self, *args):
4940 r"""GetName(FieldDefn self) -> char const *""" 4941 return _ogr.FieldDefn_GetName(self, *args)
4942
4943 - def GetNameRef(self, *args):
4944 r""" 4945 GetNameRef(FieldDefn self) -> char const * 4946 const char* 4947 OGR_Fld_GetNameRef(OGRFieldDefnH hDefn) 4948 4949 Fetch name of this field. 4950 4951 This function is the same as the CPP method 4952 OGRFieldDefn::GetNameRef(). 4953 4954 Parameters: 4955 ----------- 4956 4957 hDefn: handle to the field definition. 4958 4959 the name of the field definition. 4960 """ 4961 return _ogr.FieldDefn_GetNameRef(self, *args)
4962
4963 - def SetName(self, *args):
4964 r""" 4965 SetName(FieldDefn self, char const * name) 4966 void OGR_Fld_SetName(OGRFieldDefnH 4967 hDefn, const char *pszName) 4968 4969 Reset the name of this field. 4970 4971 This function is the same as the CPP method OGRFieldDefn::SetName(). 4972 4973 Parameters: 4974 ----------- 4975 4976 hDefn: handle to the field definition to apply the new name to. 4977 4978 pszName: the new name to apply. 4979 """ 4980 return _ogr.FieldDefn_SetName(self, *args)
4981
4982 - def GetAlternativeName(self, *args):
4983 r"""GetAlternativeName(FieldDefn self) -> char const *""" 4984 return _ogr.FieldDefn_GetAlternativeName(self, *args)
4985
4986 - def GetAlternativeNameRef(self, *args):
4987 r""" 4988 GetAlternativeNameRef(FieldDefn self) -> char const * 4989 const char* 4990 OGR_Fld_GetAlternativeNameRef(OGRFieldDefnH hDefn) 4991 4992 Fetch the alternative name (or "alias") for this field. 4993 4994 The alternative name is an optional attribute for a field which can 4995 provide a more user-friendly, descriptive name of a field which is not 4996 subject to the usual naming constraints defined by the data provider. 4997 4998 This is a metadata style attribute only: the alternative name cannot 4999 be used in place of the actual field name during SQL queries or other 5000 field name dependent API calls. 5001 5002 This function is the same as the CPP method 5003 OGRFieldDefn::GetAlternativeNameRef(). 5004 5005 Parameters: 5006 ----------- 5007 5008 hDefn: handle to the field definition. 5009 5010 the alternative name of the field definition. 5011 5012 GDAL 3.2 5013 """ 5014 return _ogr.FieldDefn_GetAlternativeNameRef(self, *args)
5015
5016 - def SetAlternativeName(self, *args):
5017 r""" 5018 SetAlternativeName(FieldDefn self, char const * alternativeName) 5019 void 5020 OGR_Fld_SetAlternativeName(OGRFieldDefnH hDefn, const char 5021 *pszAlternativeName) 5022 5023 Reset the alternative name (or "alias") for this field. 5024 5025 The alternative name is an optional attribute for a field which can 5026 provide a more user-friendly, descriptive name of a field which is not 5027 subject to the usual naming constraints defined by the data provider. 5028 5029 This is a metadata style attribute only: the alternative name cannot 5030 be used in place of the actual field name during SQL queries or other 5031 field name dependent API calls. 5032 5033 This function is the same as the CPP method 5034 OGRFieldDefn::SetAlternativeName(). 5035 5036 Parameters: 5037 ----------- 5038 5039 hDefn: handle to the field definition to apply the new alternative 5040 name to. 5041 5042 pszAlternativeName: the new alternative name to apply. 5043 5044 GDAL 3.2 5045 """ 5046 return _ogr.FieldDefn_SetAlternativeName(self, *args)
5047
5048 - def GetType(self, *args):
5049 r""" 5050 GetType(FieldDefn self) -> OGRFieldType 5051 OGRFieldType 5052 OGR_Fld_GetType(OGRFieldDefnH hDefn) 5053 5054 Fetch type of this field. 5055 5056 This function is the same as the CPP method OGRFieldDefn::GetType(). 5057 5058 Parameters: 5059 ----------- 5060 5061 hDefn: handle to the field definition to get type from. 5062 5063 field type. 5064 """ 5065 return _ogr.FieldDefn_GetType(self, *args)
5066
5067 - def SetType(self, *args):
5068 r""" 5069 SetType(FieldDefn self, OGRFieldType type) 5070 void OGR_Fld_SetType(OGRFieldDefnH 5071 hDefn, OGRFieldType eType) 5072 5073 Set the type of this field. 5074 5075 This should never be done to an OGRFieldDefn that is already part of 5076 an OGRFeatureDefn. 5077 5078 This function is the same as the CPP method OGRFieldDefn::SetType(). 5079 5080 Parameters: 5081 ----------- 5082 5083 hDefn: handle to the field definition to set type to. 5084 5085 eType: the new field type. 5086 """ 5087 return _ogr.FieldDefn_SetType(self, *args)
5088
5089 - def GetSubType(self, *args):
5090 r""" 5091 GetSubType(FieldDefn self) -> OGRFieldSubType 5092 OGRFieldSubType 5093 OGR_Fld_GetSubType(OGRFieldDefnH hDefn) 5094 5095 Fetch subtype of this field. 5096 5097 This function is the same as the CPP method 5098 OGRFieldDefn::GetSubType(). 5099 5100 Parameters: 5101 ----------- 5102 5103 hDefn: handle to the field definition to get subtype from. 5104 5105 field subtype. 5106 5107 GDAL 2.0 5108 """ 5109 return _ogr.FieldDefn_GetSubType(self, *args)
5110
5111 - def SetSubType(self, *args):
5112 r""" 5113 SetSubType(FieldDefn self, OGRFieldSubType type) 5114 void 5115 OGR_Fld_SetSubType(OGRFieldDefnH hDefn, OGRFieldSubType eSubType) 5116 5117 Set the subtype of this field. 5118 5119 This should never be done to an OGRFieldDefn that is already part of 5120 an OGRFeatureDefn. 5121 5122 This function is the same as the CPP method 5123 OGRFieldDefn::SetSubType(). 5124 5125 Parameters: 5126 ----------- 5127 5128 hDefn: handle to the field definition to set type to. 5129 5130 eSubType: the new field subtype. 5131 5132 GDAL 2.0 5133 """ 5134 return _ogr.FieldDefn_SetSubType(self, *args)
5135
5136 - def GetJustify(self, *args):
5137 r""" 5138 GetJustify(FieldDefn self) -> OGRJustification 5139 OGRJustification 5140 OGR_Fld_GetJustify(OGRFieldDefnH hDefn) 5141 5142 Get the justification for this field. 5143 5144 This function is the same as the CPP method 5145 OGRFieldDefn::GetJustify(). 5146 5147 Note: no driver is know to use the concept of field justification. 5148 5149 Parameters: 5150 ----------- 5151 5152 hDefn: handle to the field definition to get justification from. 5153 5154 the justification. 5155 """ 5156 return _ogr.FieldDefn_GetJustify(self, *args)
5157
5158 - def SetJustify(self, *args):
5159 r""" 5160 SetJustify(FieldDefn self, OGRJustification justify) 5161 void 5162 OGR_Fld_SetJustify(OGRFieldDefnH hDefn, OGRJustification eJustify) 5163 5164 Set the justification for this field. 5165 5166 Note: no driver is know to use the concept of field justification. 5167 5168 This function is the same as the CPP method 5169 OGRFieldDefn::SetJustify(). 5170 5171 Parameters: 5172 ----------- 5173 5174 hDefn: handle to the field definition to set justification to. 5175 5176 eJustify: the new justification. 5177 """ 5178 return _ogr.FieldDefn_SetJustify(self, *args)
5179
5180 - def GetWidth(self, *args):
5181 r""" 5182 GetWidth(FieldDefn self) -> int 5183 int OGR_Fld_GetWidth(OGRFieldDefnH 5184 hDefn) 5185 5186 Get the formatting width for this field. 5187 5188 This function is the same as the CPP method OGRFieldDefn::GetWidth(). 5189 5190 Parameters: 5191 ----------- 5192 5193 hDefn: handle to the field definition to get width from. 5194 5195 the width, zero means no specified width. 5196 """ 5197 return _ogr.FieldDefn_GetWidth(self, *args)
5198
5199 - def SetWidth(self, *args):
5200 r""" 5201 SetWidth(FieldDefn self, int width) 5202 void OGR_Fld_SetWidth(OGRFieldDefnH 5203 hDefn, int nNewWidth) 5204 5205 Set the formatting width for this field in characters. 5206 5207 This function is the same as the CPP method OGRFieldDefn::SetWidth(). 5208 5209 Parameters: 5210 ----------- 5211 5212 hDefn: handle to the field definition to set width to. 5213 5214 nNewWidth: the new width. 5215 """ 5216 return _ogr.FieldDefn_SetWidth(self, *args)
5217
5218 - def GetPrecision(self, *args):
5219 r""" 5220 GetPrecision(FieldDefn self) -> int 5221 int 5222 OGR_Fld_GetPrecision(OGRFieldDefnH hDefn) 5223 5224 Get the formatting precision for this field. 5225 5226 This should normally be zero for fields of types other than OFTReal. 5227 5228 This function is the same as the CPP method 5229 OGRFieldDefn::GetPrecision(). 5230 5231 Parameters: 5232 ----------- 5233 5234 hDefn: handle to the field definition to get precision from. 5235 5236 the precision. 5237 """ 5238 return _ogr.FieldDefn_GetPrecision(self, *args)
5239
5240 - def SetPrecision(self, *args):
5241 r""" 5242 SetPrecision(FieldDefn self, int precision) 5243 void 5244 OGR_Fld_SetPrecision(OGRFieldDefnH hDefn, int nPrecision) 5245 5246 Set the formatting precision for this field in characters. 5247 5248 This should normally be zero for fields of types other than OFTReal. 5249 5250 This function is the same as the CPP method 5251 OGRFieldDefn::SetPrecision(). 5252 5253 Parameters: 5254 ----------- 5255 5256 hDefn: handle to the field definition to set precision to. 5257 5258 nPrecision: the new precision. 5259 """ 5260 return _ogr.FieldDefn_SetPrecision(self, *args)
5261
5262 - def GetTypeName(self, *args):
5263 r"""GetTypeName(FieldDefn self) -> char const *""" 5264 return _ogr.FieldDefn_GetTypeName(self, *args)
5265
5266 - def GetFieldTypeName(self, *args):
5267 r"""GetFieldTypeName(FieldDefn self, OGRFieldType type) -> char const *""" 5268 return _ogr.FieldDefn_GetFieldTypeName(self, *args)
5269
5270 - def IsIgnored(self, *args):
5271 r""" 5272 IsIgnored(FieldDefn self) -> int 5273 int OGR_Fld_IsIgnored(OGRFieldDefnH 5274 hDefn) 5275 5276 Return whether this field should be omitted when fetching features. 5277 5278 This method is the same as the C++ method OGRFieldDefn::IsIgnored(). 5279 5280 Parameters: 5281 ----------- 5282 5283 hDefn: handle to the field definition 5284 5285 ignore state 5286 """ 5287 return _ogr.FieldDefn_IsIgnored(self, *args)
5288
5289 - def SetIgnored(self, *args):
5290 r""" 5291 SetIgnored(FieldDefn self, int bIgnored) 5292 void 5293 OGR_Fld_SetIgnored(OGRFieldDefnH hDefn, int ignore) 5294 5295 Set whether this field should be omitted when fetching features. 5296 5297 This method is the same as the C++ method OGRFieldDefn::SetIgnored(). 5298 5299 Parameters: 5300 ----------- 5301 5302 hDefn: handle to the field definition 5303 5304 ignore: ignore state 5305 """ 5306 return _ogr.FieldDefn_SetIgnored(self, *args)
5307
5308 - def IsNullable(self, *args):
5309 r""" 5310 IsNullable(FieldDefn self) -> int 5311 int 5312 OGR_Fld_IsNullable(OGRFieldDefnH hDefn) 5313 5314 Return whether this field can receive null values. 5315 5316 By default, fields are nullable. 5317 5318 Even if this method returns FALSE (i.e not-nullable field), it doesn't 5319 mean that OGRFeature::IsFieldSet() will necessary return TRUE, as 5320 fields can be temporary unset and null /not-null validation is usually 5321 done when OGRLayer::CreateFeature()/SetFeature() is called. 5322 5323 This method is the same as the C++ method OGRFieldDefn::IsNullable(). 5324 5325 Parameters: 5326 ----------- 5327 5328 hDefn: handle to the field definition 5329 5330 TRUE if the field is authorized to be null. 5331 5332 GDAL 2.0 5333 """ 5334 return _ogr.FieldDefn_IsNullable(self, *args)
5335
5336 - def SetNullable(self, *args):
5337 r""" 5338 SetNullable(FieldDefn self, int bNullable) 5339 void 5340 OGR_Fld_SetNullable(OGRFieldDefnH hDefn, int bNullableIn) 5341 5342 Set whether this field can receive null values. 5343 5344 By default, fields are nullable, so this method is generally called 5345 with FALSE to set a not-null constraint. 5346 5347 Drivers that support writing not-null constraint will advertise the 5348 GDAL_DCAP_NOTNULL_FIELDS driver metadata item. 5349 5350 This method is the same as the C++ method OGRFieldDefn::SetNullable(). 5351 5352 Parameters: 5353 ----------- 5354 5355 hDefn: handle to the field definition 5356 5357 bNullableIn: FALSE if the field must have a not-null constraint. 5358 5359 GDAL 2.0 5360 """ 5361 return _ogr.FieldDefn_SetNullable(self, *args)
5362
5363 - def IsUnique(self, *args):
5364 r""" 5365 IsUnique(FieldDefn self) -> int 5366 int OGR_Fld_IsUnique(OGRFieldDefnH 5367 hDefn) 5368 5369 Return whether this field has a unique constraint. 5370 5371 By default, fields have no unique constraint. 5372 5373 This method is the same as the C++ method OGRFieldDefn::IsUnique(). 5374 5375 Parameters: 5376 ----------- 5377 5378 hDefn: handle to the field definition 5379 5380 TRUE if the field has a unique constraint. 5381 5382 GDAL 3.2 5383 """ 5384 return _ogr.FieldDefn_IsUnique(self, *args)
5385
5386 - def SetUnique(self, *args):
5387 r""" 5388 SetUnique(FieldDefn self, int bUnique) 5389 void 5390 OGR_Fld_SetUnique(OGRFieldDefnH hDefn, int bUniqueIn) 5391 5392 Set whether this field has a unique constraint. 5393 5394 By default, fields have no unique constraint, so this method is 5395 generally called with TRUE to set a unique constraint. 5396 5397 Drivers that support writing unique constraint will advertise the 5398 GDAL_DCAP_UNIQUE_FIELDS driver metadata item. field can receive null 5399 values. 5400 5401 This method is the same as the C++ method OGRFieldDefn::SetUnique(). 5402 5403 Parameters: 5404 ----------- 5405 5406 hDefn: handle to the field definition 5407 5408 bUniqueIn: TRUE if the field must have a unique constraint. 5409 5410 GDAL 3.2 5411 """ 5412 return _ogr.FieldDefn_SetUnique(self, *args)
5413
5414 - def GetDefault(self, *args):
5415 r""" 5416 GetDefault(FieldDefn self) -> char const * 5417 const char* 5418 OGR_Fld_GetDefault(OGRFieldDefnH hDefn) 5419 5420 Get default field value. 5421 5422 This function is the same as the C++ method 5423 OGRFieldDefn::GetDefault(). 5424 5425 Parameters: 5426 ----------- 5427 5428 hDefn: handle to the field definition. 5429 5430 default field value or NULL. 5431 5432 GDAL 2.0 5433 """ 5434 return _ogr.FieldDefn_GetDefault(self, *args)
5435
5436 - def SetDefault(self, *args):
5437 r""" 5438 SetDefault(FieldDefn self, char const * pszValue) 5439 void 5440 OGR_Fld_SetDefault(OGRFieldDefnH hDefn, const char *pszDefault) 5441 5442 Set default field value. 5443 5444 The default field value is taken into account by drivers (generally 5445 those with a SQL interface) that support it at field creation time. 5446 OGR will generally not automatically set the default field value to 5447 null fields by itself when calling OGRFeature::CreateFeature() / 5448 OGRFeature::SetFeature(), but will let the low-level layers to do the 5449 job. So retrieving the feature from the layer is recommended. 5450 5451 The accepted values are NULL, a numeric value, a literal value 5452 enclosed between single quote characters (and inner single quote 5453 characters escaped by repetition of the single quote character), 5454 CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE or a driver specific 5455 expression (that might be ignored by other drivers). For a datetime 5456 literal value, format should be 'YYYY/MM/DD HH:MM:SS[.sss]' 5457 (considered as UTC time). 5458 5459 Drivers that support writing DEFAULT clauses will advertise the 5460 GDAL_DCAP_DEFAULT_FIELDS driver metadata item. 5461 5462 This function is the same as the C++ method 5463 OGRFieldDefn::SetDefault(). 5464 5465 Parameters: 5466 ----------- 5467 5468 hDefn: handle to the field definition. 5469 5470 pszDefault: new default field value or NULL pointer. 5471 5472 GDAL 2.0 5473 """ 5474 return _ogr.FieldDefn_SetDefault(self, *args)
5475
5476 - def IsDefaultDriverSpecific(self, *args):
5477 r""" 5478 IsDefaultDriverSpecific(FieldDefn self) -> int 5479 int 5480 OGR_Fld_IsDefaultDriverSpecific(OGRFieldDefnH hDefn) 5481 5482 Returns whether the default value is driver specific. 5483 5484 Driver specific default values are those that are not NULL, a numeric 5485 value, a literal value enclosed between single quote characters, 5486 CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE or datetime literal 5487 value. 5488 5489 This function is the same as the C++ method 5490 OGRFieldDefn::IsDefaultDriverSpecific(). 5491 5492 Parameters: 5493 ----------- 5494 5495 hDefn: handle to the field definition 5496 5497 TRUE if the default value is driver specific. 5498 5499 GDAL 2.0 5500 """ 5501 return _ogr.FieldDefn_IsDefaultDriverSpecific(self, *args)
5502
5503 - def GetDomainName(self, *args):
5504 r"""GetDomainName(FieldDefn self) -> char const *""" 5505 return _ogr.FieldDefn_GetDomainName(self, *args)
5506
5507 - def SetDomainName(self, *args):
5508 r"""SetDomainName(FieldDefn self, char const * name)""" 5509 return _ogr.FieldDefn_SetDomainName(self, *args)
5510 5511 width = property(GetWidth, SetWidth) 5512 type = property(GetType, SetType) 5513 precision = property(GetPrecision, SetPrecision) 5514 name = property(GetName, SetName) 5515 justify = property(GetJustify, SetJustify) 5516 5517
5518 - def Destroy(self):
5519 "Once called, self has effectively been destroyed. Do not access. For backwards compatibility only" 5520 _ogr.delete_FieldDefn(self) 5521 self.thisown = 0
5522 5523 5524 # Register FieldDefn in _ogr: 5525 _ogr.FieldDefn_swigregister(FieldDefn) 5526
5527 -class GeomFieldDefn(object):
5528 r"""Proxy of C++ OGRGeomFieldDefnShadow class.""" 5529 5530 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 5531 __repr__ = _swig_repr 5532 __swig_destroy__ = _ogr.delete_GeomFieldDefn 5533
5534 - def __init__(self, *args, **kwargs):
5535 r"""__init__(GeomFieldDefn self, char const * name_null_ok="", OGRwkbGeometryType field_type=wkbUnknown) -> GeomFieldDefn""" 5536 _ogr.GeomFieldDefn_swiginit(self, _ogr.new_GeomFieldDefn(*args, **kwargs))
5537
5538 - def GetName(self, *args):
5539 r"""GetName(GeomFieldDefn self) -> char const *""" 5540 return _ogr.GeomFieldDefn_GetName(self, *args)
5541
5542 - def GetNameRef(self, *args):
5543 r"""GetNameRef(GeomFieldDefn self) -> char const *""" 5544 return _ogr.GeomFieldDefn_GetNameRef(self, *args)
5545
5546 - def SetName(self, *args):
5547 r"""SetName(GeomFieldDefn self, char const * name)""" 5548 return _ogr.GeomFieldDefn_SetName(self, *args)
5549
5550 - def GetType(self, *args):
5551 r"""GetType(GeomFieldDefn self) -> OGRwkbGeometryType""" 5552 return _ogr.GeomFieldDefn_GetType(self, *args)
5553
5554 - def SetType(self, *args):
5555 r"""SetType(GeomFieldDefn self, OGRwkbGeometryType type)""" 5556 return _ogr.GeomFieldDefn_SetType(self, *args)
5557
5558 - def GetSpatialRef(self, *args):
5559 r"""GetSpatialRef(GeomFieldDefn self) -> SpatialReference""" 5560 return _ogr.GeomFieldDefn_GetSpatialRef(self, *args)
5561
5562 - def SetSpatialRef(self, *args):
5563 r"""SetSpatialRef(GeomFieldDefn self, SpatialReference srs)""" 5564 return _ogr.GeomFieldDefn_SetSpatialRef(self, *args)
5565
5566 - def IsIgnored(self, *args):
5567 r"""IsIgnored(GeomFieldDefn self) -> int""" 5568 return _ogr.GeomFieldDefn_IsIgnored(self, *args)
5569
5570 - def SetIgnored(self, *args):
5571 r"""SetIgnored(GeomFieldDefn self, int bIgnored)""" 5572 return _ogr.GeomFieldDefn_SetIgnored(self, *args)
5573
5574 - def IsNullable(self, *args):
5575 r"""IsNullable(GeomFieldDefn self) -> int""" 5576 return _ogr.GeomFieldDefn_IsNullable(self, *args)
5577
5578 - def SetNullable(self, *args):
5579 r"""SetNullable(GeomFieldDefn self, int bNullable)""" 5580 return _ogr.GeomFieldDefn_SetNullable(self, *args)
5581 5582 type = property(GetType, SetType) 5583 name = property(GetName, SetName) 5584 srs = property(GetSpatialRef, SetSpatialRef)
5585 5586 5587 # Register GeomFieldDefn in _ogr: 5588 _ogr.GeomFieldDefn_swigregister(GeomFieldDefn) 5589 5590
5591 -def CreateGeometryFromWkb(*args, **kwargs):
5592 r"""CreateGeometryFromWkb(size_t len, SpatialReference reference=None) -> Geometry""" 5593 return _ogr.CreateGeometryFromWkb(*args, **kwargs)
5594
5595 -def CreateGeometryFromWkt(*args, **kwargs):
5596 r"""CreateGeometryFromWkt(char ** val, SpatialReference reference=None) -> Geometry""" 5597 return _ogr.CreateGeometryFromWkt(*args, **kwargs)
5598
5599 -def CreateGeometryFromGML(*args):
5600 r"""CreateGeometryFromGML(char const * input_string) -> Geometry""" 5601 return _ogr.CreateGeometryFromGML(*args)
5602
5603 -def CreateGeometryFromJson(*args):
5604 r"""CreateGeometryFromJson(char const * input_string) -> Geometry""" 5605 return _ogr.CreateGeometryFromJson(*args)
5606
5607 -def CreateGeometryFromEsriJson(*args):
5608 r"""CreateGeometryFromEsriJson(char const * input_string) -> Geometry""" 5609 return _ogr.CreateGeometryFromEsriJson(*args)
5610
5611 -def BuildPolygonFromEdges(*args, **kwargs):
5612 r"""BuildPolygonFromEdges(Geometry hLineCollection, int bBestEffort=0, int bAutoClose=0, double dfTolerance=0) -> Geometry""" 5613 return _ogr.BuildPolygonFromEdges(*args, **kwargs)
5614
5615 -def ApproximateArcAngles(*args, **kwargs):
5616 r"""ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees) -> Geometry""" 5617 return _ogr.ApproximateArcAngles(*args, **kwargs)
5618
5619 -def ForceToPolygon(*args):
5620 r"""ForceToPolygon(Geometry geom_in) -> Geometry""" 5621 return _ogr.ForceToPolygon(*args)
5622
5623 -def ForceToLineString(*args):
5624 r"""ForceToLineString(Geometry geom_in) -> Geometry""" 5625 return _ogr.ForceToLineString(*args)
5626
5627 -def ForceToMultiPolygon(*args):
5628 r"""ForceToMultiPolygon(Geometry geom_in) -> Geometry""" 5629 return _ogr.ForceToMultiPolygon(*args)
5630
5631 -def ForceToMultiPoint(*args):
5632 r"""ForceToMultiPoint(Geometry geom_in) -> Geometry""" 5633 return _ogr.ForceToMultiPoint(*args)
5634
5635 -def ForceToMultiLineString(*args):
5636 r"""ForceToMultiLineString(Geometry geom_in) -> Geometry""" 5637 return _ogr.ForceToMultiLineString(*args)
5638
5639 -def ForceTo(*args):
5640 r"""ForceTo(Geometry geom_in, OGRwkbGeometryType eTargetType, char ** options=None) -> Geometry""" 5641 return _ogr.ForceTo(*args)
5642 -class Geometry(object):
5643 r"""Proxy of C++ OGRGeometryShadow class.""" 5644 5645 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 5646 __repr__ = _swig_repr 5647 __swig_destroy__ = _ogr.delete_Geometry 5648
5649 - def __init__(self, *args, **kwargs):
5650 r"""__init__(Geometry self, OGRwkbGeometryType type=wkbUnknown, char * wkt=None, int wkb=0, char * gml=None) -> Geometry""" 5651 _ogr.Geometry_swiginit(self, _ogr.new_Geometry(*args, **kwargs))
5652
5653 - def ExportToWkt(self, *args):
5654 r""" 5655 ExportToWkt(Geometry self) -> OGRErr 5656 OGRErr 5657 OGR_G_ExportToWkt(OGRGeometryH hGeom, char **ppszSrcText) 5658 5659 Convert a geometry into well known text format. 5660 5661 This function relates to the SFCOM IWks::ExportToWKT() method. 5662 5663 For backward compatibility purposes, it exports the Old-style 99-402 5664 extended dimension (Z) WKB types for types Point, LineString, Polygon, 5665 MultiPoint, MultiLineString, MultiPolygon and GeometryCollection. For 5666 other geometry types, it is equivalent to OGR_G_ExportToIsoWkt(). 5667 5668 This function is the same as the CPP method 5669 OGRGeometry::exportToWkt(). 5670 5671 Parameters: 5672 ----------- 5673 5674 hGeom: handle on the geometry to convert to a text format from. 5675 5676 ppszSrcText: a text buffer is allocated by the program, and assigned 5677 to the passed pointer. After use, *ppszDstText should be freed with 5678 CPLFree(). 5679 5680 Currently OGRERR_NONE is always returned. 5681 """ 5682 return _ogr.Geometry_ExportToWkt(self, *args)
5683
5684 - def ExportToIsoWkt(self, *args):
5685 r""" 5686 ExportToIsoWkt(Geometry self) -> OGRErr 5687 OGRErr 5688 OGR_G_ExportToIsoWkt(OGRGeometryH hGeom, char **ppszSrcText) 5689 5690 Convert a geometry into SFSQL 1.2 / ISO SQL/MM Part 3 well known text 5691 format. 5692 5693 This function relates to the SFCOM IWks::ExportToWKT() method. It 5694 exports the SFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M) 5695 WKB types. 5696 5697 This function is the same as the CPP method 5698 OGRGeometry::exportToWkt(wkbVariantIso). 5699 5700 Parameters: 5701 ----------- 5702 5703 hGeom: handle on the geometry to convert to a text format from. 5704 5705 ppszSrcText: a text buffer is allocated by the program, and assigned 5706 to the passed pointer. After use, *ppszDstText should be freed with 5707 CPLFree(). 5708 5709 Currently OGRERR_NONE is always returned. 5710 5711 GDAL 2.0 5712 """ 5713 return _ogr.Geometry_ExportToIsoWkt(self, *args)
5714
5715 - def ExportToWkb(self, *args, **kwargs):
5716 r""" 5717 ExportToWkb(Geometry self, OGRwkbByteOrder byte_order=wkbXDR) -> OGRErr 5718 OGRErr 5719 OGR_G_ExportToWkb(OGRGeometryH hGeom, OGRwkbByteOrder eOrder, unsigned 5720 char *pabyDstBuffer) 5721 5722 Convert a geometry well known binary format. 5723 5724 This function relates to the SFCOM IWks::ExportToWKB() method. 5725 5726 For backward compatibility purposes, it exports the Old-style 99-402 5727 extended dimension (Z) WKB types for types Point, LineString, Polygon, 5728 MultiPoint, MultiLineString, MultiPolygon and GeometryCollection. For 5729 other geometry types, it is equivalent to OGR_G_ExportToIsoWkb(). 5730 5731 This function is the same as the CPP method 5732 OGRGeometry::exportToWkb(OGRwkbByteOrder, unsigned char *, 5733 OGRwkbVariant) with eWkbVariant = wkbVariantOldOgc. 5734 5735 Parameters: 5736 ----------- 5737 5738 hGeom: handle on the geometry to convert to a well know binary data 5739 from. 5740 5741 eOrder: One of wkbXDR or wkbNDR indicating MSB or LSB byte order 5742 respectively. 5743 5744 pabyDstBuffer: a buffer into which the binary representation is 5745 written. This buffer must be at least OGR_G_WkbSize() byte in size. 5746 5747 Currently OGRERR_NONE is always returned. 5748 """ 5749 return _ogr.Geometry_ExportToWkb(self, *args, **kwargs)
5750
5751 - def ExportToIsoWkb(self, *args, **kwargs):
5752 r""" 5753 ExportToIsoWkb(Geometry self, OGRwkbByteOrder byte_order=wkbXDR) -> OGRErr 5754 OGRErr 5755 OGR_G_ExportToIsoWkb(OGRGeometryH hGeom, OGRwkbByteOrder eOrder, 5756 unsigned char *pabyDstBuffer) 5757 5758 Convert a geometry into SFSQL 1.2 / ISO SQL/MM Part 3 well known 5759 binary format. 5760 5761 This function relates to the SFCOM IWks::ExportToWKB() method. It 5762 exports the SFSQL 1.2 and ISO SQL/MM Part 3 extended dimension (Z&M) 5763 WKB types. 5764 5765 This function is the same as the CPP method 5766 OGRGeometry::exportToWkb(OGRwkbByteOrder, unsigned char *, 5767 OGRwkbVariant) with eWkbVariant = wkbVariantIso. 5768 5769 Parameters: 5770 ----------- 5771 5772 hGeom: handle on the geometry to convert to a well know binary data 5773 from. 5774 5775 eOrder: One of wkbXDR or wkbNDR indicating MSB or LSB byte order 5776 respectively. 5777 5778 pabyDstBuffer: a buffer into which the binary representation is 5779 written. This buffer must be at least OGR_G_WkbSize() byte in size. 5780 5781 Currently OGRERR_NONE is always returned. 5782 5783 GDAL 2.0 5784 """ 5785 return _ogr.Geometry_ExportToIsoWkb(self, *args, **kwargs)
5786
5787 - def ExportToGML(self, *args, **kwargs):
5788 r"""ExportToGML(Geometry self, char ** options=None) -> retStringAndCPLFree *""" 5789 return _ogr.Geometry_ExportToGML(self, *args, **kwargs)
5790
5791 - def ExportToKML(self, *args):
5792 r"""ExportToKML(Geometry self, char const * altitude_mode=None) -> retStringAndCPLFree *""" 5793 return _ogr.Geometry_ExportToKML(self, *args)
5794
5795 - def ExportToJson(self, *args, **kwargs):
5796 r"""ExportToJson(Geometry self, char ** options=None) -> retStringAndCPLFree *""" 5797 return _ogr.Geometry_ExportToJson(self, *args, **kwargs)
5798
5799 - def AddPoint(self, *args, **kwargs):
5800 r"""AddPoint(Geometry self, double x, double y, double z=0)""" 5801 return _ogr.Geometry_AddPoint(self, *args, **kwargs)
5802
5803 - def AddPointM(self, *args, **kwargs):
5804 r"""AddPointM(Geometry self, double x, double y, double m)""" 5805 return _ogr.Geometry_AddPointM(self, *args, **kwargs)
5806
5807 - def AddPointZM(self, *args, **kwargs):
5808 r"""AddPointZM(Geometry self, double x, double y, double z, double m)""" 5809 return _ogr.Geometry_AddPointZM(self, *args, **kwargs)
5810
5811 - def AddPoint_2D(self, *args):
5812 r"""AddPoint_2D(Geometry self, double x, double y)""" 5813 return _ogr.Geometry_AddPoint_2D(self, *args)
5814
5815 - def AddGeometryDirectly(self, *args):
5816 r"""AddGeometryDirectly(Geometry self, Geometry other_disown) -> OGRErr""" 5817 return _ogr.Geometry_AddGeometryDirectly(self, *args)
5818
5819 - def AddGeometry(self, *args):
5820 r"""AddGeometry(Geometry self, Geometry other) -> OGRErr""" 5821 return _ogr.Geometry_AddGeometry(self, *args)
5822
5823 - def RemoveGeometry(self, *args):
5824 r"""RemoveGeometry(Geometry self, int iSubGeom) -> OGRErr""" 5825 return _ogr.Geometry_RemoveGeometry(self, *args)
5826
5827 - def Clone(self, *args):
5828 r""" 5829 Clone(Geometry self) -> Geometry 5830 OGRGeometryH OGR_G_Clone(OGRGeometryH 5831 hGeom) 5832 5833 Make a copy of this object. 5834 5835 This function relates to the SFCOM IGeometry::clone() method. 5836 5837 This function is the same as the CPP method OGRGeometry::clone(). 5838 5839 Parameters: 5840 ----------- 5841 5842 hGeom: handle on the geometry to clone from. 5843 5844 a handle on the copy of the geometry with the spatial reference 5845 system as the original. 5846 """ 5847 return _ogr.Geometry_Clone(self, *args)
5848
5849 - def GetGeometryType(self, *args):
5850 r""" 5851 GetGeometryType(Geometry self) -> OGRwkbGeometryType 5852 OGRwkbGeometryType 5853 OGR_G_GetGeometryType(OGRGeometryH hGeom) 5854 5855 Fetch geometry type. 5856 5857 Note that the geometry type may include the 2.5D flag. To get a 2D 5858 flattened version of the geometry type apply the wkbFlatten() macro to 5859 the return result. 5860 5861 This function is the same as the CPP method 5862 OGRGeometry::getGeometryType(). 5863 5864 Parameters: 5865 ----------- 5866 5867 hGeom: handle on the geometry to get type from. 5868 5869 the geometry type code. 5870 """ 5871 return _ogr.Geometry_GetGeometryType(self, *args)
5872
5873 - def GetGeometryName(self, *args):
5874 r""" 5875 GetGeometryName(Geometry self) -> char const * 5876 const char* 5877 OGR_G_GetGeometryName(OGRGeometryH hGeom) 5878 5879 Fetch WKT name for geometry type. 5880 5881 There is no SFCOM analog to this function. 5882 5883 This function is the same as the CPP method 5884 OGRGeometry::getGeometryName(). 5885 5886 Parameters: 5887 ----------- 5888 5889 hGeom: handle on the geometry to get name from. 5890 5891 name used for this geometry type in well known text format. 5892 """ 5893 return _ogr.Geometry_GetGeometryName(self, *args)
5894
5895 - def Length(self, *args):
5896 r"""Length(Geometry self) -> double""" 5897 return _ogr.Geometry_Length(self, *args)
5898
5899 - def Area(self, *args):
5900 r"""Area(Geometry self) -> double""" 5901 return _ogr.Geometry_Area(self, *args)
5902
5903 - def GetArea(self, *args):
5904 r"""GetArea(Geometry self) -> double""" 5905 return _ogr.Geometry_GetArea(self, *args)
5906
5907 - def GetPointCount(self, *args):
5908 r"""GetPointCount(Geometry self) -> int""" 5909 return _ogr.Geometry_GetPointCount(self, *args)
5910
5911 - def GetPoints(self, *args, **kwargs):
5912 r"""GetPoints(Geometry self, int nCoordDimension=0)""" 5913 return _ogr.Geometry_GetPoints(self, *args, **kwargs)
5914
5915 - def GetX(self, *args, **kwargs):
5916 r"""GetX(Geometry self, int point=0) -> double""" 5917 return _ogr.Geometry_GetX(self, *args, **kwargs)
5918
5919 - def GetY(self, *args, **kwargs):
5920 r"""GetY(Geometry self, int point=0) -> double""" 5921 return _ogr.Geometry_GetY(self, *args, **kwargs)
5922
5923 - def GetZ(self, *args, **kwargs):
5924 r"""GetZ(Geometry self, int point=0) -> double""" 5925 return _ogr.Geometry_GetZ(self, *args, **kwargs)
5926
5927 - def GetM(self, *args, **kwargs):
5928 r"""GetM(Geometry self, int point=0) -> double""" 5929 return _ogr.Geometry_GetM(self, *args, **kwargs)
5930
5931 - def GetPoint(self, *args):
5932 r"""GetPoint(Geometry self, int iPoint=0)""" 5933 return _ogr.Geometry_GetPoint(self, *args)
5934
5935 - def GetPointZM(self, *args):
5936 r"""GetPointZM(Geometry self, int iPoint=0)""" 5937 return _ogr.Geometry_GetPointZM(self, *args)
5938
5939 - def GetPoint_2D(self, *args):
5940 r"""GetPoint_2D(Geometry self, int iPoint=0)""" 5941 return _ogr.Geometry_GetPoint_2D(self, *args)
5942
5943 - def GetGeometryCount(self, *args):
5944 r"""GetGeometryCount(Geometry self) -> int""" 5945 return _ogr.Geometry_GetGeometryCount(self, *args)
5946
5947 - def SetPoint(self, *args, **kwargs):
5948 r"""SetPoint(Geometry self, int point, double x, double y, double z=0)""" 5949 return _ogr.Geometry_SetPoint(self, *args, **kwargs)
5950
5951 - def SetPointM(self, *args, **kwargs):
5952 r"""SetPointM(Geometry self, int point, double x, double y, double m)""" 5953 return _ogr.Geometry_SetPointM(self, *args, **kwargs)
5954
5955 - def SetPointZM(self, *args, **kwargs):
5956 r"""SetPointZM(Geometry self, int point, double x, double y, double z, double m)""" 5957 return _ogr.Geometry_SetPointZM(self, *args, **kwargs)
5958
5959 - def SetPoint_2D(self, *args, **kwargs):
5960 r"""SetPoint_2D(Geometry self, int point, double x, double y)""" 5961 return _ogr.Geometry_SetPoint_2D(self, *args, **kwargs)
5962
5963 - def SwapXY(self, *args):
5964 r""" 5965 SwapXY(Geometry self) 5966 void OGR_G_SwapXY(OGRGeometryH hGeom) 5967 5968 Swap x and y coordinates. 5969 5970 Parameters: 5971 ----------- 5972 5973 hGeom: geometry. 5974 5975 OGR 2.3.0 5976 """ 5977 return _ogr.Geometry_SwapXY(self, *args)
5978
5979 - def GetGeometryRef(self, *args):
5980 r"""GetGeometryRef(Geometry self, int geom) -> Geometry""" 5981 return _ogr.Geometry_GetGeometryRef(self, *args)
5982
5983 - def Simplify(self, *args):
5984 r""" 5985 Simplify(Geometry self, double tolerance) -> Geometry 5986 OGRGeometryH 5987 OGR_G_Simplify(OGRGeometryH hThis, double dTolerance) 5988 5989 Compute a simplified geometry. 5990 5991 This function is the same as the C++ method OGRGeometry::Simplify(). 5992 5993 This function is built on the GEOS library, check it for the 5994 definition of the geometry operation. If OGR is built without the GEOS 5995 library, this function will always fail, issuing a CPLE_NotSupported 5996 error. 5997 5998 Parameters: 5999 ----------- 6000 6001 hThis: the geometry. 6002 6003 dTolerance: the distance tolerance for the simplification. 6004 6005 the simplified geometry or NULL if an error occurs. 6006 6007 OGR 1.8.0 6008 """ 6009 return _ogr.Geometry_Simplify(self, *args)
6010
6011 - def SimplifyPreserveTopology(self, *args):
6012 r""" 6013 SimplifyPreserveTopology(Geometry self, double tolerance) -> Geometry 6014 OGRGeometryH 6015 OGR_G_SimplifyPreserveTopology(OGRGeometryH hThis, double dTolerance) 6016 6017 Simplify the geometry while preserving topology. 6018 6019 This function is the same as the C++ method 6020 OGRGeometry::SimplifyPreserveTopology(). 6021 6022 This function is built on the GEOS library, check it for the 6023 definition of the geometry operation. If OGR is built without the GEOS 6024 library, this function will always fail, issuing a CPLE_NotSupported 6025 error. 6026 6027 Parameters: 6028 ----------- 6029 6030 hThis: the geometry. 6031 6032 dTolerance: the distance tolerance for the simplification. 6033 6034 the simplified geometry or NULL if an error occurs. 6035 6036 OGR 1.9.0 6037 """ 6038 return _ogr.Geometry_SimplifyPreserveTopology(self, *args)
6039
6040 - def DelaunayTriangulation(self, *args, **kwargs):
6041 r""" 6042 DelaunayTriangulation(Geometry self, double dfTolerance=0.0, int bOnlyEdges=FALSE) -> Geometry 6043 OGRGeometryH 6044 OGR_G_DelaunayTriangulation(OGRGeometryH hThis, double dfTolerance, 6045 int bOnlyEdges) 6046 6047 Return a Delaunay triangulation of the vertices of the geometry. 6048 6049 This function is the same as the C++ method 6050 OGRGeometry::DelaunayTriangulation(). 6051 6052 This function is built on the GEOS library, v3.4 or above. If OGR is 6053 built without the GEOS library, this function will always fail, 6054 issuing a CPLE_NotSupported error. 6055 6056 Parameters: 6057 ----------- 6058 6059 hThis: the geometry. 6060 6061 dfTolerance: optional snapping tolerance to use for improved 6062 robustness 6063 6064 bOnlyEdges: if TRUE, will return a MULTILINESTRING, otherwise it will 6065 return a GEOMETRYCOLLECTION containing triangular POLYGONs. 6066 6067 the geometry resulting from the Delaunay triangulation or NULL if an 6068 error occurs. 6069 6070 OGR 2.1 6071 """ 6072 return _ogr.Geometry_DelaunayTriangulation(self, *args, **kwargs)
6073
6074 - def Polygonize(self, *args):
6075 r""" 6076 Polygonize(Geometry self) -> Geometry 6077 OGRGeometryH 6078 OGR_G_Polygonize(OGRGeometryH hTarget) 6079 6080 Polygonizes a set of sparse edges. 6081 6082 A new geometry object is created and returned containing a collection 6083 of reassembled Polygons: NULL will be returned if the input collection 6084 doesn't corresponds to a MultiLinestring, or when reassembling Edges 6085 into Polygons is impossible due to topological inconsistencies. 6086 6087 This function is the same as the C++ method OGRGeometry::Polygonize(). 6088 6089 This function is built on the GEOS library, check it for the 6090 definition of the geometry operation. If OGR is built without the GEOS 6091 library, this function will always fail, issuing a CPLE_NotSupported 6092 error. 6093 6094 Parameters: 6095 ----------- 6096 6097 hTarget: The Geometry to be polygonized. 6098 6099 a handle to a newly allocated geometry now owned by the caller, or 6100 NULL on failure. 6101 6102 OGR 1.9.0 6103 """ 6104 return _ogr.Geometry_Polygonize(self, *args)
6105
6106 - def Boundary(self, *args):
6107 r""" 6108 Boundary(Geometry self) -> Geometry 6109 OGRGeometryH 6110 OGR_G_Boundary(OGRGeometryH hTarget) 6111 6112 Compute boundary. 6113 6114 A new geometry object is created and returned containing the boundary 6115 of the geometry on which the method is invoked. 6116 6117 This function is the same as the C++ method OGR_G_Boundary(). 6118 6119 This function is built on the GEOS library, check it for the 6120 definition of the geometry operation. If OGR is built without the GEOS 6121 library, this function will always fail, issuing a CPLE_NotSupported 6122 error. 6123 6124 Parameters: 6125 ----------- 6126 6127 hTarget: The Geometry to calculate the boundary of. 6128 6129 a handle to a newly allocated geometry now owned by the caller, or 6130 NULL on failure. 6131 6132 OGR 1.8.0 6133 """ 6134 return _ogr.Geometry_Boundary(self, *args)
6135
6136 - def GetBoundary(self, *args):
6137 r""" 6138 GetBoundary(Geometry self) -> Geometry 6139 OGRGeometryH 6140 OGR_G_GetBoundary(OGRGeometryH hTarget) 6141 6142 Compute boundary (deprecated) 6143 6144 Deprecated 6145 6146 See: OGR_G_Boundary() 6147 """ 6148 return _ogr.Geometry_GetBoundary(self, *args)
6149
6150 - def ConvexHull(self, *args):
6151 r""" 6152 ConvexHull(Geometry self) -> Geometry 6153 OGRGeometryH 6154 OGR_G_ConvexHull(OGRGeometryH hTarget) 6155 6156 Compute convex hull. 6157 6158 A new geometry object is created and returned containing the convex 6159 hull of the geometry on which the method is invoked. 6160 6161 This function is the same as the C++ method OGRGeometry::ConvexHull(). 6162 6163 This function is built on the GEOS library, check it for the 6164 definition of the geometry operation. If OGR is built without the GEOS 6165 library, this function will always fail, issuing a CPLE_NotSupported 6166 error. 6167 6168 Parameters: 6169 ----------- 6170 6171 hTarget: The Geometry to calculate the convex hull of. 6172 6173 a handle to a newly allocated geometry now owned by the caller, or 6174 NULL on failure. 6175 """ 6176 return _ogr.Geometry_ConvexHull(self, *args)
6177
6178 - def MakeValid(self, *args):
6179 r""" 6180 MakeValid(Geometry self) -> Geometry 6181 OGRGeometryH 6182 OGR_G_MakeValid(OGRGeometryH hGeom) 6183 6184 Attempts to make an invalid geometry valid without losing vertices. 6185 6186 Already-valid geometries are cloned without further intervention. 6187 6188 This function is the same as the C++ method OGRGeometry::MakeValid(). 6189 6190 This function is built on the GEOS >= 3.8 library, check it for the 6191 definition of the geometry operation. If OGR is built without the GEOS 6192 >= 3.8 library, this function will return a clone of the input 6193 geometry if it is valid, or NULL if it is invalid 6194 6195 Parameters: 6196 ----------- 6197 6198 hGeom: The Geometry to make valid. 6199 6200 a newly allocated geometry now owned by the caller, or NULL on 6201 failure. 6202 6203 GDAL 3.0 6204 """ 6205 return _ogr.Geometry_MakeValid(self, *args)
6206
6207 - def Normalize(self, *args):
6208 r"""Normalize(Geometry self) -> Geometry""" 6209 return _ogr.Geometry_Normalize(self, *args)
6210
6211 - def RemoveLowerDimensionSubGeoms(self, *args):
6212 r"""RemoveLowerDimensionSubGeoms(Geometry self) -> Geometry""" 6213 return _ogr.Geometry_RemoveLowerDimensionSubGeoms(self, *args)
6214
6215 - def Buffer(self, *args, **kwargs):
6216 r""" 6217 Buffer(Geometry self, double distance, int quadsecs=30) -> Geometry 6218 OGRGeometryH OGR_G_Buffer(OGRGeometryH 6219 hTarget, double dfDist, int nQuadSegs) 6220 6221 Compute buffer of geometry. 6222 6223 Builds a new geometry containing the buffer region around the geometry 6224 on which it is invoked. The buffer is a polygon containing the region 6225 within the buffer distance of the original geometry. 6226 6227 Some buffer sections are properly described as curves, but are 6228 converted to approximate polygons. The nQuadSegs parameter can be used 6229 to control how many segments should be used to define a 90 degree 6230 curve - a quadrant of a circle. A value of 30 is a reasonable default. 6231 Large values result in large numbers of vertices in the resulting 6232 buffer geometry while small numbers reduce the accuracy of the result. 6233 6234 This function is the same as the C++ method OGRGeometry::Buffer(). 6235 6236 This function is built on the GEOS library, check it for the 6237 definition of the geometry operation. If OGR is built without the GEOS 6238 library, this function will always fail, issuing a CPLE_NotSupported 6239 error. 6240 6241 Parameters: 6242 ----------- 6243 6244 hTarget: the geometry. 6245 6246 dfDist: the buffer distance to be applied. Should be expressed into 6247 the same unit as the coordinates of the geometry. 6248 6249 nQuadSegs: the number of segments used to approximate a 90 degree 6250 (quadrant) of curvature. 6251 6252 the newly created geometry, or NULL if an error occurs. 6253 """ 6254 return _ogr.Geometry_Buffer(self, *args, **kwargs)
6255
6256 - def Intersection(self, *args):
6257 r""" 6258 Intersection(Geometry self, Geometry other) -> Geometry 6259 OGRGeometryH 6260 OGR_G_Intersection(OGRGeometryH hThis, OGRGeometryH hOther) 6261 6262 Compute intersection. 6263 6264 Generates a new geometry which is the region of intersection of the 6265 two geometries operated on. The OGR_G_Intersects() function can be 6266 used to test if two geometries intersect. 6267 6268 Geometry validity is not checked. In case you are unsure of the 6269 validity of the input geometries, call IsValid() before, otherwise the 6270 result might be wrong. 6271 6272 This function is the same as the C++ method 6273 OGRGeometry::Intersection(). 6274 6275 This function is built on the GEOS library, check it for the 6276 definition of the geometry operation. If OGR is built without the GEOS 6277 library, this function will always fail, issuing a CPLE_NotSupported 6278 error. 6279 6280 Parameters: 6281 ----------- 6282 6283 hThis: the geometry. 6284 6285 hOther: the other geometry. 6286 6287 a new geometry representing the intersection or NULL if there is no 6288 intersection or an error occurs. 6289 """ 6290 return _ogr.Geometry_Intersection(self, *args)
6291
6292 - def Union(self, *args):
6293 r""" 6294 Union(Geometry self, Geometry other) -> Geometry 6295 OGRGeometryH OGR_G_Union(OGRGeometryH 6296 hThis, OGRGeometryH hOther) 6297 6298 Compute union. 6299 6300 Generates a new geometry which is the region of union of the two 6301 geometries operated on. 6302 6303 Geometry validity is not checked. In case you are unsure of the 6304 validity of the input geometries, call IsValid() before, otherwise the 6305 result might be wrong. 6306 6307 This function is the same as the C++ method OGRGeometry::Union(). 6308 6309 This function is built on the GEOS library, check it for the 6310 definition of the geometry operation. If OGR is built without the GEOS 6311 library, this function will always fail, issuing a CPLE_NotSupported 6312 error. 6313 6314 Parameters: 6315 ----------- 6316 6317 hThis: the geometry. 6318 6319 hOther: the other geometry. 6320 6321 a new geometry representing the union or NULL if an error occurs. 6322 """ 6323 return _ogr.Geometry_Union(self, *args)
6324
6325 - def UnionCascaded(self, *args):
6326 r""" 6327 UnionCascaded(Geometry self) -> Geometry 6328 OGRGeometryH 6329 OGR_G_UnionCascaded(OGRGeometryH hThis) 6330 6331 Compute union using cascading. 6332 6333 Geometry validity is not checked. In case you are unsure of the 6334 validity of the input geometries, call IsValid() before, otherwise the 6335 result might be wrong. 6336 6337 This function is the same as the C++ method 6338 OGRGeometry::UnionCascaded(). 6339 6340 This function is built on the GEOS library, check it for the 6341 definition of the geometry operation. If OGR is built without the GEOS 6342 library, this function will always fail, issuing a CPLE_NotSupported 6343 error. 6344 6345 Parameters: 6346 ----------- 6347 6348 hThis: the geometry. 6349 6350 a new geometry representing the union or NULL if an error occurs. 6351 """ 6352 return _ogr.Geometry_UnionCascaded(self, *args)
6353
6354 - def Difference(self, *args):
6355 r""" 6356 Difference(Geometry self, Geometry other) -> Geometry 6357 OGRGeometryH 6358 OGR_G_Difference(OGRGeometryH hThis, OGRGeometryH hOther) 6359 6360 Compute difference. 6361 6362 Generates a new geometry which is the region of this geometry with the 6363 region of the other geometry removed. 6364 6365 Geometry validity is not checked. In case you are unsure of the 6366 validity of the input geometries, call IsValid() before, otherwise the 6367 result might be wrong. 6368 6369 This function is the same as the C++ method OGRGeometry::Difference(). 6370 6371 This function is built on the GEOS library, check it for the 6372 definition of the geometry operation. If OGR is built without the GEOS 6373 library, this function will always fail, issuing a CPLE_NotSupported 6374 error. 6375 6376 Parameters: 6377 ----------- 6378 6379 hThis: the geometry. 6380 6381 hOther: the other geometry. 6382 6383 a new geometry representing the difference or NULL if the difference 6384 is empty or an error occurs. 6385 """ 6386 return _ogr.Geometry_Difference(self, *args)
6387
6388 - def SymDifference(self, *args):
6389 r""" 6390 SymDifference(Geometry self, Geometry other) -> Geometry 6391 OGRGeometryH 6392 OGR_G_SymDifference(OGRGeometryH hThis, OGRGeometryH hOther) 6393 6394 Compute symmetric difference. 6395 6396 Generates a new geometry which is the symmetric difference of this 6397 geometry and the other geometry. 6398 6399 Geometry validity is not checked. In case you are unsure of the 6400 validity of the input geometries, call IsValid() before, otherwise the 6401 result might be wrong. 6402 6403 This function is the same as the C++ method 6404 OGRGeometry::SymmetricDifference(). 6405 6406 This function is built on the GEOS library, check it for the 6407 definition of the geometry operation. If OGR is built without the GEOS 6408 library, this function will always fail, issuing a CPLE_NotSupported 6409 error. 6410 6411 Parameters: 6412 ----------- 6413 6414 hThis: the geometry. 6415 6416 hOther: the other geometry. 6417 6418 a new geometry representing the symmetric difference or NULL if the 6419 difference is empty or an error occurs. 6420 6421 OGR 1.8.0 6422 """ 6423 return _ogr.Geometry_SymDifference(self, *args)
6424
6425 - def SymmetricDifference(self, *args):
6426 r""" 6427 SymmetricDifference(Geometry self, Geometry other) -> Geometry 6428 OGRGeometryH 6429 OGR_G_SymmetricDifference(OGRGeometryH hThis, OGRGeometryH hOther) 6430 6431 Compute symmetric difference (deprecated) 6432 6433 Deprecated 6434 6435 See: OGR_G_SymmetricDifference() 6436 """ 6437 return _ogr.Geometry_SymmetricDifference(self, *args)
6438
6439 - def Distance(self, *args):
6440 r""" 6441 Distance(Geometry self, Geometry other) -> double 6442 double OGR_G_Distance(OGRGeometryH 6443 hFirst, OGRGeometryH hOther) 6444 6445 Compute distance between two geometries. 6446 6447 Returns the shortest distance between the two geometries. The distance 6448 is expressed into the same unit as the coordinates of the geometries. 6449 6450 This function is the same as the C++ method OGRGeometry::Distance(). 6451 6452 This function is built on the GEOS library, check it for the 6453 definition of the geometry operation. If OGR is built without the GEOS 6454 library, this function will always fail, issuing a CPLE_NotSupported 6455 error. 6456 6457 Parameters: 6458 ----------- 6459 6460 hFirst: the first geometry to compare against. 6461 6462 hOther: the other geometry to compare against. 6463 6464 the distance between the geometries or -1 if an error occurs. 6465 """ 6466 return _ogr.Geometry_Distance(self, *args)
6467
6468 - def Distance3D(self, *args):
6469 r""" 6470 Distance3D(Geometry self, Geometry other) -> double 6471 double 6472 OGR_G_Distance3D(OGRGeometryH hFirst, OGRGeometryH hOther) 6473 6474 Returns the 3D distance between two geometries. 6475 6476 The distance is expressed into the same unit as the coordinates of the 6477 geometries. 6478 6479 This method is built on the SFCGAL library, check it for the 6480 definition of the geometry operation. If OGR is built without the 6481 SFCGAL library, this method will always return -1.0 6482 6483 This function is the same as the C++ method OGRGeometry::Distance3D(). 6484 6485 Parameters: 6486 ----------- 6487 6488 hFirst: the first geometry to compare against. 6489 6490 hOther: the other geometry to compare against. 6491 6492 distance between the two geometries 6493 6494 GDAL 2.2 6495 6496 the distance between the geometries or -1 if an error occurs. 6497 """ 6498 return _ogr.Geometry_Distance3D(self, *args)
6499
6500 - def Empty(self, *args):
6501 r""" 6502 Empty(Geometry self) 6503 void OGR_G_Empty(OGRGeometryH hGeom) 6504 6505 Clear geometry information. 6506 6507 This restores the geometry to its initial state after construction, 6508 and before assignment of actual geometry. 6509 6510 This function relates to the SFCOM IGeometry::Empty() method. 6511 6512 This function is the same as the CPP method OGRGeometry::empty(). 6513 6514 Parameters: 6515 ----------- 6516 6517 hGeom: handle on the geometry to empty. 6518 """ 6519 return _ogr.Geometry_Empty(self, *args)
6520
6521 - def IsEmpty(self, *args):
6522 r""" 6523 IsEmpty(Geometry self) -> bool 6524 int OGR_G_IsEmpty(OGRGeometryH hGeom) 6525 6526 Test if the geometry is empty. 6527 6528 This method is the same as the CPP method OGRGeometry::IsEmpty(). 6529 6530 Parameters: 6531 ----------- 6532 6533 hGeom: The Geometry to test. 6534 6535 TRUE if the geometry has no points, otherwise FALSE. 6536 """ 6537 return _ogr.Geometry_IsEmpty(self, *args)
6538
6539 - def IsValid(self, *args):
6540 r""" 6541 IsValid(Geometry self) -> bool 6542 int OGR_G_IsValid(OGRGeometryH hGeom) 6543 6544 Test if the geometry is valid. 6545 6546 This function is the same as the C++ method OGRGeometry::IsValid(). 6547 6548 This function is built on the GEOS library, check it for the 6549 definition of the geometry operation. If OGR is built without the GEOS 6550 library, this function will always return FALSE. 6551 6552 Parameters: 6553 ----------- 6554 6555 hGeom: The Geometry to test. 6556 6557 TRUE if the geometry has no points, otherwise FALSE. 6558 """ 6559 return _ogr.Geometry_IsValid(self, *args)
6560
6561 - def IsSimple(self, *args):
6562 r""" 6563 IsSimple(Geometry self) -> bool 6564 int OGR_G_IsSimple(OGRGeometryH 6565 hGeom) 6566 6567 Returns TRUE if the geometry is simple. 6568 6569 Returns TRUE if the geometry has no anomalous geometric points, such 6570 as self intersection or self tangency. The description of each 6571 instantiable geometric class will include the specific conditions that 6572 cause an instance of that class to be classified as not simple. 6573 6574 This function is the same as the C++ method OGRGeometry::IsSimple() 6575 method. 6576 6577 If OGR is built without the GEOS library, this function will always 6578 return FALSE. 6579 6580 Parameters: 6581 ----------- 6582 6583 hGeom: The Geometry to test. 6584 6585 TRUE if object is simple, otherwise FALSE. 6586 """ 6587 return _ogr.Geometry_IsSimple(self, *args)
6588
6589 - def IsRing(self, *args):
6590 r""" 6591 IsRing(Geometry self) -> bool 6592 int OGR_G_IsRing(OGRGeometryH hGeom) 6593 6594 Test if the geometry is a ring. 6595 6596 This function is the same as the C++ method OGRGeometry::IsRing(). 6597 6598 This function is built on the GEOS library, check it for the 6599 definition of the geometry operation. If OGR is built without the GEOS 6600 library, this function will always return FALSE. 6601 6602 Parameters: 6603 ----------- 6604 6605 hGeom: The Geometry to test. 6606 6607 TRUE if the geometry has no points, otherwise FALSE. 6608 """ 6609 return _ogr.Geometry_IsRing(self, *args)
6610
6611 - def Intersects(self, *args):
6612 r""" 6613 Intersects(Geometry self, Geometry other) -> bool 6614 int OGR_G_Intersects(OGRGeometryH 6615 hGeom, OGRGeometryH hOtherGeom) 6616 6617 Do these features intersect? 6618 6619 Determines whether two geometries intersect. If GEOS is enabled, then 6620 this is done in rigorous fashion otherwise TRUE is returned if the 6621 envelopes (bounding boxes) of the two geometries overlap. 6622 6623 This function is the same as the CPP method OGRGeometry::Intersects. 6624 6625 Parameters: 6626 ----------- 6627 6628 hGeom: handle on the first geometry. 6629 6630 hOtherGeom: handle on the other geometry to test against. 6631 6632 TRUE if the geometries intersect, otherwise FALSE. 6633 """ 6634 return _ogr.Geometry_Intersects(self, *args)
6635
6636 - def Intersect(self, *args):
6637 r"""Intersect(Geometry self, Geometry other) -> bool""" 6638 return _ogr.Geometry_Intersect(self, *args)
6639
6640 - def Equals(self, *args):
6641 r""" 6642 Equals(Geometry self, Geometry other) -> bool 6643 int OGR_G_Equals(OGRGeometryH hGeom, 6644 OGRGeometryH hOther) 6645 6646 Returns TRUE if two geometries are equivalent. 6647 6648 This operation implements the SQL/MM ST_OrderingEquals() operation. 6649 6650 The comparison is done in a structural way, that is to say that the 6651 geometry types must be identical, as well as the number and ordering 6652 of sub-geometries and vertices. Or equivalently, two geometries are 6653 considered equal by this method if their WKT/WKB representation is 6654 equal. Note: this must be distinguished for equality in a spatial way 6655 (which is the purpose of the ST_Equals() operation). 6656 6657 This function is the same as the CPP method OGRGeometry::Equals() 6658 method. 6659 6660 Parameters: 6661 ----------- 6662 6663 hGeom: handle on the first geometry. 6664 6665 hOther: handle on the other geometry to test against. 6666 6667 TRUE if equivalent or FALSE otherwise. 6668 """ 6669 return _ogr.Geometry_Equals(self, *args)
6670
6671 - def Equal(self, *args):
6672 r"""Equal(Geometry self, Geometry other) -> bool""" 6673 return _ogr.Geometry_Equal(self, *args)
6674
6675 - def Disjoint(self, *args):
6676 r""" 6677 Disjoint(Geometry self, Geometry other) -> bool 6678 int OGR_G_Disjoint(OGRGeometryH 6679 hThis, OGRGeometryH hOther) 6680 6681 Test for disjointness. 6682 6683 Tests if this geometry and the other geometry are disjoint. 6684 6685 Geometry validity is not checked. In case you are unsure of the 6686 validity of the input geometries, call IsValid() before, otherwise the 6687 result might be wrong. 6688 6689 This function is the same as the C++ method OGRGeometry::Disjoint(). 6690 6691 This function is built on the GEOS library, check it for the 6692 definition of the geometry operation. If OGR is built without the GEOS 6693 library, this function will always fail, issuing a CPLE_NotSupported 6694 error. 6695 6696 Parameters: 6697 ----------- 6698 6699 hThis: the geometry to compare. 6700 6701 hOther: the other geometry to compare. 6702 6703 TRUE if they are disjoint, otherwise FALSE. 6704 """ 6705 return _ogr.Geometry_Disjoint(self, *args)
6706
6707 - def Touches(self, *args):
6708 r""" 6709 Touches(Geometry self, Geometry other) -> bool 6710 int OGR_G_Touches(OGRGeometryH hThis, 6711 OGRGeometryH hOther) 6712 6713 Test for touching. 6714 6715 Tests if this geometry and the other geometry are touching. 6716 6717 Geometry validity is not checked. In case you are unsure of the 6718 validity of the input geometries, call IsValid() before, otherwise the 6719 result might be wrong. 6720 6721 This function is the same as the C++ method OGRGeometry::Touches(). 6722 6723 This function is built on the GEOS library, check it for the 6724 definition of the geometry operation. If OGR is built without the GEOS 6725 library, this function will always fail, issuing a CPLE_NotSupported 6726 error. 6727 6728 Parameters: 6729 ----------- 6730 6731 hThis: the geometry to compare. 6732 6733 hOther: the other geometry to compare. 6734 6735 TRUE if they are touching, otherwise FALSE. 6736 """ 6737 return _ogr.Geometry_Touches(self, *args)
6738
6739 - def Crosses(self, *args):
6740 r""" 6741 Crosses(Geometry self, Geometry other) -> bool 6742 int OGR_G_Crosses(OGRGeometryH hThis, 6743 OGRGeometryH hOther) 6744 6745 Test for crossing. 6746 6747 Tests if this geometry and the other geometry are crossing. 6748 6749 Geometry validity is not checked. In case you are unsure of the 6750 validity of the input geometries, call IsValid() before, otherwise the 6751 result might be wrong. 6752 6753 This function is the same as the C++ method OGRGeometry::Crosses(). 6754 6755 This function is built on the GEOS library, check it for the 6756 definition of the geometry operation. If OGR is built without the GEOS 6757 library, this function will always fail, issuing a CPLE_NotSupported 6758 error. 6759 6760 Parameters: 6761 ----------- 6762 6763 hThis: the geometry to compare. 6764 6765 hOther: the other geometry to compare. 6766 6767 TRUE if they are crossing, otherwise FALSE. 6768 """ 6769 return _ogr.Geometry_Crosses(self, *args)
6770
6771 - def Within(self, *args):
6772 r""" 6773 Within(Geometry self, Geometry other) -> bool 6774 int OGR_G_Within(OGRGeometryH hThis, 6775 OGRGeometryH hOther) 6776 6777 Test for containment. 6778 6779 Tests if this geometry is within the other geometry. 6780 6781 Geometry validity is not checked. In case you are unsure of the 6782 validity of the input geometries, call IsValid() before, otherwise the 6783 result might be wrong. 6784 6785 This function is the same as the C++ method OGRGeometry::Within(). 6786 6787 This function is built on the GEOS library, check it for the 6788 definition of the geometry operation. If OGR is built without the GEOS 6789 library, this function will always fail, issuing a CPLE_NotSupported 6790 error. 6791 6792 Parameters: 6793 ----------- 6794 6795 hThis: the geometry to compare. 6796 6797 hOther: the other geometry to compare. 6798 6799 TRUE if hThis is within hOther, otherwise FALSE. 6800 """ 6801 return _ogr.Geometry_Within(self, *args)
6802
6803 - def Contains(self, *args):
6804 r""" 6805 Contains(Geometry self, Geometry other) -> bool 6806 int OGR_G_Contains(OGRGeometryH 6807 hThis, OGRGeometryH hOther) 6808 6809 Test for containment. 6810 6811 Tests if this geometry contains the other geometry. 6812 6813 Geometry validity is not checked. In case you are unsure of the 6814 validity of the input geometries, call IsValid() before, otherwise the 6815 result might be wrong. 6816 6817 This function is the same as the C++ method OGRGeometry::Contains(). 6818 6819 This function is built on the GEOS library, check it for the 6820 definition of the geometry operation. If OGR is built without the GEOS 6821 library, this function will always fail, issuing a CPLE_NotSupported 6822 error. 6823 6824 Parameters: 6825 ----------- 6826 6827 hThis: the geometry to compare. 6828 6829 hOther: the other geometry to compare. 6830 6831 TRUE if hThis contains hOther geometry, otherwise FALSE. 6832 """ 6833 return _ogr.Geometry_Contains(self, *args)
6834
6835 - def Overlaps(self, *args):
6836 r""" 6837 Overlaps(Geometry self, Geometry other) -> bool 6838 int OGR_G_Overlaps(OGRGeometryH 6839 hThis, OGRGeometryH hOther) 6840 6841 Test for overlap. 6842 6843 Tests if this geometry and the other geometry overlap, that is their 6844 intersection has a non-zero area. 6845 6846 Geometry validity is not checked. In case you are unsure of the 6847 validity of the input geometries, call IsValid() before, otherwise the 6848 result might be wrong. 6849 6850 This function is the same as the C++ method OGRGeometry::Overlaps(). 6851 6852 This function is built on the GEOS library, check it for the 6853 definition of the geometry operation. If OGR is built without the GEOS 6854 library, this function will always fail, issuing a CPLE_NotSupported 6855 error. 6856 6857 Parameters: 6858 ----------- 6859 6860 hThis: the geometry to compare. 6861 6862 hOther: the other geometry to compare. 6863 6864 TRUE if they are overlapping, otherwise FALSE. 6865 """ 6866 return _ogr.Geometry_Overlaps(self, *args)
6867
6868 - def TransformTo(self, *args):
6869 r""" 6870 TransformTo(Geometry self, SpatialReference reference) -> OGRErr 6871 OGRErr 6872 OGR_G_TransformTo(OGRGeometryH hGeom, OGRSpatialReferenceH hSRS) 6873 6874 Transform geometry to new spatial reference system. 6875 6876 This function will transform the coordinates of a geometry from their 6877 current spatial reference system to a new target spatial reference 6878 system. Normally this means reprojecting the vectors, but it could 6879 include datum shifts, and changes of units. 6880 6881 This function will only work if the geometry already has an assigned 6882 spatial reference system, and if it is transformable to the target 6883 coordinate system. 6884 6885 Because this function requires internal creation and initialization of 6886 an OGRCoordinateTransformation object it is significantly more 6887 expensive to use this function to transform many geometries than it is 6888 to create the OGRCoordinateTransformation in advance, and call 6889 transform() with that transformation. This function exists primarily 6890 for convenience when only transforming a single geometry. 6891 6892 This function is the same as the CPP method OGRGeometry::transformTo. 6893 6894 Parameters: 6895 ----------- 6896 6897 hGeom: handle on the geometry to apply the transform to. 6898 6899 hSRS: handle on the spatial reference system to apply. 6900 6901 OGRERR_NONE on success, or an error code. 6902 """ 6903 return _ogr.Geometry_TransformTo(self, *args)
6904
6905 - def GetSpatialReference(self, *args):
6906 r""" 6907 GetSpatialReference(Geometry self) -> SpatialReference 6908 OGRSpatialReferenceH 6909 OGR_G_GetSpatialReference(OGRGeometryH hGeom) 6910 6911 Returns spatial reference system for geometry. 6912 6913 This function relates to the SFCOM IGeometry::get_SpatialReference() 6914 method. 6915 6916 This function is the same as the CPP method 6917 OGRGeometry::getSpatialReference(). 6918 6919 Parameters: 6920 ----------- 6921 6922 hGeom: handle on the geometry to get spatial reference from. 6923 6924 a reference to the spatial reference geometry. 6925 """ 6926 return _ogr.Geometry_GetSpatialReference(self, *args)
6927
6928 - def AssignSpatialReference(self, *args):
6929 r""" 6930 AssignSpatialReference(Geometry self, SpatialReference reference) 6931 void 6932 OGR_G_AssignSpatialReference(OGRGeometryH hGeom, OGRSpatialReferenceH 6933 hSRS) 6934 6935 Assign spatial reference to this object. 6936 6937 Any existing spatial reference is replaced, but under no circumstances 6938 does this result in the object being reprojected. It is just changing 6939 the interpretation of the existing geometry. Note that assigning a 6940 spatial reference increments the reference count on the 6941 OGRSpatialReference, but does not copy it. 6942 6943 Starting with GDAL 2.3, this will also assign the spatial reference to 6944 potential sub-geometries of the geometry ( OGRGeometryCollection, 6945 OGRCurvePolygon/OGRPolygon, OGRCompoundCurve, OGRPolyhedralSurface and 6946 their derived classes). 6947 6948 This is similar to the SFCOM IGeometry::put_SpatialReference() method. 6949 6950 This function is the same as the CPP method 6951 OGRGeometry::assignSpatialReference. 6952 6953 Parameters: 6954 ----------- 6955 6956 hGeom: handle on the geometry to apply the new spatial reference 6957 system. 6958 6959 hSRS: handle on the new spatial reference system to apply. 6960 """ 6961 return _ogr.Geometry_AssignSpatialReference(self, *args)
6962
6963 - def CloseRings(self, *args):
6964 r""" 6965 CloseRings(Geometry self) 6966 void OGR_G_CloseRings(OGRGeometryH 6967 hGeom) 6968 6969 Force rings to be closed. 6970 6971 If this geometry, or any contained geometries has polygon rings that 6972 are not closed, they will be closed by adding the starting point at 6973 the end. 6974 6975 Parameters: 6976 ----------- 6977 6978 hGeom: handle to the geometry. 6979 """ 6980 return _ogr.Geometry_CloseRings(self, *args)
6981
6982 - def FlattenTo2D(self, *args):
6983 r""" 6984 FlattenTo2D(Geometry self) 6985 void 6986 OGR_G_FlattenTo2D(OGRGeometryH hGeom) 6987 6988 Convert geometry to strictly 2D. 6989 6990 In a sense this converts all Z coordinates to 0.0. 6991 6992 This function is the same as the CPP method 6993 OGRGeometry::flattenTo2D(). 6994 6995 Parameters: 6996 ----------- 6997 6998 hGeom: handle on the geometry to convert. 6999 """ 7000 return _ogr.Geometry_FlattenTo2D(self, *args)
7001
7002 - def Segmentize(self, *args):
7003 r""" 7004 Segmentize(Geometry self, double dfMaxLength) 7005 void OGR_G_Segmentize(OGRGeometryH 7006 hGeom, double dfMaxLength) 7007 7008 Modify the geometry such it has no segment longer then the given 7009 distance. 7010 7011 Interpolated points will have Z and M values (if needed) set to 0. 7012 Distance computation is performed in 2d only. 7013 7014 This function is the same as the CPP method OGRGeometry::segmentize(). 7015 7016 Parameters: 7017 ----------- 7018 7019 hGeom: handle on the geometry to segmentize 7020 7021 dfMaxLength: the maximum distance between 2 points after 7022 segmentization 7023 """ 7024 return _ogr.Geometry_Segmentize(self, *args)
7025
7026 - def GetEnvelope(self, *args):
7027 r""" 7028 GetEnvelope(Geometry self) 7029 void 7030 OGR_G_GetEnvelope(OGRGeometryH hGeom, OGREnvelope *psEnvelope) 7031 7032 Computes and returns the bounding envelope for this geometry in the 7033 passed psEnvelope structure. 7034 7035 This function is the same as the CPP method 7036 OGRGeometry::getEnvelope(). 7037 7038 Parameters: 7039 ----------- 7040 7041 hGeom: handle of the geometry to get envelope from. 7042 7043 psEnvelope: the structure in which to place the results. 7044 """ 7045 return _ogr.Geometry_GetEnvelope(self, *args)
7046
7047 - def GetEnvelope3D(self, *args):
7048 r""" 7049 GetEnvelope3D(Geometry self) 7050 void 7051 OGR_G_GetEnvelope3D(OGRGeometryH hGeom, OGREnvelope3D *psEnvelope) 7052 7053 Computes and returns the bounding envelope (3D) for this geometry in 7054 the passed psEnvelope structure. 7055 7056 This function is the same as the CPP method 7057 OGRGeometry::getEnvelope(). 7058 7059 Parameters: 7060 ----------- 7061 7062 hGeom: handle of the geometry to get envelope from. 7063 7064 psEnvelope: the structure in which to place the results. 7065 7066 OGR 1.9.0 7067 """ 7068 return _ogr.Geometry_GetEnvelope3D(self, *args)
7069
7070 - def Centroid(self, *args):
7071 r""" 7072 Centroid(Geometry self) -> Geometry 7073 int OGR_G_Centroid(OGRGeometryH 7074 hGeom, OGRGeometryH hCentroidPoint) 7075 7076 Compute the geometry centroid. 7077 7078 The centroid location is applied to the passed in OGRPoint object. The 7079 centroid is not necessarily within the geometry. 7080 7081 This method relates to the SFCOM ISurface::get_Centroid() method 7082 however the current implementation based on GEOS can operate on other 7083 geometry types such as multipoint, linestring, geometrycollection such 7084 as multipolygons. OGC SF SQL 1.1 defines the operation for surfaces 7085 (polygons). SQL/MM-Part 3 defines the operation for surfaces and 7086 multisurfaces (multipolygons). 7087 7088 This function is the same as the C++ method OGRGeometry::Centroid(). 7089 7090 This function is built on the GEOS library, check it for the 7091 definition of the geometry operation. If OGR is built without the GEOS 7092 library, this function will always fail, issuing a CPLE_NotSupported 7093 error. 7094 7095 OGRERR_NONE on success or OGRERR_FAILURE on error. 7096 """ 7097 return _ogr.Geometry_Centroid(self, *args)
7098
7099 - def PointOnSurface(self, *args):
7100 r""" 7101 PointOnSurface(Geometry self) -> Geometry 7102 OGRGeometryH 7103 OGR_G_PointOnSurface(OGRGeometryH hGeom) 7104 7105 Returns a point guaranteed to lie on the surface. 7106 7107 This method relates to the SFCOM ISurface::get_PointOnSurface() method 7108 however the current implementation based on GEOS can operate on other 7109 geometry types than the types that are supported by SQL/MM-Part 3 : 7110 surfaces (polygons) and multisurfaces (multipolygons). 7111 7112 This method is built on the GEOS library, check it for the definition 7113 of the geometry operation. If OGR is built without the GEOS library, 7114 this method will always fail, issuing a CPLE_NotSupported error. 7115 7116 Parameters: 7117 ----------- 7118 7119 hGeom: the geometry to operate on. 7120 7121 a point guaranteed to lie on the surface or NULL if an error occurred. 7122 7123 OGR 1.10 7124 """ 7125 return _ogr.Geometry_PointOnSurface(self, *args)
7126
7127 - def WkbSize(self, *args):
7128 r""" 7129 WkbSize(Geometry self) -> size_t 7130 int OGR_G_WkbSize(OGRGeometryH hGeom) 7131 7132 Returns size of related binary representation. 7133 7134 This function returns the exact number of bytes required to hold the 7135 well known binary representation of this geometry object. Its 7136 computation may be slightly expensive for complex geometries. 7137 7138 This function relates to the SFCOM IWks::WkbSize() method. 7139 7140 This function is the same as the CPP method OGRGeometry::WkbSize(). 7141 7142 Parameters: 7143 ----------- 7144 7145 hGeom: handle on the geometry to get the binary size from. 7146 7147 size of binary representation in bytes. 7148 """ 7149 return _ogr.Geometry_WkbSize(self, *args)
7150
7151 - def GetCoordinateDimension(self, *args):
7152 r""" 7153 GetCoordinateDimension(Geometry self) -> int 7154 int 7155 OGR_G_GetCoordinateDimension(OGRGeometryH hGeom) 7156 7157 Get the dimension of the coordinates in this geometry. 7158 7159 This function is the same as the CPP method 7160 OGRGeometry::getCoordinateDimension(). 7161 7162 Parameters: 7163 ----------- 7164 7165 hGeom: handle on the geometry to get the dimension of the coordinates 7166 from. 7167 7168 Deprecated use OGR_G_CoordinateDimension(), OGR_G_Is3D(), or 7169 OGR_G_IsMeasured(). 7170 7171 this will return 2 or 3. 7172 """ 7173 return _ogr.Geometry_GetCoordinateDimension(self, *args)
7174
7175 - def CoordinateDimension(self, *args):
7176 r""" 7177 CoordinateDimension(Geometry self) -> int 7178 int 7179 OGR_G_CoordinateDimension(OGRGeometryH hGeom) 7180 7181 Get the dimension of the coordinates in this geometry. 7182 7183 This function is the same as the CPP method 7184 OGRGeometry::CoordinateDimension(). 7185 7186 Parameters: 7187 ----------- 7188 7189 hGeom: handle on the geometry to get the dimension of the coordinates 7190 from. 7191 7192 this will return 2 for XY, 3 for XYZ and XYM, and 4 for XYZM data. 7193 7194 GDAL 2.1 7195 """ 7196 return _ogr.Geometry_CoordinateDimension(self, *args)
7197
7198 - def Is3D(self, *args):
7199 r""" 7200 Is3D(Geometry self) -> int 7201 int OGR_G_Is3D(OGRGeometryH hGeom) 7202 7203 See whether this geometry has Z coordinates. 7204 7205 This function is the same as the CPP method OGRGeometry::Is3D(). 7206 7207 Parameters: 7208 ----------- 7209 7210 hGeom: handle on the geometry to check whether it has Z coordinates. 7211 7212 TRUE if the geometry has Z coordinates. 7213 7214 GDAL 2.1 7215 """ 7216 return _ogr.Geometry_Is3D(self, *args)
7217
7218 - def IsMeasured(self, *args):
7219 r""" 7220 IsMeasured(Geometry self) -> int 7221 int OGR_G_IsMeasured(OGRGeometryH 7222 hGeom) 7223 7224 See whether this geometry is measured. 7225 7226 This function is the same as the CPP method OGRGeometry::IsMeasured(). 7227 7228 Parameters: 7229 ----------- 7230 7231 hGeom: handle on the geometry to check whether it is measured. 7232 7233 TRUE if the geometry has M coordinates. 7234 7235 GDAL 2.1 7236 """ 7237 return _ogr.Geometry_IsMeasured(self, *args)
7238
7239 - def SetCoordinateDimension(self, *args):
7240 r""" 7241 SetCoordinateDimension(Geometry self, int dimension) 7242 void 7243 OGR_G_SetCoordinateDimension(OGRGeometryH hGeom, int nNewDimension) 7244 7245 Set the coordinate dimension. 7246 7247 This method sets the explicit coordinate dimension. Setting the 7248 coordinate dimension of a geometry to 2 should zero out any existing Z 7249 values. Setting the dimension of a geometry collection, a compound 7250 curve, a polygon, etc. will affect the children geometries. This will 7251 also remove the M dimension if present before this call. 7252 7253 Deprecated use OGR_G_Set3D() or OGR_G_SetMeasured(). 7254 7255 Parameters: 7256 ----------- 7257 7258 hGeom: handle on the geometry to set the dimension of the 7259 coordinates. 7260 7261 nNewDimension: New coordinate dimension value, either 2 or 3. 7262 """ 7263 return _ogr.Geometry_SetCoordinateDimension(self, *args)
7264
7265 - def Set3D(self, *args):
7266 r""" 7267 Set3D(Geometry self, int b3D) 7268 void OGR_G_Set3D(OGRGeometryH hGeom, 7269 int bIs3D) 7270 7271 Add or remove the Z coordinate dimension. 7272 7273 This method adds or removes the explicit Z coordinate dimension. 7274 Removing the Z coordinate dimension of a geometry will remove any 7275 existing Z values. Adding the Z dimension to a geometry collection, a 7276 compound curve, a polygon, etc. will affect the children geometries. 7277 7278 Parameters: 7279 ----------- 7280 7281 hGeom: handle on the geometry to set or unset the Z dimension. 7282 7283 bIs3D: Should the geometry have a Z dimension, either TRUE or FALSE. 7284 7285 GDAL 2.1 7286 """ 7287 return _ogr.Geometry_Set3D(self, *args)
7288
7289 - def SetMeasured(self, *args):
7290 r""" 7291 SetMeasured(Geometry self, int bMeasured) 7292 void 7293 OGR_G_SetMeasured(OGRGeometryH hGeom, int bIsMeasured) 7294 7295 Add or remove the M coordinate dimension. 7296 7297 This method adds or removes the explicit M coordinate dimension. 7298 Removing the M coordinate dimension of a geometry will remove any 7299 existing M values. Adding the M dimension to a geometry collection, a 7300 compound curve, a polygon, etc. will affect the children geometries. 7301 7302 Parameters: 7303 ----------- 7304 7305 hGeom: handle on the geometry to set or unset the M dimension. 7306 7307 bIsMeasured: Should the geometry have a M dimension, either TRUE or 7308 FALSE. 7309 7310 GDAL 2.1 7311 """ 7312 return _ogr.Geometry_SetMeasured(self, *args)
7313
7314 - def GetDimension(self, *args):
7315 r""" 7316 GetDimension(Geometry self) -> int 7317 int 7318 OGR_G_GetDimension(OGRGeometryH hGeom) 7319 7320 Get the dimension of this geometry. 7321 7322 This function corresponds to the SFCOM IGeometry::GetDimension() 7323 method. It indicates the dimension of the geometry, but does not 7324 indicate the dimension of the underlying space (as indicated by 7325 OGR_G_GetCoordinateDimension() function). 7326 7327 This function is the same as the CPP method 7328 OGRGeometry::getDimension(). 7329 7330 Parameters: 7331 ----------- 7332 7333 hGeom: handle on the geometry to get the dimension from. 7334 7335 0 for points, 1 for lines and 2 for surfaces. 7336 """ 7337 return _ogr.Geometry_GetDimension(self, *args)
7338
7339 - def HasCurveGeometry(self, *args):
7340 r"""HasCurveGeometry(Geometry self, int bLookForCircular=FALSE) -> int""" 7341 return _ogr.Geometry_HasCurveGeometry(self, *args)
7342
7343 - def GetLinearGeometry(self, *args, **kwargs):
7344 r"""GetLinearGeometry(Geometry self, double dfMaxAngleStepSizeDegrees=0.0, char ** options=None) -> Geometry""" 7345 return _ogr.Geometry_GetLinearGeometry(self, *args, **kwargs)
7346
7347 - def GetCurveGeometry(self, *args, **kwargs):
7348 r"""GetCurveGeometry(Geometry self, char ** options=None) -> Geometry""" 7349 return _ogr.Geometry_GetCurveGeometry(self, *args, **kwargs)
7350
7351 - def Value(self, *args):
7352 r"""Value(Geometry self, double dfDistance) -> Geometry""" 7353 return _ogr.Geometry_Value(self, *args)
7354
7355 - def Transform(self, *args):
7356 r""" 7357 Transform(Geometry self, CoordinateTransformation trans) -> OGRErr 7358 Transform(Geometry self, GeomTransformer transformer) -> Geometry 7359 OGRErr OGR_G_Transform(OGRGeometryH 7360 hGeom, OGRCoordinateTransformationH hTransform) 7361 7362 Apply arbitrary coordinate transformation to geometry. 7363 7364 This function will transform the coordinates of a geometry from their 7365 current spatial reference system to a new target spatial reference 7366 system. Normally this means reprojecting the vectors, but it could 7367 include datum shifts, and changes of units. 7368 7369 Note that this function does not require that the geometry already 7370 have a spatial reference system. It will be assumed that they can be 7371 treated as having the source spatial reference system of the 7372 OGRCoordinateTransformation object, and the actual SRS of the geometry 7373 will be ignored. On successful completion the output 7374 OGRSpatialReference of the OGRCoordinateTransformation will be 7375 assigned to the geometry. 7376 7377 This function is the same as the CPP method OGRGeometry::transform. 7378 7379 Parameters: 7380 ----------- 7381 7382 hGeom: handle on the geometry to apply the transform to. 7383 7384 hTransform: handle on the transformation to apply. 7385 7386 OGRERR_NONE on success or an error code. 7387 """ 7388 return _ogr.Geometry_Transform(self, *args)
7389
7390 - def CreatePreparedGeometry(self, *args):
7391 r"""CreatePreparedGeometry(Geometry self) -> PreparedGeometry""" 7392 return _ogr.Geometry_CreatePreparedGeometry(self, *args)
7393
7394 - def Destroy(self):
7395 self.__swig_destroy__(self) 7396 self.__del__() 7397 self.thisown = 0
7398
7399 - def __str__(self):
7400 return self.ExportToWkt()
7401
7402 - def __copy__(self):
7403 return self.Clone()
7404
7405 - def __deepcopy__(self, memo):
7406 g = self.Clone() 7407 srs = self.GetSpatialReference() 7408 if srs: 7409 g.AssignSpatialReference(srs.Clone()) 7410 return g
7411
7412 - def __reduce__(self):
7413 return (self.__class__, (), self.ExportToWkb())
7414
7415 - def __setstate__(self, state):
7416 result = CreateGeometryFromWkb(state) 7417 self.this = result.this
7418
7419 - def __iter__(self):
7420 for i in range(self.GetGeometryCount()): 7421 yield self.GetGeometryRef(i)
7422 7423 7424 7425 # Register Geometry in _ogr: 7426 _ogr.Geometry_swigregister(Geometry) 7427
7428 -class PreparedGeometry(object):
7429 r"""Proxy of C++ OGRPreparedGeometryShadow class.""" 7430 7431 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 7432
7433 - def __init__(self, *args, **kwargs):
7434 raise AttributeError("No constructor defined")
7435 __repr__ = _swig_repr 7436 __swig_destroy__ = _ogr.delete_PreparedGeometry 7437
7438 - def Intersects(self, *args):
7439 r"""Intersects(PreparedGeometry self, Geometry otherGeom) -> bool""" 7440 return _ogr.PreparedGeometry_Intersects(self, *args)
7441
7442 - def Contains(self, *args):
7443 r"""Contains(PreparedGeometry self, Geometry otherGeom) -> bool""" 7444 return _ogr.PreparedGeometry_Contains(self, *args)
7445 7446 # Register PreparedGeometry in _ogr: 7447 _ogr.PreparedGeometry_swigregister(PreparedGeometry) 7448
7449 -class GeomTransformer(object):
7450 r"""Proxy of C++ OGRGeomTransformerShadow class.""" 7451 7452 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 7453 __repr__ = _swig_repr 7454
7455 - def __init__(self, *args):
7456 r"""__init__(GeomTransformer self, CoordinateTransformation ct, char ** options=None) -> GeomTransformer""" 7457 _ogr.GeomTransformer_swiginit(self, _ogr.new_GeomTransformer(*args))
7458 __swig_destroy__ = _ogr.delete_GeomTransformer 7459
7460 - def Transform(self, *args):
7461 r"""Transform(GeomTransformer self, Geometry src_geom) -> Geometry""" 7462 return _ogr.GeomTransformer_Transform(self, *args)
7463 7464 # Register GeomTransformer in _ogr: 7465 _ogr.GeomTransformer_swigregister(GeomTransformer) 7466
7467 -class FieldDomain(object):
7468 r"""Proxy of C++ OGRFieldDomainShadow class.""" 7469 7470 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") 7471
7472 - def __init__(self, *args, **kwargs):
7473 raise AttributeError("No constructor defined")
7474 __repr__ = _swig_repr 7475 __swig_destroy__ = _ogr.delete_FieldDomain 7476
7477 - def GetName(self, *args):
7478 r"""GetName(FieldDomain self) -> char const *""" 7479 return _ogr.FieldDomain_GetName(self, *args)
7480
7481 - def GetDescription(self, *args):
7482 r"""GetDescription(FieldDomain self) -> char const *""" 7483 return _ogr.FieldDomain_GetDescription(self, *args)
7484
7485 - def GetFieldType(self, *args):
7486 r"""GetFieldType(FieldDomain self) -> OGRFieldType""" 7487 return _ogr.FieldDomain_GetFieldType(self, *args)
7488
7489 - def GetFieldSubType(self, *args):
7490 r"""GetFieldSubType(FieldDomain self) -> OGRFieldSubType""" 7491 return _ogr.FieldDomain_GetFieldSubType(self, *args)
7492
7493 - def GetDomainType(self, *args):
7494 r"""GetDomainType(FieldDomain self) -> OGRFieldDomainType""" 7495 return _ogr.FieldDomain_GetDomainType(self, *args)
7496
7497 - def GetSplitPolicy(self, *args):
7498 r"""GetSplitPolicy(FieldDomain self) -> OGRFieldDomainSplitPolicy""" 7499 return _ogr.FieldDomain_GetSplitPolicy(self, *args)
7500
7501 - def SetSplitPolicy(self, *args):
7502 r"""SetSplitPolicy(FieldDomain self, OGRFieldDomainSplitPolicy policy)""" 7503 return _ogr.FieldDomain_SetSplitPolicy(self, *args)
7504
7505 - def GetMergePolicy(self, *args):
7506 r"""GetMergePolicy(FieldDomain self) -> OGRFieldDomainMergePolicy""" 7507 return _ogr.FieldDomain_GetMergePolicy(self, *args)
7508
7509 - def SetMergePolicy(self, *args):
7510 r"""SetMergePolicy(FieldDomain self, OGRFieldDomainMergePolicy policy)""" 7511 return _ogr.FieldDomain_SetMergePolicy(self, *args)
7512
7513 - def GetEnumeration(self, *args):
7514 r"""GetEnumeration(FieldDomain self) -> OGRCodedValue const *""" 7515 return _ogr.FieldDomain_GetEnumeration(self, *args)
7516
7517 - def GetMinAsDouble(self, *args):
7518 r"""GetMinAsDouble(FieldDomain self) -> double""" 7519 return _ogr.FieldDomain_GetMinAsDouble(self, *args)
7520
7521 - def IsMinInclusive(self, *args):
7522 r"""IsMinInclusive(FieldDomain self) -> bool""" 7523 return _ogr.FieldDomain_IsMinInclusive(self, *args)
7524
7525 - def GetMaxAsDouble(self, *args):
7526 r"""GetMaxAsDouble(FieldDomain self) -> double""" 7527 return _ogr.FieldDomain_GetMaxAsDouble(self, *args)
7528
7529 - def IsMaxInclusive(self, *args):
7530 r"""IsMaxInclusive(FieldDomain self) -> bool""" 7531 return _ogr.FieldDomain_IsMaxInclusive(self, *args)
7532
7533 - def GetGlob(self, *args):
7534 r"""GetGlob(FieldDomain self) -> char const *""" 7535 return _ogr.FieldDomain_GetGlob(self, *args)
7536 7537 # Register FieldDomain in _ogr: 7538 _ogr.FieldDomain_swigregister(FieldDomain) 7539 7540
7541 -def CreateCodedFieldDomain(*args):
7542 r"""CreateCodedFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, OGRCodedValue const * enumeration) -> FieldDomain""" 7543 return _ogr.CreateCodedFieldDomain(*args)
7544
7545 -def CreateRangeFieldDomain(*args):
7546 r"""CreateRangeFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, double min, bool minIsInclusive, double max, double maxIsInclusive) -> FieldDomain""" 7547 return _ogr.CreateRangeFieldDomain(*args)
7548
7549 -def CreateGlobFieldDomain(*args):
7550 r"""CreateGlobFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, char const * glob) -> FieldDomain""" 7551 return _ogr.CreateGlobFieldDomain(*args)
7552
7553 -def GetDriverCount(*args):
7554 r"""GetDriverCount() -> int""" 7555 return _ogr.GetDriverCount(*args)
7556
7557 -def GetOpenDSCount(*args):
7558 r"""GetOpenDSCount() -> int""" 7559 return _ogr.GetOpenDSCount(*args)
7560
7561 -def SetGenerate_DB2_V72_BYTE_ORDER(*args):
7562 r"""SetGenerate_DB2_V72_BYTE_ORDER(int bGenerate_DB2_V72_BYTE_ORDER) -> OGRErr""" 7563 return _ogr.SetGenerate_DB2_V72_BYTE_ORDER(*args)
7564
7565 -def RegisterAll(*args):
7566 r"""RegisterAll()""" 7567 return _ogr.RegisterAll(*args)
7568
7569 -def GeometryTypeToName(*args):
7570 r"""GeometryTypeToName(OGRwkbGeometryType eType) -> char const *""" 7571 return _ogr.GeometryTypeToName(*args)
7572
7573 -def GetFieldTypeName(*args):
7574 r"""GetFieldTypeName(OGRFieldType type) -> char const *""" 7575 return _ogr.GetFieldTypeName(*args)
7576
7577 -def GetFieldSubTypeName(*args):
7578 r"""GetFieldSubTypeName(OGRFieldSubType type) -> char const *""" 7579 return _ogr.GetFieldSubTypeName(*args)
7580
7581 -def GT_Flatten(*args):
7582 r"""GT_Flatten(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7583 return _ogr.GT_Flatten(*args)
7584
7585 -def GT_SetZ(*args):
7586 r"""GT_SetZ(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7587 return _ogr.GT_SetZ(*args)
7588
7589 -def GT_SetM(*args):
7590 r"""GT_SetM(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7591 return _ogr.GT_SetM(*args)
7592
7593 -def GT_SetModifier(*args):
7594 r"""GT_SetModifier(OGRwkbGeometryType eType, int bSetZ, int bSetM=FALSE) -> OGRwkbGeometryType""" 7595 return _ogr.GT_SetModifier(*args)
7596
7597 -def GT_HasZ(*args):
7598 r"""GT_HasZ(OGRwkbGeometryType eType) -> int""" 7599 return _ogr.GT_HasZ(*args)
7600
7601 -def GT_HasM(*args):
7602 r"""GT_HasM(OGRwkbGeometryType eType) -> int""" 7603 return _ogr.GT_HasM(*args)
7604
7605 -def GT_IsSubClassOf(*args):
7606 r"""GT_IsSubClassOf(OGRwkbGeometryType eType, OGRwkbGeometryType eSuperType) -> int""" 7607 return _ogr.GT_IsSubClassOf(*args)
7608
7609 -def GT_IsCurve(*args):
7610 r"""GT_IsCurve(OGRwkbGeometryType arg1) -> int""" 7611 return _ogr.GT_IsCurve(*args)
7612
7613 -def GT_IsSurface(*args):
7614 r"""GT_IsSurface(OGRwkbGeometryType arg1) -> int""" 7615 return _ogr.GT_IsSurface(*args)
7616
7617 -def GT_IsNonLinear(*args):
7618 r"""GT_IsNonLinear(OGRwkbGeometryType arg1) -> int""" 7619 return _ogr.GT_IsNonLinear(*args)
7620
7621 -def GT_GetCollection(*args):
7622 r"""GT_GetCollection(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7623 return _ogr.GT_GetCollection(*args)
7624
7625 -def GT_GetCurve(*args):
7626 r"""GT_GetCurve(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7627 return _ogr.GT_GetCurve(*args)
7628
7629 -def GT_GetLinear(*args):
7630 r"""GT_GetLinear(OGRwkbGeometryType eType) -> OGRwkbGeometryType""" 7631 return _ogr.GT_GetLinear(*args)
7632
7633 -def SetNonLinearGeometriesEnabledFlag(*args):
7634 r"""SetNonLinearGeometriesEnabledFlag(int bFlag)""" 7635 return _ogr.SetNonLinearGeometriesEnabledFlag(*args)
7636
7637 -def GetNonLinearGeometriesEnabledFlag(*args):
7638 r"""GetNonLinearGeometriesEnabledFlag() -> int""" 7639 return _ogr.GetNonLinearGeometriesEnabledFlag(*args)
7640
7641 -def GetOpenDS(*args):
7642 r"""GetOpenDS(int ds_number) -> DataSource""" 7643 return _ogr.GetOpenDS(*args)
7644
7645 -def Open(*args, **kwargs):
7646 r"""Open(char const * utf8_path, int update=0) -> DataSource""" 7647 return _ogr.Open(*args, **kwargs)
7648
7649 -def OpenShared(*args, **kwargs):
7650 r"""OpenShared(char const * utf8_path, int update=0) -> DataSource""" 7651 return _ogr.OpenShared(*args, **kwargs)
7652
7653 -def GetDriverByName(*args):
7654 r"""GetDriverByName(char const * name) -> Driver""" 7655 return _ogr.GetDriverByName(*args)
7656
7657 -def GetDriver(*args):
7658 r"""GetDriver(int driver_number) -> Driver""" 7659 return _ogr.GetDriver(*args)
7660
7661 -def GeneralCmdLineProcessor(*args):
7662 r"""GeneralCmdLineProcessor(char ** papszArgv, int nOptions=0) -> char **""" 7663 return _ogr.GeneralCmdLineProcessor(*args)
7664
7665 -def TermProgress_nocb(*args, **kwargs):
7666 r"""TermProgress_nocb(double dfProgress, char const * pszMessage=None, void * pData=None) -> int""" 7667 return _ogr.TermProgress_nocb(*args, **kwargs)
7668 TermProgress = _ogr.TermProgress 7669