pyogrio 0.7.1__cp38-cp38-win_amd64.whl → 0.8.0__cp38-cp38-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyogrio might be problematic. Click here for more details.

Files changed (86) hide show
  1. pyogrio/__init__.py +12 -7
  2. pyogrio/_compat.py +7 -1
  3. pyogrio/_err.c +855 -321
  4. pyogrio/_err.cp38-win_amd64.pyd +0 -0
  5. pyogrio/_err.pyx +7 -3
  6. pyogrio/_geometry.c +134 -75
  7. pyogrio/_geometry.cp38-win_amd64.pyd +0 -0
  8. pyogrio/_io.c +28935 -23123
  9. pyogrio/_io.cp38-win_amd64.pyd +0 -0
  10. pyogrio/_io.pyx +900 -242
  11. pyogrio/_ogr.c +1317 -1640
  12. pyogrio/_ogr.cp38-win_amd64.pyd +0 -0
  13. pyogrio/_ogr.pxd +65 -12
  14. pyogrio/_ogr.pyx +8 -24
  15. pyogrio/_version.py +3 -3
  16. pyogrio/_vsi.c +6815 -0
  17. pyogrio/_vsi.cp38-win_amd64.pyd +0 -0
  18. pyogrio/_vsi.pxd +4 -0
  19. pyogrio/_vsi.pyx +140 -0
  20. pyogrio/core.py +43 -44
  21. pyogrio/gdal_data/GDAL-targets-release.cmake +1 -1
  22. pyogrio/gdal_data/GDAL-targets.cmake +10 -6
  23. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  24. pyogrio/gdal_data/gdalinfo_output.schema.json +2 -0
  25. pyogrio/gdal_data/gdalvrt.xsd +163 -0
  26. pyogrio/gdal_data/ogrinfo_output.schema.json +12 -1
  27. pyogrio/gdal_data/vcpkg.spdx.json +23 -23
  28. pyogrio/gdal_data/vcpkg_abi_info.txt +29 -28
  29. pyogrio/geopandas.py +131 -30
  30. pyogrio/proj_data/ITRF2008 +2 -2
  31. pyogrio/proj_data/proj-config-version.cmake +2 -2
  32. pyogrio/proj_data/proj-config.cmake +2 -1
  33. pyogrio/proj_data/proj-targets-release.cmake +0 -1
  34. pyogrio/proj_data/proj-targets.cmake +10 -6
  35. pyogrio/proj_data/proj.db +0 -0
  36. pyogrio/proj_data/proj4-targets-release.cmake +0 -1
  37. pyogrio/proj_data/proj4-targets.cmake +10 -6
  38. pyogrio/proj_data/vcpkg.spdx.json +21 -43
  39. pyogrio/proj_data/vcpkg_abi_info.txt +16 -17
  40. pyogrio/raw.py +438 -116
  41. pyogrio/tests/conftest.py +75 -6
  42. pyogrio/tests/test_arrow.py +841 -7
  43. pyogrio/tests/test_core.py +99 -7
  44. pyogrio/tests/test_geopandas_io.py +744 -119
  45. pyogrio/tests/test_path.py +22 -3
  46. pyogrio/tests/test_raw_io.py +276 -50
  47. pyogrio/util.py +41 -19
  48. pyogrio-0.8.0.dist-info/DELVEWHEEL +2 -0
  49. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/METADATA +3 -2
  50. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/RECORD +73 -69
  51. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/WHEEL +1 -1
  52. pyogrio.libs/.load-order-pyogrio-0.8.0 +19 -0
  53. pyogrio.libs/Lerc-62a2c1c74500e7815994b3e49b36750c.dll +0 -0
  54. pyogrio.libs/{gdal-c3b1d8f66682071d0cd26d86e4182013.dll → gdal-2bfc6a9f962a8953b0640db9a272d797.dll} +0 -0
  55. pyogrio.libs/geos-289d7171bd083dfed1f8a90e4ae57442.dll +0 -0
  56. pyogrio.libs/geos_c-2a12859cd876719c648f1eb950b7d94c.dll +0 -0
  57. pyogrio.libs/{geotiff-e43cdab688866b59f8800cfcde836d16.dll → geotiff-d1c0fcc3c454409ad8be61ff04a7422c.dll} +0 -0
  58. pyogrio.libs/iconv-2-f2d9304f8dc4cdd981024b520b73a099.dll +0 -0
  59. pyogrio.libs/{jpeg62-567ab743ac805dfb57fe3867ba5788a4.dll → jpeg62-a67b2bf7fd32d34c565ae5bb6d47c224.dll} +0 -0
  60. pyogrio.libs/json-c-79a8df7e59952f5c5d594620e4b66c13.dll +0 -0
  61. pyogrio.libs/libcurl-7fef9869f6520a5fbdb2bc9ce4c496cc.dll +0 -0
  62. pyogrio.libs/libexpat-fa55f107b678de136400c6d953c3cdde.dll +0 -0
  63. pyogrio.libs/{liblzma-de7f4770d4e3715acd031ca93883f10c.dll → liblzma-5a1f648afc3d4cf36e3aef2266d55143.dll} +0 -0
  64. pyogrio.libs/libpng16-6227e9a35c2a350ae6b0586079c10b9e.dll +0 -0
  65. pyogrio.libs/{msvcp140-83b6a1a2fa8b1735a358b2fe13cabe4e.dll → msvcp140-46db46e967c8db2cb7a20fc75872a57e.dll} +0 -0
  66. pyogrio.libs/proj-74051a73897c9fa6d7bfef4561688568.dll +0 -0
  67. pyogrio.libs/{qhull_r-99ae8a526357acc44b162cb4df2c3bb6.dll → qhull_r-d8840f4ed1f7d452ff9a30237320bcfd.dll} +0 -0
  68. pyogrio.libs/sqlite3-fe7a86058d1c5658d1f9106228a7fd83.dll +0 -0
  69. pyogrio.libs/{tiff-7c2d4b204ec2db46c81f6a597895c2f7.dll → tiff-ffca1ff19d0e95dad39df0078fb037af.dll} +0 -0
  70. pyogrio.libs/vcruntime140_1-8f7e93381c4b3d1e411993c0bae01646.dll +0 -0
  71. pyogrio.libs/{zlib1-824de9299616f0908aeeb9441a084848.dll → zlib1-aaba6ea052f6d3fa3d84a301e3eb3d30.dll} +0 -0
  72. pyogrio/tests/win32.py +0 -86
  73. pyogrio-0.7.1.dist-info/DELVEWHEEL +0 -2
  74. pyogrio.libs/.load-order-pyogrio-0.7.1 +0 -18
  75. pyogrio.libs/Lerc-d5afc4101deffe7de21241ccd4d562f6.dll +0 -0
  76. pyogrio.libs/geos-1c764a1384537a0ad2995e83d23e8642.dll +0 -0
  77. pyogrio.libs/geos_c-0d7dfdcee49efa8df585e2fb993157aa.dll +0 -0
  78. pyogrio.libs/json-c-36c91e30c4410d41c22b2010c31183e3.dll +0 -0
  79. pyogrio.libs/libcurl-ebcc8c18195071a90e59f818902e10c6.dll +0 -0
  80. pyogrio.libs/libexpat-345379c9c11632130d8c383cbacde1a6.dll +0 -0
  81. pyogrio.libs/libpng16-2c30e6846653c47ef2ff9d7dec3338ba.dll +0 -0
  82. pyogrio.libs/proj-98758c96a6cb682b5cec7e8dc5e29a50.dll +0 -0
  83. pyogrio.libs/sqlite3-327ed7b38bfd91fb4a17544960e055e9.dll +0 -0
  84. pyogrio.libs/vcruntime140_1-d1a1506707e0c0a26950a60c5f97ad99.dll +0 -0
  85. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/LICENSE +0 -0
  86. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/top_level.txt +0 -0
Binary file
pyogrio/_ogr.pxd CHANGED
@@ -12,6 +12,9 @@ cdef extern from "cpl_conv.h":
12
12
  const char* CPLFindFile(const char *pszClass, const char *filename)
13
13
  const char* CPLGetConfigOption(const char* key, const char* value)
14
14
  void CPLSetConfigOption(const char* key, const char* value)
15
+ const char* CPLGetThreadLocalConfigOption(const char* key, const char* value)
16
+ void CPLSetThreadLocalConfigOption(const char* key, const char* value)
17
+ char* CPLStrdup(const char* string)
15
18
 
16
19
 
17
20
  cdef extern from "cpl_error.h" nogil:
@@ -42,13 +45,23 @@ cdef extern from "cpl_string.h":
42
45
 
43
46
 
44
47
  cdef extern from "cpl_vsi.h" nogil:
45
-
48
+ int VSI_STAT_EXISTS_FLAG
49
+ ctypedef int vsi_l_offset
46
50
  ctypedef FILE VSILFILE
51
+ ctypedef struct VSIStatBufL:
52
+ long st_size
53
+ long st_mode
54
+ int st_mtime
55
+
56
+ int VSIFCloseL(VSILFILE *fp)
57
+ int VSIFFlushL(VSILFILE *fp)
58
+ int VSIUnlink(const char *path)
47
59
 
48
- VSILFILE *VSIFileFromMemBuffer(const char *path, void *data,
49
- int data_len, int take_ownership)
50
- int VSIFCloseL(VSILFILE *fp)
51
- int VSIUnlink(const char *path)
60
+ VSILFILE *VSIFileFromMemBuffer(const char *path, void *data, vsi_l_offset data_len, int take_ownership)
61
+ unsigned char *VSIGetMemFileBuffer(const char *path, vsi_l_offset *data_len, int take_ownership)
62
+
63
+ int VSIMkdir(const char *path, long mode)
64
+ int VSIRmdirRecursive(const char *pszDirname)
52
65
 
53
66
 
54
67
  cdef extern from "ogr_core.h":
@@ -190,12 +203,36 @@ cdef extern from "ogr_srs_api.h":
190
203
  void OSRRelease(OGRSpatialReferenceH srs)
191
204
 
192
205
 
193
- cdef extern from "arrow_bridge.h":
206
+ cdef extern from "arrow_bridge.h" nogil:
207
+ struct ArrowArray:
208
+ int64_t length
209
+ int64_t null_count
210
+ int64_t offset
211
+ int64_t n_buffers
212
+ int64_t n_children
213
+ const void** buffers
214
+ ArrowArray** children
215
+ ArrowArray* dictionary
216
+ void (*release)(ArrowArray*) noexcept nogil
217
+ void* private_data
218
+
194
219
  struct ArrowSchema:
220
+ const char* format
221
+ const char* name
222
+ const char* metadata
223
+ int64_t flags
195
224
  int64_t n_children
225
+ ArrowSchema** children
226
+ ArrowSchema* dictionary
227
+ void (*release)(ArrowSchema*) noexcept nogil
228
+ void* private_data
196
229
 
197
230
  struct ArrowArrayStream:
198
- int (*get_schema)(ArrowArrayStream* stream, ArrowSchema* out)
231
+ int (*get_schema)(ArrowArrayStream*, ArrowSchema* out) noexcept
232
+ int (*get_next)(ArrowArrayStream*, ArrowArray* out)
233
+ const char* (*get_last_error)(ArrowArrayStream*)
234
+ void (*release)(ArrowArrayStream*) noexcept
235
+ void* private_data
199
236
 
200
237
 
201
238
  cdef extern from "ogr_api.h":
@@ -205,6 +242,8 @@ cdef extern from "ogr_api.h":
205
242
  OGRDataSourceH OGR_Dr_Open(OGRSFDriverH driver, const char *path, int bupdate)
206
243
  const char* OGR_Dr_GetName(OGRSFDriverH driver)
207
244
 
245
+ const char* OGR_DS_GetName(OGRDataSourceH)
246
+
208
247
  OGRFeatureH OGR_F_Create(OGRFeatureDefnH featuredefn)
209
248
  void OGR_F_Destroy(OGRFeatureH feature)
210
249
 
@@ -298,8 +337,6 @@ cdef extern from "ogr_api.h":
298
337
  void OGRSetNonLinearGeometriesEnabledFlag(int bFlag)
299
338
  int OGRGetNonLinearGeometriesEnabledFlag()
300
339
 
301
- int OGRReleaseDataSource(OGRDataSourceH ds)
302
-
303
340
  const char* OLCStringsAsUTF8
304
341
  const char* OLCRandomRead
305
342
  const char* OLCFastSetNextByIndex
@@ -312,8 +349,14 @@ cdef extern from "ogr_api.h":
312
349
  IF CTE_GDAL_VERSION >= (3, 6, 0):
313
350
 
314
351
  cdef extern from "ogr_api.h":
315
- int8_t OGR_L_GetArrowStream(OGRLayerH hLayer, ArrowArrayStream *out_stream, char** papszOptions)
352
+ bint OGR_L_GetArrowStream(OGRLayerH hLayer, ArrowArrayStream *out_stream, char** papszOptions)
353
+
316
354
 
355
+ IF CTE_GDAL_VERSION >= (3, 8, 0):
356
+
357
+ cdef extern from "ogr_api.h":
358
+ bint OGR_L_CreateFieldFromArrowSchema(OGRLayerH hLayer, ArrowSchema *schema, char **papszOptions)
359
+ bint OGR_L_WriteArrowBatch(OGRLayerH hLayer, ArrowSchema *schema, ArrowArray *array, char **papszOptions)
317
360
 
318
361
  cdef extern from "gdal.h":
319
362
  ctypedef enum GDALDataType:
@@ -366,7 +409,6 @@ cdef extern from "gdal.h":
366
409
  const char *const *papszOpenOptions,
367
410
  const char *const *papszSiblingFiles)
368
411
 
369
- void GDALClose(GDALDatasetH ds)
370
412
  int GDALDatasetGetLayerCount(GDALDatasetH ds)
371
413
  OGRLayerH GDALDatasetGetLayer(GDALDatasetH ds, int iLayer)
372
414
  OGRLayerH GDALDatasetGetLayerByName(GDALDatasetH ds, char * pszName)
@@ -385,4 +427,15 @@ cdef extern from "gdal.h":
385
427
  const char* GDALVersionInfo(const char *pszRequest)
386
428
 
387
429
 
388
- cdef get_string(const char *c_str, str encoding=*)
430
+ # GDALClose returns error code for >= 3.7.0
431
+ IF CTE_GDAL_VERSION >= (3, 7, 0):
432
+
433
+ cdef extern from "ogr_api.h":
434
+ int GDALClose(GDALDatasetH ds)
435
+ ELSE:
436
+
437
+ cdef extern from "ogr_api.h":
438
+ void GDALClose(GDALDatasetH ds)
439
+
440
+
441
+ cdef get_string(const char *c_str, str encoding=*)
pyogrio/_ogr.pyx CHANGED
@@ -108,6 +108,14 @@ def ogr_driver_supports_write(driver):
108
108
  return False
109
109
 
110
110
 
111
+ def ogr_driver_supports_vsi(driver):
112
+ # check metadata for driver to see if it supports write
113
+ if _get_driver_metadata_item(driver, "DCAP_VIRTUALIO") == 'YES':
114
+ return True
115
+
116
+ return False
117
+
118
+
111
119
  def ogr_list_drivers():
112
120
  cdef OGRSFDriverH driver = NULL
113
121
  cdef int i
@@ -129,30 +137,6 @@ def ogr_list_drivers():
129
137
  return drivers
130
138
 
131
139
 
132
- def buffer_to_virtual_file(bytesbuf, ext=''):
133
- """Maps a bytes buffer to a virtual file.
134
- `ext` is empty or begins with a period and contains at most one period.
135
-
136
- This (and remove_virtual_file) is originally copied from the Fiona project
137
- (https://github.com/Toblerity/Fiona/blob/c388e9adcf9d33e3bb04bf92b2ff210bbce452d9/fiona/ogrext.pyx#L1863-L1879)
138
- """
139
-
140
- vsi_filename = f"/vsimem/{uuid4().hex + ext}"
141
-
142
- vsi_handle = VSIFileFromMemBuffer(vsi_filename.encode("UTF-8"), <unsigned char *>bytesbuf, len(bytesbuf), 0)
143
-
144
- if vsi_handle == NULL:
145
- raise OSError('failed to map buffer to file')
146
- if VSIFCloseL(vsi_handle) != 0:
147
- raise OSError('failed to close mapped file handle')
148
-
149
- return vsi_filename
150
-
151
-
152
- def remove_virtual_file(vsi_filename):
153
- return VSIUnlink(vsi_filename.encode("UTF-8"))
154
-
155
-
156
140
  cdef void set_proj_search_path(str path):
157
141
  """Set PROJ library data file search path for use in GDAL."""
158
142
  cdef char **paths = NULL
pyogrio/_version.py CHANGED
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2023-10-26T15:56:41-0700",
11
+ "date": "2024-05-06T14:34:51-0700",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "97d9dee48584208ccbb479b87d58ec1eb92b3f9c",
15
- "version": "0.7.1"
14
+ "full-revisionid": "46c35a7e98d85923cfefe73dae7285404e72d9a6",
15
+ "version": "0.8.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18