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