pyogrio 0.7.1__cp38-cp38-manylinux_2_28_aarch64.whl → 0.8.0__cp38-cp38-manylinux_2_28_aarch64.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 (47) hide show
  1. pyogrio/__init__.py +4 -0
  2. pyogrio/_compat.py +7 -1
  3. pyogrio/_err.cpython-38-aarch64-linux-gnu.so +0 -0
  4. pyogrio/_err.pyx +7 -3
  5. pyogrio/_geometry.cpython-38-aarch64-linux-gnu.so +0 -0
  6. pyogrio/_io.cpython-38-aarch64-linux-gnu.so +0 -0
  7. pyogrio/_io.pyx +900 -242
  8. pyogrio/_ogr.cpython-38-aarch64-linux-gnu.so +0 -0
  9. pyogrio/_ogr.pxd +65 -12
  10. pyogrio/_ogr.pyx +8 -24
  11. pyogrio/_version.py +3 -3
  12. pyogrio/_vsi.cpython-38-aarch64-linux-gnu.so +0 -0
  13. pyogrio/_vsi.pxd +4 -0
  14. pyogrio/_vsi.pyx +140 -0
  15. pyogrio/core.py +43 -44
  16. pyogrio/gdal_data/GDAL-targets-release.cmake +3 -3
  17. pyogrio/gdal_data/GDAL-targets.cmake +10 -6
  18. pyogrio/gdal_data/GDALConfigVersion.cmake +3 -3
  19. pyogrio/gdal_data/gdalinfo_output.schema.json +2 -0
  20. pyogrio/gdal_data/gdalvrt.xsd +163 -0
  21. pyogrio/gdal_data/ogrinfo_output.schema.json +12 -1
  22. pyogrio/gdal_data/vcpkg.spdx.json +25 -25
  23. pyogrio/gdal_data/vcpkg_abi_info.txt +27 -26
  24. pyogrio/geopandas.py +131 -30
  25. pyogrio/proj_data/ITRF2008 +2 -2
  26. pyogrio/proj_data/proj-config-version.cmake +2 -2
  27. pyogrio/proj_data/proj-config.cmake +2 -1
  28. pyogrio/proj_data/proj-targets.cmake +13 -13
  29. pyogrio/proj_data/proj.db +0 -0
  30. pyogrio/proj_data/proj4-targets.cmake +13 -13
  31. pyogrio/proj_data/vcpkg.spdx.json +20 -42
  32. pyogrio/proj_data/vcpkg_abi_info.txt +14 -15
  33. pyogrio/raw.py +438 -116
  34. pyogrio/tests/conftest.py +75 -6
  35. pyogrio/tests/test_arrow.py +841 -7
  36. pyogrio/tests/test_core.py +99 -7
  37. pyogrio/tests/test_geopandas_io.py +744 -119
  38. pyogrio/tests/test_path.py +22 -3
  39. pyogrio/tests/test_raw_io.py +276 -50
  40. pyogrio/util.py +41 -19
  41. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/METADATA +3 -2
  42. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/RECORD +211 -209
  43. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/WHEEL +1 -1
  44. pyogrio.libs/{libgdal-d9f9f680.so.33.3.7.2 → libgdal-b2fb2022.so.34.3.8.5} +0 -0
  45. pyogrio/tests/win32.py +0 -86
  46. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/LICENSE +0 -0
  47. {pyogrio-0.7.1.dist-info → pyogrio-0.8.0.dist-info}/top_level.txt +0 -0
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
 
pyogrio/_vsi.pxd ADDED
@@ -0,0 +1,4 @@
1
+ cdef str get_ogr_vsimem_write_path(object path_or_fp, str driver)
2
+ cdef str read_buffer_to_vsimem(bytes bytes_buffer)
3
+ cdef read_vsimem_to_buffer(str path, object out_buffer)
4
+ cdef delete_vsimem_file(str path)
pyogrio/_vsi.pyx ADDED
@@ -0,0 +1,140 @@
1
+ from io import BytesIO
2
+ from uuid import uuid4
3
+
4
+ from libc.stdlib cimport malloc, free
5
+ from libc.string cimport memcpy
6
+
7
+ from pyogrio._ogr cimport *
8
+ from pyogrio._ogr import _get_driver_metadata_item
9
+
10
+
11
+ cdef str get_ogr_vsimem_write_path(object path_or_fp, str driver):
12
+ """ Return the original path or a /vsimem/ path
13
+
14
+ If passed a io.BytesIO object, this will return a /vsimem/ path that can be
15
+ used to create a new in-memory file with an extension inferred from the driver
16
+ if possible. Path will be contained in an in-memory directory to contain
17
+ sibling files (though drivers that create sibling files are not supported for
18
+ in-memory files).
19
+
20
+ Caller is responsible for deleting the directory via delete_vsimem_file()
21
+
22
+ Parameters
23
+ ----------
24
+ path_or_fp : str or io.BytesIO object
25
+ driver : str
26
+ """
27
+
28
+ if not isinstance(path_or_fp, BytesIO):
29
+ return path_or_fp
30
+
31
+ # Create in-memory directory to contain auxiliary files
32
+ memfilename = uuid4().hex
33
+ VSIMkdir(f"/vsimem/{memfilename}".encode("UTF-8"), 0666)
34
+
35
+ # file extension is required for some drivers, set it based on driver metadata
36
+ ext = ""
37
+ recommended_ext = _get_driver_metadata_item(driver, "DMD_EXTENSIONS")
38
+ if recommended_ext is not None:
39
+ ext = "." + recommended_ext.split(" ")[0]
40
+
41
+ path = f"/vsimem/{memfilename}/{memfilename}{ext}"
42
+
43
+ # check for existing bytes
44
+ if path_or_fp.getbuffer().nbytes > 0:
45
+ raise NotImplementedError("writing to existing in-memory object is not supported")
46
+
47
+ return path
48
+
49
+
50
+ cdef str read_buffer_to_vsimem(bytes bytes_buffer):
51
+ """ Wrap the bytes (zero-copy) into an in-memory dataset
52
+
53
+ If the first 4 bytes indicate the bytes are a zip file, the returned path
54
+ will be prefixed with /vsizip/ and suffixed with .zip to enable proper
55
+ reading by GDAL.
56
+
57
+ Caller is responsible for deleting the in-memory file via delete_vsimem_file().
58
+
59
+ Parameters
60
+ ----------
61
+ bytes_buffer : bytes
62
+ """
63
+ cdef int num_bytes = len(bytes_buffer)
64
+
65
+ is_zipped = len(bytes_buffer) > 4 and bytes_buffer[:4].startswith(b"PK\x03\x04")
66
+ ext = ".zip" if is_zipped else ""
67
+
68
+ path = f"/vsimem/{uuid4().hex}{ext}"
69
+
70
+ # Create an in-memory object that references bytes_buffer
71
+ # NOTE: GDAL does not copy the contents of bytes_buffer; it must remain
72
+ # in scope through the duration of using this file
73
+ vsi_handle = VSIFileFromMemBuffer(path.encode("UTF-8"), <unsigned char *>bytes_buffer, num_bytes, 0)
74
+
75
+ if vsi_handle == NULL:
76
+ raise OSError("failed to read buffer into in-memory file")
77
+
78
+ if VSIFCloseL(vsi_handle) != 0:
79
+ raise OSError("failed to close in-memory file")
80
+
81
+ if is_zipped:
82
+ path = f"/vsizip/{path}"
83
+
84
+ return path
85
+
86
+
87
+ cdef read_vsimem_to_buffer(str path, object out_buffer):
88
+ """Copy bytes from in-memory file to buffer
89
+
90
+ This will automatically unlink the in-memory file pointed to by path; caller
91
+ is still responsible for calling delete_vsimem_file() to cleanup any other
92
+ files contained in the in-memory directory.
93
+
94
+ Parameters:
95
+ -----------
96
+ path : str
97
+ path to in-memory file
98
+ buffer : BytesIO object
99
+ """
100
+
101
+ cdef unsigned char *vsi_buffer = NULL
102
+ cdef vsi_l_offset vsi_buffer_size = 0
103
+
104
+ try:
105
+ # Take ownership of the buffer to avoid a copy; GDAL will automatically
106
+ # unlink the memory file
107
+ vsi_buffer = VSIGetMemFileBuffer(path.encode("UTF-8"), &vsi_buffer_size, 1)
108
+ if vsi_buffer == NULL:
109
+ raise RuntimeError("could not read bytes from in-memory file")
110
+
111
+ # write bytes to buffer
112
+ out_buffer.write(<bytes>vsi_buffer[:vsi_buffer_size])
113
+ # rewind to beginning to allow caller to read
114
+ out_buffer.seek(0)
115
+
116
+ finally:
117
+ if vsi_buffer != NULL:
118
+ CPLFree(vsi_buffer)
119
+
120
+
121
+ cdef delete_vsimem_file(str path):
122
+ """ Recursively delete in-memory path or directory containing path
123
+
124
+ This is used for final cleanup of an in-memory dataset, which may have been
125
+ created within a directory to contain sibling files.
126
+
127
+ Additional VSI handlers may be chained to the left of /vsimem/ in path and
128
+ will be ignored.
129
+
130
+ Parameters:
131
+ -----------
132
+ path : str
133
+ path to in-memory file
134
+ """
135
+
136
+ if "/vsimem/" not in path:
137
+ return
138
+
139
+ root = "/vsimem/" + path.split("/vsimem/")[1].split("/")[0]
140
+ VSIRmdirRecursive(root.encode("UTF-8"))
pyogrio/core.py CHANGED
@@ -1,5 +1,9 @@
1
1
  from pyogrio._env import GDALEnv
2
- from pyogrio.util import get_vsi_path, _preprocess_options_key_value, _mask_to_wkb
2
+ from pyogrio.util import (
3
+ get_vsi_path_or_buffer,
4
+ _preprocess_options_key_value,
5
+ _mask_to_wkb,
6
+ )
3
7
 
4
8
 
5
9
  with GDALEnv():
@@ -13,7 +17,6 @@ with GDALEnv():
13
17
  get_gdal_data_path as _get_gdal_data_path,
14
18
  init_gdal_data as _init_gdal_data,
15
19
  init_proj_data as _init_proj_data,
16
- remove_virtual_file,
17
20
  _register_drivers,
18
21
  _get_drivers_for_path,
19
22
  )
@@ -102,7 +105,7 @@ def list_layers(path_or_buffer, /):
102
105
 
103
106
  Parameters
104
107
  ----------
105
- path : str or pathlib.Path
108
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
106
109
 
107
110
  Returns
108
111
  -------
@@ -110,14 +113,8 @@ def list_layers(path_or_buffer, /):
110
113
  array of pairs of [<layer name>, <layer geometry type>]
111
114
  Note: geometry is `None` for nonspatial layers.
112
115
  """
113
- path, buffer = get_vsi_path(path_or_buffer)
114
116
 
115
- try:
116
- result = ogr_list_layers(path)
117
- finally:
118
- if buffer is not None:
119
- remove_virtual_file(path)
120
- return result
117
+ return ogr_list_layers(get_vsi_path_or_buffer(path_or_buffer))
121
118
 
122
119
 
123
120
  def read_bounds(
@@ -138,8 +135,7 @@ def read_bounds(
138
135
 
139
136
  Parameters
140
137
  ----------
141
- path : pathlib.Path or str
142
- data source path
138
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
143
139
  layer : int or str, optional (default: first layer)
144
140
  If an integer is provided, it corresponds to the index of the layer
145
141
  with the data source. If a string is provided, it must match the name
@@ -177,22 +173,16 @@ def read_bounds(
177
173
  bounds are ndarray of shape(4, n) containing ``xmin``, ``ymin``, ``xmax``,
178
174
  ``ymax``
179
175
  """
180
- path, buffer = get_vsi_path(path_or_buffer)
181
-
182
- try:
183
- result = ogr_read_bounds(
184
- path,
185
- layer=layer,
186
- skip_features=skip_features,
187
- max_features=max_features or 0,
188
- where=where,
189
- bbox=bbox,
190
- mask=_mask_to_wkb(mask),
191
- )
192
- finally:
193
- if buffer is not None:
194
- remove_virtual_file(path)
195
- return result
176
+
177
+ return ogr_read_bounds(
178
+ get_vsi_path_or_buffer(path_or_buffer),
179
+ layer=layer,
180
+ skip_features=skip_features,
181
+ max_features=max_features or 0,
182
+ where=where,
183
+ bbox=bbox,
184
+ mask=_mask_to_wkb(mask),
185
+ )
196
186
 
197
187
 
198
188
  def read_info(
@@ -217,9 +207,21 @@ def read_info(
217
207
  driver or if the data source is nonspatial. You can force it to be calculated using
218
208
  the ``force_total_bounds`` parameter.
219
209
 
210
+ ``fid_column`` is the name of the FID field in the data source, if the FID is
211
+ physically stored (e.g. in GPKG). If the FID is just a sequence, ``fid_column``
212
+ will be "" (e.g. ESRI Shapefile).
213
+
214
+ ``geometry_name`` is the name of the field where the main geometry is stored in the
215
+ data data source, if the field name can by customized (e.g. in GPKG). If no custom
216
+ name is supported, ``geometry_name`` will be "" (e.g. ESRI Shapefile).
217
+
218
+ ``encoding`` will be ``UTF-8`` if either the native encoding is likely to be
219
+ ``UTF-8`` or GDAL can automatically convert from the detected native encoding
220
+ to ``UTF-8``.
221
+
220
222
  Parameters
221
223
  ----------
222
- path : str or pathlib.Path
224
+ path_or_buffer : str, pathlib.Path, bytes, or file-like
223
225
  layer : [type], optional
224
226
  Name or index of layer in data source. Reads the first layer by default.
225
227
  encoding : [type], optional (default: None)
@@ -240,11 +242,14 @@ def read_info(
240
242
  A dictionary with the following keys::
241
243
 
242
244
  {
245
+ "layer_name": "<layer name>",
243
246
  "crs": "<crs>",
244
247
  "fields": <ndarray of field names>,
245
248
  "dtypes": <ndarray of field dtypes>,
246
249
  "encoding": "<encoding>",
247
- "geometry": "<geometry type>",
250
+ "fid_column": "<fid column name or "">",
251
+ "geometry_name": "<geometry column name or "">",
252
+ "geometry_type": "<geometry type>",
248
253
  "features": <feature count or -1>,
249
254
  "total_bounds": <tuple with total bounds or None>,
250
255
  "driver": "<driver>",
@@ -253,23 +258,17 @@ def read_info(
253
258
  "layer_metadata": "<dict of layer metadata or None>"
254
259
  }
255
260
  """
256
- path, buffer = get_vsi_path(path_or_buffer)
257
261
 
258
262
  dataset_kwargs = _preprocess_options_key_value(kwargs) if kwargs else {}
259
263
 
260
- try:
261
- result = ogr_read_info(
262
- path,
263
- layer=layer,
264
- encoding=encoding,
265
- force_feature_count=force_feature_count,
266
- force_total_bounds=force_total_bounds,
267
- dataset_kwargs=dataset_kwargs,
268
- )
269
- finally:
270
- if buffer is not None:
271
- remove_virtual_file(path)
272
- return result
264
+ return ogr_read_info(
265
+ get_vsi_path_or_buffer(path_or_buffer),
266
+ layer=layer,
267
+ encoding=encoding,
268
+ force_feature_count=force_feature_count,
269
+ force_total_bounds=force_total_bounds,
270
+ dataset_kwargs=dataset_kwargs,
271
+ )
273
272
 
274
273
 
275
274
  def set_gdal_config_options(options):
@@ -8,12 +8,12 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
8
8
  # Import target "GDAL::GDAL" for configuration "Release"
9
9
  set_property(TARGET GDAL::GDAL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10
10
  set_target_properties(GDAL::GDAL PROPERTIES
11
- IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libgdal.so.33.3.7.2"
12
- IMPORTED_SONAME_RELEASE "libgdal.so.33"
11
+ IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5"
12
+ IMPORTED_SONAME_RELEASE "libgdal.so.34"
13
13
  )
14
14
 
15
15
  list(APPEND _cmake_import_check_targets GDAL::GDAL )
16
- list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/libgdal.so.33.3.7.2" )
16
+ list(APPEND _cmake_import_check_files_for_GDAL::GDAL "${_IMPORT_PREFIX}/lib/libgdal.so.34.3.8.5" )
17
17
 
18
18
  # Commands beyond this point should not need to know the version.
19
19
  set(CMAKE_IMPORT_FILE_VERSION)
@@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_LESS "2.8.3")
7
7
  message(FATAL_ERROR "CMake >= 2.8.3 required")
8
8
  endif()
9
9
  cmake_policy(PUSH)
10
- cmake_policy(VERSION 2.8.3...3.25)
10
+ cmake_policy(VERSION 2.8.3...3.27)
11
11
  #----------------------------------------------------------------
12
12
  # Generated CMake target import file.
13
13
  #----------------------------------------------------------------
@@ -74,9 +74,12 @@ set(_IMPORT_PREFIX)
74
74
 
75
75
  # Loop over all imported files and verify that they actually exist
76
76
  foreach(_cmake_target IN LISTS _cmake_import_check_targets)
77
- foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
78
- if(NOT EXISTS "${_cmake_file}")
79
- message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
77
+ if(CMAKE_VERSION VERSION_LESS "3.28"
78
+ OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
79
+ OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
80
+ foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
81
+ if(NOT EXISTS "${_cmake_file}")
82
+ message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
80
83
  \"${_cmake_file}\"
81
84
  but this file does not exist. Possible reasons include:
82
85
  * The file was deleted, renamed, or moved to another location.
@@ -85,8 +88,9 @@ but this file does not exist. Possible reasons include:
85
88
  \"${CMAKE_CURRENT_LIST_FILE}\"
86
89
  but not all the files it references.
87
90
  ")
88
- endif()
89
- endforeach()
91
+ endif()
92
+ endforeach()
93
+ endif()
90
94
  unset(_cmake_file)
91
95
  unset("_cmake_import_check_files_for_${_cmake_target}")
92
96
  endforeach()
@@ -10,13 +10,13 @@
10
10
  # The variable CVF_VERSION must be set before calling configure_file().
11
11
 
12
12
 
13
- set(PACKAGE_VERSION "3.7.2")
13
+ set(PACKAGE_VERSION "3.8.5")
14
14
 
15
15
  if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
16
16
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
17
17
  else()
18
18
 
19
- if("3.7.2" MATCHES "^([0-9]+)\\.([0-9]+)")
19
+ if("3.8.5" MATCHES "^([0-9]+)\\.([0-9]+)")
20
20
  set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
21
21
  set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
22
22
 
@@ -27,7 +27,7 @@ else()
27
27
  string(REGEX REPLACE "^0+" "" CVF_VERSION_MINOR "${CVF_VERSION_MINOR}")
28
28
  endif()
29
29
  else()
30
- set(CVF_VERSION_MAJOR "3.7.2")
30
+ set(CVF_VERSION_MAJOR "3.8.5")
31
31
  set(CVF_VERSION_MINOR "")
32
32
  endif()
33
33
 
@@ -176,6 +176,7 @@
176
176
  }
177
177
  },
178
178
  "size": {
179
+ "$comment": "note that the order of items in side is width,height",
179
180
  "$ref": "#/definitions/arrayOfTwoIntegers"
180
181
  },
181
182
  "coordinateSystem": {
@@ -306,6 +307,7 @@
306
307
  },
307
308
 
308
309
  "proj:shape": {
310
+ "$comment": "note that the order of items in proj:shape is height,width starting with GDAL 3.8.5 (previous versions ordered it wrongly as width,height)",
309
311
  "title": "Shape",
310
312
  "type": "array",
311
313
  "minItems": 2,