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