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