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