pyogrio 0.8.0__cp312-cp312-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 (238) hide show
  1. pyogrio/__init__.py +48 -0
  2. pyogrio/_compat.py +41 -0
  3. pyogrio/_env.py +61 -0
  4. pyogrio/_err.cpython-312-aarch64-linux-gnu.so +0 -0
  5. pyogrio/_err.pxd +4 -0
  6. pyogrio/_err.pyx +250 -0
  7. pyogrio/_geometry.cpython-312-aarch64-linux-gnu.so +0 -0
  8. pyogrio/_geometry.pxd +4 -0
  9. pyogrio/_geometry.pyx +129 -0
  10. pyogrio/_io.cpython-312-aarch64-linux-gnu.so +0 -0
  11. pyogrio/_io.pxd +0 -0
  12. pyogrio/_io.pyx +2738 -0
  13. pyogrio/_ogr.cpython-312-aarch64-linux-gnu.so +0 -0
  14. pyogrio/_ogr.pxd +441 -0
  15. pyogrio/_ogr.pyx +346 -0
  16. pyogrio/_version.py +21 -0
  17. pyogrio/_vsi.cpython-312-aarch64-linux-gnu.so +0 -0
  18. pyogrio/_vsi.pxd +4 -0
  19. pyogrio/_vsi.pyx +140 -0
  20. pyogrio/arrow_bridge.h +115 -0
  21. pyogrio/core.py +320 -0
  22. pyogrio/errors.py +32 -0
  23. pyogrio/gdal_data/GDAL-targets-release.cmake +19 -0
  24. pyogrio/gdal_data/GDAL-targets.cmake +105 -0
  25. pyogrio/gdal_data/GDALConfig.cmake +25 -0
  26. pyogrio/gdal_data/GDALConfigVersion.cmake +85 -0
  27. pyogrio/gdal_data/GDALLogoBW.svg +138 -0
  28. pyogrio/gdal_data/GDALLogoColor.svg +126 -0
  29. pyogrio/gdal_data/GDALLogoGS.svg +126 -0
  30. pyogrio/gdal_data/LICENSE.TXT +467 -0
  31. pyogrio/gdal_data/bag_template.xml +201 -0
  32. pyogrio/gdal_data/copyright +467 -0
  33. pyogrio/gdal_data/cubewerx_extra.wkt +48 -0
  34. pyogrio/gdal_data/default.rsc +0 -0
  35. pyogrio/gdal_data/ecw_cs.wkt +1453 -0
  36. pyogrio/gdal_data/eedaconf.json +23 -0
  37. pyogrio/gdal_data/epsg.wkt +1 -0
  38. pyogrio/gdal_data/esri_StatePlane_extra.wkt +631 -0
  39. pyogrio/gdal_data/gdalicon.png +0 -0
  40. pyogrio/gdal_data/gdalinfo_output.schema.json +346 -0
  41. pyogrio/gdal_data/gdalmdiminfo_output.schema.json +321 -0
  42. pyogrio/gdal_data/gdalvrt.xsd +772 -0
  43. pyogrio/gdal_data/gfs.xsd +246 -0
  44. pyogrio/gdal_data/gml_registry.xml +117 -0
  45. pyogrio/gdal_data/gml_registry.xsd +66 -0
  46. pyogrio/gdal_data/gmlasconf.xml +169 -0
  47. pyogrio/gdal_data/gmlasconf.xsd +1066 -0
  48. pyogrio/gdal_data/grib2_center.csv +251 -0
  49. pyogrio/gdal_data/grib2_process.csv +102 -0
  50. pyogrio/gdal_data/grib2_subcenter.csv +63 -0
  51. pyogrio/gdal_data/grib2_table_4_2_0_0.csv +261 -0
  52. pyogrio/gdal_data/grib2_table_4_2_0_1.csv +261 -0
  53. pyogrio/gdal_data/grib2_table_4_2_0_13.csv +261 -0
  54. pyogrio/gdal_data/grib2_table_4_2_0_14.csv +261 -0
  55. pyogrio/gdal_data/grib2_table_4_2_0_15.csv +261 -0
  56. pyogrio/gdal_data/grib2_table_4_2_0_16.csv +261 -0
  57. pyogrio/gdal_data/grib2_table_4_2_0_17.csv +11 -0
  58. pyogrio/gdal_data/grib2_table_4_2_0_18.csv +261 -0
  59. pyogrio/gdal_data/grib2_table_4_2_0_19.csv +261 -0
  60. pyogrio/gdal_data/grib2_table_4_2_0_190.csv +261 -0
  61. pyogrio/gdal_data/grib2_table_4_2_0_191.csv +261 -0
  62. pyogrio/gdal_data/grib2_table_4_2_0_2.csv +261 -0
  63. pyogrio/gdal_data/grib2_table_4_2_0_20.csv +261 -0
  64. pyogrio/gdal_data/grib2_table_4_2_0_21.csv +261 -0
  65. pyogrio/gdal_data/grib2_table_4_2_0_3.csv +261 -0
  66. pyogrio/gdal_data/grib2_table_4_2_0_4.csv +261 -0
  67. pyogrio/gdal_data/grib2_table_4_2_0_5.csv +261 -0
  68. pyogrio/gdal_data/grib2_table_4_2_0_6.csv +261 -0
  69. pyogrio/gdal_data/grib2_table_4_2_0_7.csv +261 -0
  70. pyogrio/gdal_data/grib2_table_4_2_10_0.csv +261 -0
  71. pyogrio/gdal_data/grib2_table_4_2_10_1.csv +261 -0
  72. pyogrio/gdal_data/grib2_table_4_2_10_191.csv +261 -0
  73. pyogrio/gdal_data/grib2_table_4_2_10_2.csv +261 -0
  74. pyogrio/gdal_data/grib2_table_4_2_10_3.csv +261 -0
  75. pyogrio/gdal_data/grib2_table_4_2_10_4.csv +261 -0
  76. pyogrio/gdal_data/grib2_table_4_2_1_0.csv +261 -0
  77. pyogrio/gdal_data/grib2_table_4_2_1_1.csv +261 -0
  78. pyogrio/gdal_data/grib2_table_4_2_1_2.csv +261 -0
  79. pyogrio/gdal_data/grib2_table_4_2_20_0.csv +261 -0
  80. pyogrio/gdal_data/grib2_table_4_2_20_1.csv +261 -0
  81. pyogrio/gdal_data/grib2_table_4_2_20_2.csv +261 -0
  82. pyogrio/gdal_data/grib2_table_4_2_2_0.csv +261 -0
  83. pyogrio/gdal_data/grib2_table_4_2_2_3.csv +261 -0
  84. pyogrio/gdal_data/grib2_table_4_2_2_4.csv +261 -0
  85. pyogrio/gdal_data/grib2_table_4_2_2_5.csv +261 -0
  86. pyogrio/gdal_data/grib2_table_4_2_2_6.csv +261 -0
  87. pyogrio/gdal_data/grib2_table_4_2_3_0.csv +261 -0
  88. pyogrio/gdal_data/grib2_table_4_2_3_1.csv +261 -0
  89. pyogrio/gdal_data/grib2_table_4_2_3_2.csv +28 -0
  90. pyogrio/gdal_data/grib2_table_4_2_3_3.csv +8 -0
  91. pyogrio/gdal_data/grib2_table_4_2_3_4.csv +14 -0
  92. pyogrio/gdal_data/grib2_table_4_2_3_5.csv +11 -0
  93. pyogrio/gdal_data/grib2_table_4_2_3_6.csv +11 -0
  94. pyogrio/gdal_data/grib2_table_4_2_4_0.csv +261 -0
  95. pyogrio/gdal_data/grib2_table_4_2_4_1.csv +261 -0
  96. pyogrio/gdal_data/grib2_table_4_2_4_10.csv +261 -0
  97. pyogrio/gdal_data/grib2_table_4_2_4_2.csv +261 -0
  98. pyogrio/gdal_data/grib2_table_4_2_4_3.csv +261 -0
  99. pyogrio/gdal_data/grib2_table_4_2_4_4.csv +261 -0
  100. pyogrio/gdal_data/grib2_table_4_2_4_5.csv +261 -0
  101. pyogrio/gdal_data/grib2_table_4_2_4_6.csv +261 -0
  102. pyogrio/gdal_data/grib2_table_4_2_4_7.csv +261 -0
  103. pyogrio/gdal_data/grib2_table_4_2_4_8.csv +261 -0
  104. pyogrio/gdal_data/grib2_table_4_2_4_9.csv +261 -0
  105. pyogrio/gdal_data/grib2_table_4_2_local_Canada.csv +5 -0
  106. pyogrio/gdal_data/grib2_table_4_2_local_HPC.csv +2 -0
  107. pyogrio/gdal_data/grib2_table_4_2_local_MRMS.csv +175 -0
  108. pyogrio/gdal_data/grib2_table_4_2_local_NCEP.csv +401 -0
  109. pyogrio/gdal_data/grib2_table_4_2_local_NDFD.csv +38 -0
  110. pyogrio/gdal_data/grib2_table_4_2_local_index.csv +7 -0
  111. pyogrio/gdal_data/grib2_table_4_5.csv +261 -0
  112. pyogrio/gdal_data/grib2_table_versions.csv +3 -0
  113. pyogrio/gdal_data/gt_datum.csv +229 -0
  114. pyogrio/gdal_data/gt_ellips.csv +24 -0
  115. pyogrio/gdal_data/header.dxf +1124 -0
  116. pyogrio/gdal_data/inspire_cp_BasicPropertyUnit.gfs +57 -0
  117. pyogrio/gdal_data/inspire_cp_CadastralBoundary.gfs +60 -0
  118. pyogrio/gdal_data/inspire_cp_CadastralParcel.gfs +81 -0
  119. pyogrio/gdal_data/inspire_cp_CadastralZoning.gfs +161 -0
  120. pyogrio/gdal_data/jpfgdgml_AdmArea.gfs +59 -0
  121. pyogrio/gdal_data/jpfgdgml_AdmBdry.gfs +49 -0
  122. pyogrio/gdal_data/jpfgdgml_AdmPt.gfs +59 -0
  123. pyogrio/gdal_data/jpfgdgml_BldA.gfs +54 -0
  124. pyogrio/gdal_data/jpfgdgml_BldL.gfs +54 -0
  125. pyogrio/gdal_data/jpfgdgml_Cntr.gfs +54 -0
  126. pyogrio/gdal_data/jpfgdgml_CommBdry.gfs +49 -0
  127. pyogrio/gdal_data/jpfgdgml_CommPt.gfs +59 -0
  128. pyogrio/gdal_data/jpfgdgml_Cstline.gfs +54 -0
  129. pyogrio/gdal_data/jpfgdgml_ElevPt.gfs +54 -0
  130. pyogrio/gdal_data/jpfgdgml_GCP.gfs +94 -0
  131. pyogrio/gdal_data/jpfgdgml_LeveeEdge.gfs +49 -0
  132. pyogrio/gdal_data/jpfgdgml_RailCL.gfs +54 -0
  133. pyogrio/gdal_data/jpfgdgml_RdASL.gfs +44 -0
  134. pyogrio/gdal_data/jpfgdgml_RdArea.gfs +54 -0
  135. pyogrio/gdal_data/jpfgdgml_RdCompt.gfs +59 -0
  136. pyogrio/gdal_data/jpfgdgml_RdEdg.gfs +59 -0
  137. pyogrio/gdal_data/jpfgdgml_RdMgtBdry.gfs +49 -0
  138. pyogrio/gdal_data/jpfgdgml_RdSgmtA.gfs +59 -0
  139. pyogrio/gdal_data/jpfgdgml_RvrMgtBdry.gfs +49 -0
  140. pyogrio/gdal_data/jpfgdgml_SBAPt.gfs +49 -0
  141. pyogrio/gdal_data/jpfgdgml_SBArea.gfs +54 -0
  142. pyogrio/gdal_data/jpfgdgml_SBBdry.gfs +44 -0
  143. pyogrio/gdal_data/jpfgdgml_WA.gfs +54 -0
  144. pyogrio/gdal_data/jpfgdgml_WL.gfs +54 -0
  145. pyogrio/gdal_data/jpfgdgml_WStrA.gfs +54 -0
  146. pyogrio/gdal_data/jpfgdgml_WStrL.gfs +54 -0
  147. pyogrio/gdal_data/netcdf_config.xsd +143 -0
  148. pyogrio/gdal_data/nitf_spec.xml +3306 -0
  149. pyogrio/gdal_data/nitf_spec.xsd +189 -0
  150. pyogrio/gdal_data/ogrinfo_output.schema.json +505 -0
  151. pyogrio/gdal_data/ogrvrt.xsd +543 -0
  152. pyogrio/gdal_data/osmconf.ini +132 -0
  153. pyogrio/gdal_data/ozi_datum.csv +131 -0
  154. pyogrio/gdal_data/ozi_ellips.csv +35 -0
  155. pyogrio/gdal_data/pci_datum.txt +463 -0
  156. pyogrio/gdal_data/pci_ellips.txt +77 -0
  157. pyogrio/gdal_data/pdfcomposition.xsd +721 -0
  158. pyogrio/gdal_data/pds4_template.xml +65 -0
  159. pyogrio/gdal_data/plscenesconf.json +1985 -0
  160. pyogrio/gdal_data/ruian_vf_ob_v1.gfs +1455 -0
  161. pyogrio/gdal_data/ruian_vf_st_uvoh_v1.gfs +86 -0
  162. pyogrio/gdal_data/ruian_vf_st_v1.gfs +1489 -0
  163. pyogrio/gdal_data/ruian_vf_v1.gfs +2126 -0
  164. pyogrio/gdal_data/s57agencies.csv +249 -0
  165. pyogrio/gdal_data/s57attributes.csv +484 -0
  166. pyogrio/gdal_data/s57expectedinput.csv +1008 -0
  167. pyogrio/gdal_data/s57objectclasses.csv +287 -0
  168. pyogrio/gdal_data/seed_2d.dgn +0 -0
  169. pyogrio/gdal_data/seed_3d.dgn +0 -0
  170. pyogrio/gdal_data/stateplane.csv +259 -0
  171. pyogrio/gdal_data/template_tiles.mapml +28 -0
  172. pyogrio/gdal_data/tms_LINZAntarticaMapTileGrid.json +190 -0
  173. pyogrio/gdal_data/tms_MapML_APSTILE.json +268 -0
  174. pyogrio/gdal_data/tms_MapML_CBMTILE.json +346 -0
  175. pyogrio/gdal_data/tms_NZTM2000.json +243 -0
  176. pyogrio/gdal_data/trailer.dxf +434 -0
  177. pyogrio/gdal_data/usage +4 -0
  178. pyogrio/gdal_data/vcpkg-cmake-wrapper.cmake +23 -0
  179. pyogrio/gdal_data/vcpkg.spdx.json +264 -0
  180. pyogrio/gdal_data/vcpkg_abi_info.txt +41 -0
  181. pyogrio/gdal_data/vdv452.xml +367 -0
  182. pyogrio/gdal_data/vdv452.xsd +63 -0
  183. pyogrio/gdal_data/vicar.json +164 -0
  184. pyogrio/geopandas.py +666 -0
  185. pyogrio/proj_data/CH +22 -0
  186. pyogrio/proj_data/GL27 +23 -0
  187. pyogrio/proj_data/ITRF2000 +24 -0
  188. pyogrio/proj_data/ITRF2008 +94 -0
  189. pyogrio/proj_data/ITRF2014 +55 -0
  190. pyogrio/proj_data/copyright +34 -0
  191. pyogrio/proj_data/deformation_model.schema.json +582 -0
  192. pyogrio/proj_data/nad.lst +142 -0
  193. pyogrio/proj_data/nad27 +810 -0
  194. pyogrio/proj_data/nad83 +745 -0
  195. pyogrio/proj_data/other.extra +53 -0
  196. pyogrio/proj_data/proj-config-version.cmake +44 -0
  197. pyogrio/proj_data/proj-config.cmake +79 -0
  198. pyogrio/proj_data/proj-targets-release.cmake +19 -0
  199. pyogrio/proj_data/proj-targets.cmake +107 -0
  200. pyogrio/proj_data/proj.db +0 -0
  201. pyogrio/proj_data/proj.ini +51 -0
  202. pyogrio/proj_data/proj4-targets-release.cmake +19 -0
  203. pyogrio/proj_data/proj4-targets.cmake +107 -0
  204. pyogrio/proj_data/projjson.schema.json +1174 -0
  205. pyogrio/proj_data/triangulation.schema.json +214 -0
  206. pyogrio/proj_data/usage +4 -0
  207. pyogrio/proj_data/vcpkg.spdx.json +198 -0
  208. pyogrio/proj_data/vcpkg_abi_info.txt +27 -0
  209. pyogrio/proj_data/world +214 -0
  210. pyogrio/raw.py +871 -0
  211. pyogrio/tests/__init__.py +0 -0
  212. pyogrio/tests/conftest.py +204 -0
  213. pyogrio/tests/fixtures/README.md +89 -0
  214. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.cpg +1 -0
  215. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.dbf +0 -0
  216. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.prj +1 -0
  217. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shp +0 -0
  218. pyogrio/tests/fixtures/naturalearth_lowres/naturalearth_lowres.shx +0 -0
  219. pyogrio/tests/fixtures/sample.osm.pbf +0 -0
  220. pyogrio/tests/fixtures/test_datetime.geojson +7 -0
  221. pyogrio/tests/fixtures/test_datetime_tz.geojson +8 -0
  222. pyogrio/tests/fixtures/test_fgdb.gdb.zip +0 -0
  223. pyogrio/tests/fixtures/test_gpkg_nulls.gpkg +0 -0
  224. pyogrio/tests/fixtures/test_multisurface.gpkg +0 -0
  225. pyogrio/tests/fixtures/test_nested.geojson +18 -0
  226. pyogrio/tests/fixtures/test_ogr_types_list.geojson +12 -0
  227. pyogrio/tests/test_arrow.py +1041 -0
  228. pyogrio/tests/test_core.py +588 -0
  229. pyogrio/tests/test_geopandas_io.py +2069 -0
  230. pyogrio/tests/test_path.py +351 -0
  231. pyogrio/tests/test_raw_io.py +1404 -0
  232. pyogrio/util.py +223 -0
  233. pyogrio-0.8.0.dist-info/LICENSE +21 -0
  234. pyogrio-0.8.0.dist-info/METADATA +100 -0
  235. pyogrio-0.8.0.dist-info/RECORD +238 -0
  236. pyogrio-0.8.0.dist-info/WHEEL +5 -0
  237. pyogrio-0.8.0.dist-info/top_level.txt +1 -0
  238. pyogrio.libs/libgdal-b2fb2022.so.34.3.8.5 +0 -0
pyogrio/geopandas.py ADDED
@@ -0,0 +1,666 @@
1
+ import os
2
+
3
+ import numpy as np
4
+
5
+ from pyogrio._compat import HAS_GEOPANDAS, PANDAS_GE_15, PANDAS_GE_20, PANDAS_GE_22
6
+ from pyogrio.raw import (
7
+ DRIVERS_NO_MIXED_SINGLE_MULTI,
8
+ DRIVERS_NO_MIXED_DIMENSIONS,
9
+ read,
10
+ read_arrow,
11
+ write,
12
+ _get_write_path_driver,
13
+ )
14
+ from pyogrio.errors import DataSourceError
15
+ import warnings
16
+
17
+
18
+ def _stringify_path(path):
19
+ """
20
+ Convert path-like to a string if possible, pass-through other objects
21
+ """
22
+ if isinstance(path, str):
23
+ return path
24
+
25
+ # checking whether path implements the filesystem protocol
26
+ if hasattr(path, "__fspath__"):
27
+ return path.__fspath__()
28
+
29
+ # pass-though other objects
30
+ return path
31
+
32
+
33
+ def _try_parse_datetime(ser):
34
+ import pandas as pd # only called when pandas is known to be installed
35
+
36
+ if PANDAS_GE_22:
37
+ datetime_kwargs = dict(format="ISO8601")
38
+ elif PANDAS_GE_20:
39
+ datetime_kwargs = dict(format="ISO8601", errors="ignore")
40
+ else:
41
+ datetime_kwargs = dict(yearfirst=True)
42
+ with warnings.catch_warnings():
43
+ warnings.filterwarnings(
44
+ "ignore",
45
+ ".*parsing datetimes with mixed time zones will raise.*",
46
+ FutureWarning,
47
+ )
48
+ # pre-emptive try catch for when pandas will raise
49
+ # (can tighten the exception type in future when it does)
50
+ try:
51
+ res = pd.to_datetime(ser, **datetime_kwargs)
52
+ except Exception:
53
+ res = ser
54
+ # if object dtype, try parse as utc instead
55
+ if res.dtype == "object":
56
+ try:
57
+ res = pd.to_datetime(ser, utc=True, **datetime_kwargs)
58
+ except Exception:
59
+ pass
60
+
61
+ if res.dtype != "object":
62
+ # GDAL only supports ms precision, convert outputs to match.
63
+ # Pandas 2.0 supports datetime[ms] directly, prior versions only support [ns],
64
+ # Instead, round the values to [ms] precision.
65
+ if PANDAS_GE_20:
66
+ res = res.dt.as_unit("ms")
67
+ else:
68
+ res = res.dt.round(freq="ms")
69
+ return res
70
+
71
+
72
+ def read_dataframe(
73
+ path_or_buffer,
74
+ /,
75
+ layer=None,
76
+ encoding=None,
77
+ columns=None,
78
+ read_geometry=True,
79
+ force_2d=False,
80
+ skip_features=0,
81
+ max_features=None,
82
+ where=None,
83
+ bbox=None,
84
+ mask=None,
85
+ fids=None,
86
+ sql=None,
87
+ sql_dialect=None,
88
+ fid_as_index=False,
89
+ use_arrow=None,
90
+ arrow_to_pandas_kwargs=None,
91
+ **kwargs,
92
+ ):
93
+ """Read from an OGR data source to a GeoPandas GeoDataFrame or Pandas DataFrame.
94
+ If the data source does not have a geometry column or ``read_geometry`` is False,
95
+ a DataFrame will be returned.
96
+
97
+ Requires ``geopandas`` >= 0.8.
98
+
99
+ Parameters
100
+ ----------
101
+ path_or_buffer : pathlib.Path or str, or bytes buffer
102
+ A dataset path or URI, or raw buffer.
103
+ layer : int or str, optional (default: first layer)
104
+ If an integer is provided, it corresponds to the index of the layer
105
+ with the data source. If a string is provided, it must match the name
106
+ of the layer in the data source. Defaults to first layer in data source.
107
+ encoding : str, optional (default: None)
108
+ If present, will be used as the encoding for reading string values from
109
+ the data source. By default will automatically try to detect the native
110
+ encoding and decode to ``UTF-8``.
111
+ columns : list-like, optional (default: all columns)
112
+ List of column names to import from the data source. Column names must
113
+ exactly match the names in the data source, and will be returned in
114
+ the order they occur in the data source. To avoid reading any columns,
115
+ pass an empty list-like. If combined with ``where`` parameter, must
116
+ include columns referenced in the ``where`` expression or the data may
117
+ not be correctly read; the data source may return empty results or
118
+ raise an exception (behavior varies by driver).
119
+ read_geometry : bool, optional (default: True)
120
+ If True, will read geometry into a GeoSeries. If False, a Pandas DataFrame
121
+ will be returned instead.
122
+ force_2d : bool, optional (default: False)
123
+ If the geometry has Z values, setting this to True will cause those to
124
+ be ignored and 2D geometries to be returned
125
+ skip_features : int, optional (default: 0)
126
+ Number of features to skip from the beginning of the file before
127
+ returning features. If greater than available number of features, an
128
+ empty DataFrame will be returned. Using this parameter may incur
129
+ significant overhead if the driver does not support the capability to
130
+ randomly seek to a specific feature, because it will need to iterate
131
+ over all prior features.
132
+ max_features : int, optional (default: None)
133
+ Number of features to read from the file.
134
+ where : str, optional (default: None)
135
+ Where clause to filter features in layer by attribute values. If the data source
136
+ natively supports SQL, its specific SQL dialect should be used (eg. SQLite and
137
+ GeoPackage: `SQLITE`_, PostgreSQL). If it doesn't, the `OGRSQL WHERE`_ syntax
138
+ should be used. Note that it is not possible to overrule the SQL dialect, this
139
+ is only possible when you use the ``sql`` parameter.
140
+ Examples: ``"ISO_A3 = 'CAN'"``, ``"POP_EST > 10000000 AND POP_EST < 100000000"``
141
+ bbox : tuple of (xmin, ymin, xmax, ymax) (default: None)
142
+ If present, will be used to filter records whose geometry intersects this
143
+ box. This must be in the same CRS as the dataset. If GEOS is present
144
+ and used by GDAL, only geometries that intersect this bbox will be
145
+ returned; if GEOS is not available or not used by GDAL, all geometries
146
+ with bounding boxes that intersect this bbox will be returned.
147
+ Cannot be combined with ``mask`` keyword.
148
+ mask : Shapely geometry, optional (default: None)
149
+ If present, will be used to filter records whose geometry intersects
150
+ this geometry. This must be in the same CRS as the dataset. If GEOS is
151
+ present and used by GDAL, only geometries that intersect this geometry
152
+ will be returned; if GEOS is not available or not used by GDAL, all
153
+ geometries with bounding boxes that intersect the bounding box of this
154
+ geometry will be returned. Requires Shapely >= 2.0.
155
+ Cannot be combined with ``bbox`` keyword.
156
+ fids : array-like, optional (default: None)
157
+ Array of integer feature id (FID) values to select. Cannot be combined
158
+ with other keywords to select a subset (``skip_features``,
159
+ ``max_features``, ``where``, ``bbox``, ``mask``, or ``sql``). Note that
160
+ the starting index is driver and file specific (e.g. typically 0 for
161
+ Shapefile and 1 for GeoPackage, but can still depend on the specific
162
+ file). The performance of reading a large number of features usings FIDs
163
+ is also driver specific and depends on the value of ``use_arrow``. The order
164
+ of the rows returned is undefined. If you would like to sort based on FID, use
165
+ ``fid_as_index=True`` to have the index of the GeoDataFrame returned set to the
166
+ FIDs of the features read. If ``use_arrow=True``, the number of FIDs is limited
167
+ to 4997 for drivers with 'OGRSQL' as default SQL dialect. To read a larger
168
+ number of FIDs, set ``user_arrow=False``.
169
+ sql : str, optional (default: None)
170
+ The SQL statement to execute. Look at the sql_dialect parameter for more
171
+ information on the syntax to use for the query. When combined with other
172
+ keywords like ``columns``, ``skip_features``, ``max_features``,
173
+ ``where``, ``bbox``, or ``mask``, those are applied after the SQL query.
174
+ Be aware that this can have an impact on performance, (e.g. filtering
175
+ with the ``bbox`` or ``mask`` keywords may not use spatial indexes).
176
+ Cannot be combined with the ``layer`` or ``fids`` keywords.
177
+ sql_dialect : str, optional (default: None)
178
+ The SQL dialect the SQL statement is written in. Possible values:
179
+
180
+ - **None**: if the data source natively supports SQL, its specific SQL dialect
181
+ will be used by default (eg. SQLite and Geopackage: `SQLITE`_, PostgreSQL).
182
+ If the data source doesn't natively support SQL, the `OGRSQL`_ dialect is
183
+ the default.
184
+ - '`OGRSQL`_': can be used on any data source. Performance can suffer
185
+ when used on data sources with native support for SQL.
186
+ - '`SQLITE`_': can be used on any data source. All spatialite_
187
+ functions can be used. Performance can suffer on data sources with
188
+ native support for SQL, except for Geopackage and SQLite as this is
189
+ their native SQL dialect.
190
+
191
+ fid_as_index : bool, optional (default: False)
192
+ If True, will use the FIDs of the features that were read as the
193
+ index of the GeoDataFrame. May start at 0 or 1 depending on the driver.
194
+ use_arrow : bool, optional (default: False)
195
+ Whether to use Arrow as the transfer mechanism of the read data
196
+ from GDAL to Python (requires GDAL >= 3.6 and `pyarrow` to be
197
+ installed). When enabled, this provides a further speed-up.
198
+ Defaults to False, but this default can also be globally overridden
199
+ by setting the ``PYOGRIO_USE_ARROW=1`` environment variable.
200
+ arrow_to_pandas_kwargs : dict, optional (default: None)
201
+ When `use_arrow` is True, these kwargs will be passed to the `to_pandas`_
202
+ call for the arrow to pandas conversion.
203
+ **kwargs
204
+ Additional driver-specific dataset open options passed to OGR. Invalid
205
+ options will trigger a warning.
206
+
207
+ Returns
208
+ -------
209
+ GeoDataFrame or DataFrame (if no geometry is present)
210
+
211
+ .. _OGRSQL:
212
+
213
+ https://gdal.org/user/ogr_sql_dialect.html#ogr-sql-dialect
214
+
215
+ .. _OGRSQL WHERE:
216
+
217
+ https://gdal.org/user/ogr_sql_dialect.html#where
218
+
219
+ .. _SQLITE:
220
+
221
+ https://gdal.org/user/sql_sqlite_dialect.html#sql-sqlite-dialect
222
+
223
+ .. _spatialite:
224
+
225
+ https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html
226
+
227
+ .. _to_pandas:
228
+
229
+ https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table.to_pandas
230
+
231
+ """ # noqa: E501
232
+ if not HAS_GEOPANDAS:
233
+ raise ImportError("geopandas is required to use pyogrio.read_dataframe()")
234
+
235
+ import pandas as pd
236
+ import geopandas as gp
237
+ from geopandas.array import from_wkb
238
+ import shapely # if geopandas is present, shapely is expected to be present
239
+
240
+ path_or_buffer = _stringify_path(path_or_buffer)
241
+
242
+ if use_arrow is None:
243
+ use_arrow = bool(int(os.environ.get("PYOGRIO_USE_ARROW", "0")))
244
+
245
+ read_func = read_arrow if use_arrow else read
246
+ gdal_force_2d = False if use_arrow else force_2d
247
+ if not use_arrow:
248
+ # For arrow, datetimes are read as is.
249
+ # For numpy IO, datetimes are read as string values to preserve timezone info
250
+ # as numpy does not directly support timezones.
251
+ kwargs["datetime_as_string"] = True
252
+ result = read_func(
253
+ path_or_buffer,
254
+ layer=layer,
255
+ encoding=encoding,
256
+ columns=columns,
257
+ read_geometry=read_geometry,
258
+ force_2d=gdal_force_2d,
259
+ skip_features=skip_features,
260
+ max_features=max_features,
261
+ where=where,
262
+ bbox=bbox,
263
+ mask=mask,
264
+ fids=fids,
265
+ sql=sql,
266
+ sql_dialect=sql_dialect,
267
+ return_fids=fid_as_index,
268
+ **kwargs,
269
+ )
270
+
271
+ if use_arrow:
272
+ meta, table = result
273
+
274
+ # split_blocks and self_destruct decrease memory usage, but have as side effect
275
+ # that accessing table afterwards causes crash, so del table to avoid.
276
+ kwargs = {"self_destruct": True}
277
+ if arrow_to_pandas_kwargs is not None:
278
+ kwargs.update(arrow_to_pandas_kwargs)
279
+ df = table.to_pandas(**kwargs)
280
+ del table
281
+
282
+ if fid_as_index:
283
+ df = df.set_index(meta["fid_column"])
284
+ df.index.names = ["fid"]
285
+
286
+ geometry_name = meta["geometry_name"] or "wkb_geometry"
287
+ if not fid_as_index and len(df.columns) == 0:
288
+ # Index not asked, no geometry column and no attribute columns: return empty
289
+ return pd.DataFrame()
290
+ elif geometry_name in df.columns:
291
+ wkb_values = df.pop(geometry_name)
292
+ if PANDAS_GE_15 and wkb_values.dtype != object:
293
+ # for example ArrowDtype will otherwise create numpy array with pd.NA
294
+ wkb_values = wkb_values.to_numpy(na_value=None)
295
+ df["geometry"] = from_wkb(wkb_values, crs=meta["crs"])
296
+ if force_2d:
297
+ df["geometry"] = shapely.force_2d(df["geometry"])
298
+ return gp.GeoDataFrame(df, geometry="geometry")
299
+ else:
300
+ return df
301
+
302
+ meta, index, geometry, field_data = result
303
+
304
+ columns = meta["fields"].tolist()
305
+ data = {columns[i]: field_data[i] for i in range(len(columns))}
306
+ if fid_as_index:
307
+ index = pd.Index(index, name="fid")
308
+ else:
309
+ index = None
310
+ df = pd.DataFrame(data, columns=columns, index=index)
311
+ for dtype, c in zip(meta["dtypes"], df.columns):
312
+ if dtype.startswith("datetime"):
313
+ df[c] = _try_parse_datetime(df[c])
314
+
315
+ if geometry is None or not read_geometry:
316
+ return df
317
+
318
+ geometry = from_wkb(geometry, crs=meta["crs"])
319
+
320
+ return gp.GeoDataFrame(df, geometry=geometry)
321
+
322
+
323
+ # TODO: handle index properly
324
+ def write_dataframe(
325
+ df,
326
+ path,
327
+ layer=None,
328
+ driver=None,
329
+ encoding=None,
330
+ geometry_type=None,
331
+ promote_to_multi=None,
332
+ nan_as_null=True,
333
+ append=False,
334
+ use_arrow=None,
335
+ dataset_metadata=None,
336
+ layer_metadata=None,
337
+ metadata=None,
338
+ dataset_options=None,
339
+ layer_options=None,
340
+ **kwargs,
341
+ ):
342
+ """
343
+ Write GeoPandas GeoDataFrame to an OGR file format.
344
+
345
+ Parameters
346
+ ----------
347
+ df : GeoDataFrame or DataFrame
348
+ The data to write. For attribute columns of the "object" dtype,
349
+ all values will be converted to strings to be written to the
350
+ output file, except None and np.nan, which will be set to NULL
351
+ in the output file.
352
+ path : str or io.BytesIO
353
+ path to output file on writeable file system or an io.BytesIO object to
354
+ allow writing to memory
355
+ NOTE: support for writing to memory is limited to specific drivers.
356
+ layer : str, optional (default: None)
357
+ layer name to create. If writing to memory and layer name is not
358
+ provided, it layer name will be set to a UUID4 value.
359
+ driver : string, optional (default: None)
360
+ The OGR format driver used to write the vector file. By default attempts
361
+ to infer driver from path. Must be provided to write to memory.
362
+ encoding : str, optional (default: None)
363
+ If present, will be used as the encoding for writing string values to
364
+ the file. Use with caution, only certain drivers support encodings
365
+ other than UTF-8.
366
+ geometry_type : string, optional (default: None)
367
+ By default, the geometry type of the layer will be inferred from the
368
+ data, after applying the promote_to_multi logic. If the data only contains a
369
+ single geometry type (after applying the logic of promote_to_multi), this type
370
+ is used for the layer. If the data (still) contains mixed geometry types, the
371
+ output layer geometry type will be set to "Unknown".
372
+
373
+ This parameter does not modify the geometry, but it will try to force the layer
374
+ type of the output file to this value. Use this parameter with caution because
375
+ using a non-default layer geometry type may result in errors when writing the
376
+ file, may be ignored by the driver, or may result in invalid files. Possible
377
+ values are: "Unknown", "Point", "LineString", "Polygon", "MultiPoint",
378
+ "MultiLineString", "MultiPolygon" or "GeometryCollection".
379
+ promote_to_multi : bool, optional (default: None)
380
+ If True, will convert singular geometry types in the data to their
381
+ corresponding multi geometry type for writing. By default, will convert
382
+ mixed singular and multi geometry types to multi geometry types for drivers
383
+ that do not support mixed singular and multi geometry types. If False, geometry
384
+ types will not be promoted, which may result in errors or invalid files when
385
+ attempting to write mixed singular and multi geometry types to drivers that do
386
+ not support such combinations.
387
+ nan_as_null : bool, default True
388
+ For floating point columns (float32 / float64), whether NaN values are
389
+ written as "null" (missing value). Defaults to True because in pandas
390
+ NaNs are typically used as missing value. Note that when set to False,
391
+ behaviour is format specific: some formats don't support NaNs by
392
+ default (e.g. GeoJSON will skip this property) or might treat them as
393
+ null anyway (e.g. GeoPackage).
394
+ append : bool, optional (default: False)
395
+ If True, the data source specified by path already exists, and the
396
+ driver supports appending to an existing data source, will cause the
397
+ data to be appended to the existing records in the data source. Not
398
+ supported for writing to in-memory files.
399
+ NOTE: append support is limited to specific drivers and GDAL versions.
400
+ use_arrow : bool, optional (default: False)
401
+ Whether to use Arrow as the transfer mechanism of the data to write
402
+ from Python to GDAL (requires GDAL >= 3.8 and `pyarrow` to be
403
+ installed). When enabled, this provides a further speed-up.
404
+ Defaults to False, but this default can also be globally overridden
405
+ by setting the ``PYOGRIO_USE_ARROW=1`` environment variable.
406
+ Using Arrow does not support writing an object-dtype column with
407
+ mixed types.
408
+ dataset_metadata : dict, optional (default: None)
409
+ Metadata to be stored at the dataset level in the output file; limited
410
+ to drivers that support writing metadata, such as GPKG, and silently
411
+ ignored otherwise. Keys and values must be strings.
412
+ layer_metadata : dict, optional (default: None)
413
+ Metadata to be stored at the layer level in the output file; limited to
414
+ drivers that support writing metadata, such as GPKG, and silently
415
+ ignored otherwise. Keys and values must be strings.
416
+ metadata : dict, optional (default: None)
417
+ alias of layer_metadata
418
+ dataset_options : dict, optional
419
+ Dataset creation options (format specific) passed to OGR. Specify as
420
+ a key-value dictionary.
421
+ layer_options : dict, optional
422
+ Layer creation options (format specific) passed to OGR. Specify as
423
+ a key-value dictionary.
424
+ **kwargs
425
+ Additional driver-specific dataset or layer creation options passed
426
+ to OGR. pyogrio will attempt to automatically pass those keywords
427
+ either as dataset or as layer creation option based on the known
428
+ options for the specific driver. Alternatively, you can use the
429
+ explicit `dataset_options` or `layer_options` keywords to manually
430
+ do this (for example if an option exists as both dataset and layer
431
+ option).
432
+ """
433
+ # TODO: add examples to the docstring (e.g. OGR kwargs)
434
+
435
+ if not HAS_GEOPANDAS:
436
+ raise ImportError("geopandas is required to use pyogrio.write_dataframe()")
437
+
438
+ from geopandas.array import to_wkb
439
+ import pandas as pd
440
+ from pyproj.enums import WktVersion # if geopandas is available so is pyproj
441
+
442
+ if not isinstance(df, pd.DataFrame):
443
+ raise ValueError("'df' must be a DataFrame or GeoDataFrame")
444
+
445
+ if use_arrow is None:
446
+ use_arrow = bool(int(os.environ.get("PYOGRIO_USE_ARROW", "0")))
447
+ path, driver = _get_write_path_driver(path, driver, append=append)
448
+
449
+ geometry_columns = df.columns[df.dtypes == "geometry"]
450
+ if len(geometry_columns) > 1:
451
+ raise ValueError(
452
+ "'df' must have only one geometry column. "
453
+ "Multiple geometry columns are not supported for output using OGR."
454
+ )
455
+
456
+ if len(geometry_columns) > 0:
457
+ geometry_column = geometry_columns[0]
458
+ geometry = df[geometry_column]
459
+ fields = [c for c in df.columns if not c == geometry_column]
460
+ else:
461
+ geometry_column = None
462
+ geometry = None
463
+ fields = list(df.columns)
464
+
465
+ # TODO: may need to fill in pd.NA, etc
466
+ field_data = []
467
+ field_mask = []
468
+ # dict[str, np.array(int)] special case for dt-tz fields
469
+ gdal_tz_offsets = {}
470
+ for name in fields:
471
+ col = df[name]
472
+ if isinstance(col.dtype, pd.DatetimeTZDtype):
473
+ # Deal with datetimes with timezones by passing down timezone separately
474
+ # pass down naive datetime
475
+ naive = col.dt.tz_localize(None)
476
+ values = naive.values
477
+ # compute offset relative to UTC explicitly
478
+ tz_offset = naive - col.dt.tz_convert("UTC").dt.tz_localize(None)
479
+ # Convert to GDAL timezone offset representation.
480
+ # GMT is represented as 100 and offsets are represented by adding /
481
+ # subtracting 1 for every 15 minutes different from GMT.
482
+ # https://gdal.org/development/rfc/rfc56_millisecond_precision.html#core-changes
483
+ # Convert each row offset to a signed multiple of 15m and add to GMT value
484
+ gdal_offset_representation = tz_offset // pd.Timedelta("15m") + 100
485
+ gdal_tz_offsets[name] = gdal_offset_representation.values
486
+ else:
487
+ values = col.values
488
+ if isinstance(values, pd.api.extensions.ExtensionArray):
489
+ from pandas.arrays import IntegerArray, FloatingArray, BooleanArray
490
+
491
+ if isinstance(values, (IntegerArray, FloatingArray, BooleanArray)):
492
+ field_data.append(values._data)
493
+ field_mask.append(values._mask)
494
+ else:
495
+ field_data.append(np.asarray(values))
496
+ field_mask.append(np.asarray(values.isna()))
497
+ else:
498
+ field_data.append(values)
499
+ field_mask.append(None)
500
+
501
+ # Determine geometry_type and/or promote_to_multi
502
+ if geometry_column is not None:
503
+ geometry_types_all = geometry.geom_type
504
+
505
+ if geometry_column is not None and (
506
+ geometry_type is None or promote_to_multi is None
507
+ ):
508
+ tmp_geometry_type = "Unknown"
509
+ has_z = False
510
+
511
+ # If there is data, infer layer geometry type + promote_to_multi
512
+ if not df.empty:
513
+ # None/Empty geometries sometimes report as Z incorrectly, so ignore them
514
+ has_z_arr = geometry[geometry.notna() & (~geometry.is_empty)].has_z
515
+ has_z = has_z_arr.any()
516
+ all_z = has_z_arr.all()
517
+
518
+ if driver in DRIVERS_NO_MIXED_DIMENSIONS and has_z and not all_z:
519
+ raise DataSourceError(
520
+ f"Mixed 2D and 3D coordinates are not supported by {driver}"
521
+ )
522
+
523
+ geometry_types = pd.Series(geometry_types_all.unique()).dropna().values
524
+ if len(geometry_types) == 1:
525
+ tmp_geometry_type = geometry_types[0]
526
+ if promote_to_multi and tmp_geometry_type in (
527
+ "Point",
528
+ "LineString",
529
+ "Polygon",
530
+ ):
531
+ tmp_geometry_type = f"Multi{tmp_geometry_type}"
532
+ elif len(geometry_types) == 2:
533
+ # Check if the types are corresponding multi + single types
534
+ if "Polygon" in geometry_types and "MultiPolygon" in geometry_types:
535
+ multi_type = "MultiPolygon"
536
+ elif (
537
+ "LineString" in geometry_types
538
+ and "MultiLineString" in geometry_types
539
+ ):
540
+ multi_type = "MultiLineString"
541
+ elif "Point" in geometry_types and "MultiPoint" in geometry_types:
542
+ multi_type = "MultiPoint"
543
+ else:
544
+ multi_type = None
545
+
546
+ # If they are corresponding multi + single types
547
+ if multi_type is not None:
548
+ if (
549
+ promote_to_multi is None
550
+ and driver in DRIVERS_NO_MIXED_SINGLE_MULTI
551
+ ):
552
+ promote_to_multi = True
553
+ if promote_to_multi:
554
+ tmp_geometry_type = multi_type
555
+
556
+ if geometry_type is None:
557
+ geometry_type = tmp_geometry_type
558
+ if has_z and geometry_type != "Unknown":
559
+ geometry_type = f"{geometry_type} Z"
560
+
561
+ crs = None
562
+ if geometry_column is not None and geometry.crs:
563
+ # TODO: this may need to be WKT1, due to issues
564
+ # if possible use EPSG codes instead
565
+ epsg = geometry.crs.to_epsg()
566
+ if epsg:
567
+ crs = f"EPSG:{epsg}" # noqa: E231
568
+ else:
569
+ crs = geometry.crs.to_wkt(WktVersion.WKT1_GDAL)
570
+
571
+ if use_arrow:
572
+ import pyarrow as pa
573
+ from pyogrio.raw import write_arrow
574
+
575
+ if geometry_column is not None:
576
+ # Convert to multi type
577
+ if promote_to_multi:
578
+ import shapely
579
+
580
+ mask_points = geometry_types_all == "Point"
581
+ mask_linestrings = geometry_types_all == "LineString"
582
+ mask_polygons = geometry_types_all == "Polygon"
583
+
584
+ if mask_points.any():
585
+ geometry[mask_points] = shapely.multipoints(
586
+ np.atleast_2d(geometry[mask_points]), axis=0
587
+ )
588
+
589
+ if mask_linestrings.any():
590
+ geometry[mask_linestrings] = shapely.multilinestrings(
591
+ np.atleast_2d(geometry[mask_linestrings]), axis=0
592
+ )
593
+
594
+ if mask_polygons.any():
595
+ geometry[mask_polygons] = shapely.multipolygons(
596
+ np.atleast_2d(geometry[mask_polygons]), axis=0
597
+ )
598
+
599
+ geometry = to_wkb(geometry.values)
600
+ df = df.copy(deep=False)
601
+ # convert to plain DataFrame to avoid warning from geopandas about
602
+ # writing non-geometries to the geometry column
603
+ df = pd.DataFrame(df, copy=False)
604
+ df[geometry_column] = geometry
605
+
606
+ table = pa.Table.from_pandas(df, preserve_index=False)
607
+
608
+ if geometry_column is not None:
609
+ # ensure that the geometry column is binary (for all-null geometries,
610
+ # this could be a wrong type)
611
+ geom_field = table.schema.field(geometry_column)
612
+ if not (
613
+ pa.types.is_binary(geom_field.type)
614
+ or pa.types.is_large_binary(geom_field.type)
615
+ ):
616
+ table = table.set_column(
617
+ table.schema.get_field_index(geometry_column),
618
+ geom_field.with_type(pa.binary()),
619
+ table[geometry_column].cast(pa.binary()),
620
+ )
621
+
622
+ write_arrow(
623
+ table,
624
+ path,
625
+ layer=layer,
626
+ driver=driver,
627
+ geometry_name=geometry_column,
628
+ geometry_type=geometry_type,
629
+ crs=crs,
630
+ encoding=encoding,
631
+ append=append,
632
+ dataset_metadata=dataset_metadata,
633
+ layer_metadata=layer_metadata,
634
+ metadata=metadata,
635
+ dataset_options=dataset_options,
636
+ layer_options=layer_options,
637
+ **kwargs,
638
+ )
639
+ return
640
+
641
+ # If there is geometry data, prepare it to be written
642
+ if geometry_column is not None:
643
+ geometry = to_wkb(geometry.values)
644
+
645
+ write(
646
+ path,
647
+ layer=layer,
648
+ driver=driver,
649
+ geometry=geometry,
650
+ field_data=field_data,
651
+ field_mask=field_mask,
652
+ fields=fields,
653
+ crs=crs,
654
+ geometry_type=geometry_type,
655
+ encoding=encoding,
656
+ promote_to_multi=promote_to_multi,
657
+ nan_as_null=nan_as_null,
658
+ append=append,
659
+ dataset_metadata=dataset_metadata,
660
+ layer_metadata=layer_metadata,
661
+ metadata=metadata,
662
+ dataset_options=dataset_options,
663
+ layer_options=layer_options,
664
+ gdal_tz_offsets=gdal_tz_offsets,
665
+ **kwargs,
666
+ )
pyogrio/proj_data/CH ADDED
@@ -0,0 +1,22 @@
1
+ # This init file provides definitions for CH1903 and CH1903/LV03
2
+ # projections using the distortion grids developed by Swisstopo.
3
+ # See: https://shop.swisstopo.admin.ch/en/products/geo_software/GIS_info
4
+ #
5
+ # You'll need to download the grids separately and put in a directory
6
+ # scanned by libproj.
7
+ #
8
+ # Note that an independent effort was made to derive an usable grid
9
+ # from the CH1903->CH1903+ grid initially available from the Swisstopo
10
+ # website. You can read about this other effort here:
11
+ # http://lists.maptools.org/pipermail/proj/2012-February/006093.html
12
+ # It may be of interest because the latter was by some reported as being
13
+ # more accurate than the former:
14
+ # http://lists.maptools.org/pipermail/proj/2012-February/006119.html
15
+ #
16
+ # This init file uses the official one
17
+ #
18
+ <metadata> +origin=Swisstopo +lastupdate=2012-02-27
19
+ # CH1903/LV03
20
+ <1903_LV03> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=CHENyx06_ETRS.gsb +no_defs
21
+ # CH1903
22
+ <1903> +proj=longlat +ellps=bessel +nadgrids=CHENyx06_ETRS.gsb +no_defs <>