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