pyogrio 0.7.2__cp39-cp39-win_amd64.whl → 0.9.0__cp39-cp39-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 (85) hide show
  1. pyogrio/__init__.py +12 -7
  2. pyogrio/_compat.py +6 -1
  3. pyogrio/_err.c +855 -321
  4. pyogrio/_err.cp39-win_amd64.pyd +0 -0
  5. pyogrio/_err.pyx +7 -3
  6. pyogrio/_geometry.c +134 -75
  7. pyogrio/_geometry.cp39-win_amd64.pyd +0 -0
  8. pyogrio/_io.c +28462 -22609
  9. pyogrio/_io.cp39-win_amd64.pyd +0 -0
  10. pyogrio/_io.pyx +904 -242
  11. pyogrio/_ogr.c +1317 -1640
  12. pyogrio/_ogr.cp39-win_amd64.pyd +0 -0
  13. pyogrio/_ogr.pxd +69 -13
  14. pyogrio/_ogr.pyx +8 -24
  15. pyogrio/_version.py +3 -3
  16. pyogrio/_vsi.c +6815 -0
  17. pyogrio/_vsi.cp39-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 +140 -34
  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/fixtures/poly_not_enough_points.shp.zip +0 -0
  43. pyogrio/tests/test_arrow.py +841 -7
  44. pyogrio/tests/test_core.py +99 -7
  45. pyogrio/tests/test_geopandas_io.py +827 -121
  46. pyogrio/tests/test_path.py +23 -3
  47. pyogrio/tests/test_raw_io.py +276 -50
  48. pyogrio/util.py +39 -19
  49. pyogrio-0.9.0.dist-info/DELVEWHEEL +2 -0
  50. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/METADATA +2 -2
  51. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/RECORD +73 -68
  52. {pyogrio-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/WHEEL +1 -1
  53. pyogrio.libs/.load-order-pyogrio-0.9.0 +18 -0
  54. pyogrio.libs/Lerc-5e4d8cbeeabca06f95e2270792304dc3.dll +0 -0
  55. pyogrio.libs/{gdal-c3b1d8f66682071d0cd26d86e4182013.dll → gdal-b434963605a006e01c486c0df6dea4e0.dll} +0 -0
  56. pyogrio.libs/geos-f0622d0794b81c937a851b2e6fa9b712.dll +0 -0
  57. pyogrio.libs/geos_c-0e16bf70612fc3301d077b9d863a3fdb.dll +0 -0
  58. pyogrio.libs/{geotiff-e43cdab688866b59f8800cfcde836d16.dll → geotiff-772e7c705fb15ddf91b432adb4eb1f6c.dll} +0 -0
  59. pyogrio.libs/iconv-2-8fcc23ddc6f096c45871011b6e008b44.dll +0 -0
  60. pyogrio.libs/{jpeg62-567ab743ac805dfb57fe3867ba5788a4.dll → jpeg62-2f9b7af22d78338e8f0be0058503dc35.dll} +0 -0
  61. pyogrio.libs/json-c-e52a077545e4057de42beb4948289b41.dll +0 -0
  62. pyogrio.libs/libcurl-bc81cd8afe15b10c0821b181b6af8bd0.dll +0 -0
  63. pyogrio.libs/libexpat-fbe03ca8917dfda776562d4338b289b8.dll +0 -0
  64. pyogrio.libs/{liblzma-de7f4770d4e3715acd031ca93883f10c.dll → liblzma-6b36f24d54d3dd45f274a2aebef81085.dll} +0 -0
  65. pyogrio.libs/libpng16-13928571ad910705eae8d7dd8eef8b11.dll +0 -0
  66. pyogrio.libs/{msvcp140-83b6a1a2fa8b1735a358b2fe13cabe4e.dll → msvcp140-46db46e967c8db2cb7a20fc75872a57e.dll} +0 -0
  67. pyogrio.libs/proj-8a30239ef2dfc3b9dd2bb48e8abb330f.dll +0 -0
  68. pyogrio.libs/{qhull_r-99ae8a526357acc44b162cb4df2c3bb6.dll → qhull_r-c45abde5d0c92faf723cc2942138af77.dll} +0 -0
  69. pyogrio.libs/sqlite3-df30c3cf230727e23c43c40126a530f7.dll +0 -0
  70. pyogrio.libs/{tiff-7c2d4b204ec2db46c81f6a597895c2f7.dll → tiff-43630f30487a9015213475ae86ed3fa3.dll} +0 -0
  71. pyogrio.libs/{zlib1-824de9299616f0908aeeb9441a084848.dll → zlib1-e1272810861a13dd8d6cff3beac47f17.dll} +0 -0
  72. pyogrio/tests/win32.py +0 -86
  73. pyogrio-0.7.2.dist-info/DELVEWHEEL +0 -2
  74. pyogrio.libs/.load-order-pyogrio-0.7.2 +0 -17
  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-0.7.2.dist-info → pyogrio-0.9.0.dist-info}/LICENSE +0 -0
  85. {pyogrio-0.7.2.dist-info → pyogrio-0.9.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)
59
+
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)
47
62
 
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)
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":
@@ -183,19 +196,46 @@ cdef extern from "ogr_srs_api.h":
183
196
  const char* OSRGetAuthorityName(OGRSpatialReferenceH srs, const char *key)
184
197
  const char* OSRGetAuthorityCode(OGRSpatialReferenceH srs, const char *key)
185
198
  OGRErr OSRImportFromEPSG(OGRSpatialReferenceH srs, int code)
186
-
199
+ ctypedef enum OSRAxisMappingStrategy:
200
+ OAMS_TRADITIONAL_GIS_ORDER
201
+
202
+ void OSRSetAxisMappingStrategy(OGRSpatialReferenceH hSRS, OSRAxisMappingStrategy)
187
203
  int OSRSetFromUserInput(OGRSpatialReferenceH srs, const char *pszDef)
188
204
  void OSRSetPROJSearchPaths(const char *const *paths)
189
205
  OGRSpatialReferenceH OSRNewSpatialReference(const char *wkt)
190
206
  void OSRRelease(OGRSpatialReferenceH srs)
191
207
 
192
208
 
193
- cdef extern from "arrow_bridge.h":
209
+ cdef extern from "arrow_bridge.h" nogil:
210
+ struct ArrowArray:
211
+ int64_t length
212
+ int64_t null_count
213
+ int64_t offset
214
+ int64_t n_buffers
215
+ int64_t n_children
216
+ const void** buffers
217
+ ArrowArray** children
218
+ ArrowArray* dictionary
219
+ void (*release)(ArrowArray*) noexcept nogil
220
+ void* private_data
221
+
194
222
  struct ArrowSchema:
223
+ const char* format
224
+ const char* name
225
+ const char* metadata
226
+ int64_t flags
195
227
  int64_t n_children
228
+ ArrowSchema** children
229
+ ArrowSchema* dictionary
230
+ void (*release)(ArrowSchema*) noexcept nogil
231
+ void* private_data
196
232
 
197
233
  struct ArrowArrayStream:
198
- int (*get_schema)(ArrowArrayStream* stream, ArrowSchema* out)
234
+ int (*get_schema)(ArrowArrayStream*, ArrowSchema* out) noexcept
235
+ int (*get_next)(ArrowArrayStream*, ArrowArray* out)
236
+ const char* (*get_last_error)(ArrowArrayStream*)
237
+ void (*release)(ArrowArrayStream*) noexcept
238
+ void* private_data
199
239
 
200
240
 
201
241
  cdef extern from "ogr_api.h":
@@ -205,6 +245,8 @@ cdef extern from "ogr_api.h":
205
245
  OGRDataSourceH OGR_Dr_Open(OGRSFDriverH driver, const char *path, int bupdate)
206
246
  const char* OGR_Dr_GetName(OGRSFDriverH driver)
207
247
 
248
+ const char* OGR_DS_GetName(OGRDataSourceH)
249
+
208
250
  OGRFeatureH OGR_F_Create(OGRFeatureDefnH featuredefn)
209
251
  void OGR_F_Destroy(OGRFeatureH feature)
210
252
 
@@ -298,8 +340,6 @@ cdef extern from "ogr_api.h":
298
340
  void OGRSetNonLinearGeometriesEnabledFlag(int bFlag)
299
341
  int OGRGetNonLinearGeometriesEnabledFlag()
300
342
 
301
- int OGRReleaseDataSource(OGRDataSourceH ds)
302
-
303
343
  const char* OLCStringsAsUTF8
304
344
  const char* OLCRandomRead
305
345
  const char* OLCFastSetNextByIndex
@@ -312,8 +352,14 @@ cdef extern from "ogr_api.h":
312
352
  IF CTE_GDAL_VERSION >= (3, 6, 0):
313
353
 
314
354
  cdef extern from "ogr_api.h":
315
- int8_t OGR_L_GetArrowStream(OGRLayerH hLayer, ArrowArrayStream *out_stream, char** papszOptions)
355
+ bint OGR_L_GetArrowStream(OGRLayerH hLayer, ArrowArrayStream *out_stream, char** papszOptions)
356
+
316
357
 
358
+ IF CTE_GDAL_VERSION >= (3, 8, 0):
359
+
360
+ cdef extern from "ogr_api.h":
361
+ bint OGR_L_CreateFieldFromArrowSchema(OGRLayerH hLayer, ArrowSchema *schema, char **papszOptions)
362
+ bint OGR_L_WriteArrowBatch(OGRLayerH hLayer, ArrowSchema *schema, ArrowArray *array, char **papszOptions)
317
363
 
318
364
  cdef extern from "gdal.h":
319
365
  ctypedef enum GDALDataType:
@@ -366,7 +412,6 @@ cdef extern from "gdal.h":
366
412
  const char *const *papszOpenOptions,
367
413
  const char *const *papszSiblingFiles)
368
414
 
369
- void GDALClose(GDALDatasetH ds)
370
415
  int GDALDatasetGetLayerCount(GDALDatasetH ds)
371
416
  OGRLayerH GDALDatasetGetLayer(GDALDatasetH ds, int iLayer)
372
417
  OGRLayerH GDALDatasetGetLayerByName(GDALDatasetH ds, char * pszName)
@@ -385,4 +430,15 @@ cdef extern from "gdal.h":
385
430
  const char* GDALVersionInfo(const char *pszRequest)
386
431
 
387
432
 
388
- cdef get_string(const char *c_str, str encoding=*)
433
+ # GDALClose returns error code for >= 3.7.0
434
+ IF CTE_GDAL_VERSION >= (3, 7, 0):
435
+
436
+ cdef extern from "ogr_api.h":
437
+ int GDALClose(GDALDatasetH ds)
438
+ ELSE:
439
+
440
+ cdef extern from "ogr_api.h":
441
+ void GDALClose(GDALDatasetH ds)
442
+
443
+
444
+ 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-30T11:39:03-0700",
11
+ "date": "2024-06-17T12:28:58-0700",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "71acde57ef674c8622d17b29663ff4349b1fee6e",
15
- "version": "0.7.2"
14
+ "full-revisionid": "568f87062a65e0452c679624cc33fbf1af535454",
15
+ "version": "0.9.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18