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