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