crskit 0.5.0__cp313-cp313-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.
crskit/__init__.py ADDED
@@ -0,0 +1,114 @@
1
+ """CrsKit: coordinate reference systems and coordinate transformations.
2
+
3
+ An OGC Coordinate Transformation Services implementation backed by the EPSG Geodetic
4
+ Parameter Dataset, with WKT 1 (OGC and ESRI) and WKT 2 (2015 and 2019) support.
5
+
6
+ >>> import crskit
7
+ >>> crskit.init() # with crskit-epsg installed
8
+ >>> etrs89 = crskit.crs_from_epsg(4258) # geographic, lat/lon
9
+ >>> utm30n = crskit.crs_from_epsg(25830) # projected
10
+ >>> crskit.transformation(etrs89, utm30n).transform([40.4, -3.7])
11
+
12
+ Inside a host application that embeds Python and already uses CrsKit, the module binds to the
13
+ library the application has already loaded and shares its state: is_initialized() is then already
14
+ True and init() need not be called.
15
+ """
16
+
17
+
18
+ # start delvewheel patch
19
+ def _delvewheel_patch_1_13_0():
20
+ import os
21
+ if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'crskit.libs'))):
22
+ os.add_dll_directory(libs_dir)
23
+
24
+
25
+ _delvewheel_patch_1_13_0()
26
+ del _delvewheel_patch_1_13_0
27
+ # end delvewheel patch
28
+
29
+ import os
30
+ import sys
31
+ from pathlib import Path
32
+
33
+ # Windows does not search the module's own folder for the DLLs it imports, and crskit.dll ships
34
+ # right next to _crskit.pyd inside this package. If the host process already has crskit.dll loaded
35
+ # (an application embedding Python), the loader reuses that one and this directory is not consulted.
36
+ if sys.platform == "win32":
37
+ os.add_dll_directory(str(Path(__file__).parent))
38
+
39
+ from ._crskit import (
40
+ AuthorityCodeNotFoundError,
41
+ CoordinateOperation,
42
+ CoordinateOutsideDomainError,
43
+ Crs,
44
+ CrsError,
45
+ DimensionMismatchError,
46
+ GridFileNotFoundError,
47
+ Transformation,
48
+ TransformationNotFoundError,
49
+ UnknownCrsPolicy,
50
+ UnsupportedFormatError,
51
+ WktParseError,
52
+ WktVersion,
53
+ compound_crs,
54
+ crs_from_epsg,
55
+ crs_from_wkt,
56
+ epsg_version,
57
+ is_initialized,
58
+ transformation,
59
+ )
60
+ from ._crskit import init as _init
61
+
62
+
63
+ def _find_epsg_database() -> Path:
64
+ """The EPSG database to use when init() is given none: the environment, then the data package."""
65
+ if environment := os.environ.get("DIGI21_EPSG_SQLITE"):
66
+ return Path(environment)
67
+
68
+ try:
69
+ import crskit_epsg
70
+ except ImportError:
71
+ raise CrsError(
72
+ "no EPSG database: install one with `pip install crskit[epsg]`, set DIGI21_EPSG_SQLITE, "
73
+ "or pass the path to init()."
74
+ ) from None
75
+
76
+ return crskit_epsg.database_path()
77
+
78
+
79
+ def init(
80
+ epsg_database: os.PathLike[str] | str | None = None,
81
+ data_directory: os.PathLike[str] | str | None = None,
82
+ ) -> None:
83
+ """Initialises the library against an EPSG SQLite database.
84
+
85
+ With no arguments the database is looked up in the DIGI21_EPSG_SQLITE environment variable and
86
+ then in the crskit-epsg package, so `pip install crskit[epsg]` needs no path at all.
87
+
88
+ data_directory is where grid files (geoids, NTv2, NADCON) are looked up; it defaults to the
89
+ folder holding the database.
90
+ """
91
+ _init(epsg_database if epsg_database is not None else _find_epsg_database(), data_directory)
92
+
93
+ __all__ = [
94
+ "AuthorityCodeNotFoundError",
95
+ "CoordinateOperation",
96
+ "CoordinateOutsideDomainError",
97
+ "Crs",
98
+ "CrsError",
99
+ "DimensionMismatchError",
100
+ "GridFileNotFoundError",
101
+ "Transformation",
102
+ "TransformationNotFoundError",
103
+ "UnknownCrsPolicy",
104
+ "UnsupportedFormatError",
105
+ "WktParseError",
106
+ "WktVersion",
107
+ "compound_crs",
108
+ "crs_from_epsg",
109
+ "crs_from_wkt",
110
+ "epsg_version",
111
+ "init",
112
+ "is_initialized",
113
+ "transformation",
114
+ ]
Binary file
crskit/_crskit.pyi ADDED
@@ -0,0 +1,207 @@
1
+ """Type stubs for the compiled module.
2
+
3
+ Generated with `python -m pybind11_stubgen crskit._crskit` and then corrected by hand, because the
4
+ generator cannot see through the C++ signatures: it types anything that returns py::object as Any
5
+ (authority_code is int | None, not Any) and the axis list as a bare list.
6
+ """
7
+
8
+ import os
9
+ from collections.abc import Callable, Sequence
10
+ from typing import Any, ClassVar, SupportsFloat, SupportsIndex, SupportsInt
11
+
12
+ import numpy
13
+ import numpy.typing
14
+
15
+ __all__: list[str]
16
+
17
+ SelectOperation = Callable[[str, str, list["CoordinateOperation"]], "CoordinateOperation | int"]
18
+
19
+ class CrsError(RuntimeError):
20
+ """Base of every error the library raises."""
21
+
22
+ class AuthorityCodeNotFoundError(CrsError): ...
23
+ class CoordinateOutsideDomainError(CrsError): ...
24
+ class DimensionMismatchError(CrsError): ...
25
+ class TransformationNotFoundError(CrsError): ...
26
+ class UnsupportedFormatError(CrsError): ...
27
+ class WktParseError(CrsError): ...
28
+
29
+ class GridFileNotFoundError(CrsError):
30
+ """A grid file (geoid, NTv2, NADCON) a coordinate operation needs is not in the data directory."""
31
+
32
+ grid_file: str
33
+ searched_path: str
34
+ operation_code: int | None
35
+ operation_name: str
36
+ area_of_use: str
37
+ information_source: str
38
+
39
+ class WktVersion:
40
+ """The Well-Known Text flavour to_wkt() emits."""
41
+
42
+ WKT1: ClassVar[WktVersion]
43
+ """OGC 01-009 (Simple Features)."""
44
+ WKT1_ESRI: ClassVar[WktVersion]
45
+ """ESRI WKT 1, without the EPSG authority code."""
46
+ WKT1_ESRI_WITH_EPSG_CODE: ClassVar[WktVersion]
47
+ """ESRI WKT 1, with the EPSG authority code."""
48
+ WKT2_2015: ClassVar[WktVersion]
49
+ """ISO 19162:2015 / OGC 12-063r5."""
50
+ WKT2_2019: ClassVar[WktVersion]
51
+ """ISO 19162:2019 / OGC 18-010r7."""
52
+
53
+ __members__: ClassVar[dict[str, WktVersion]]
54
+
55
+ def __init__(self, value: SupportsInt | SupportsIndex) -> None: ...
56
+ def __eq__(self, other: object) -> bool: ...
57
+ def __hash__(self) -> int: ...
58
+ def __index__(self) -> int: ...
59
+ def __int__(self) -> int: ...
60
+ @property
61
+ def name(self) -> str: ...
62
+ @property
63
+ def value(self) -> int: ...
64
+
65
+ class UnknownCrsPolicy:
66
+ """What to do when exactly one of the two systems is local or unknown."""
67
+
68
+ REJECT: ClassVar[UnknownCrsPolicy]
69
+ IDENTITY: ClassVar[UnknownCrsPolicy]
70
+
71
+ __members__: ClassVar[dict[str, UnknownCrsPolicy]]
72
+
73
+ def __init__(self, value: SupportsInt | SupportsIndex) -> None: ...
74
+ def __eq__(self, other: object) -> bool: ...
75
+ def __hash__(self) -> int: ...
76
+ def __index__(self) -> int: ...
77
+ def __int__(self) -> int: ...
78
+ @property
79
+ def name(self) -> str: ...
80
+ @property
81
+ def value(self) -> int: ...
82
+
83
+ class CoordinateOperation:
84
+ """An EPSG coordinate operation: one of the ways to get from one system to another."""
85
+
86
+ @property
87
+ def code(self) -> int: ...
88
+ @property
89
+ def name(self) -> str: ...
90
+ @property
91
+ def accuracy(self) -> float | None:
92
+ """The accuracy in metres, or None when EPSG does not state one."""
93
+
94
+ @property
95
+ def area_of_use(self) -> str:
96
+ """The geographic extent the operation is valid in."""
97
+
98
+ @property
99
+ def grid_files(self) -> list[str]:
100
+ """The grid file(s) the operation needs, empty when it needs none."""
101
+
102
+ @property
103
+ def scope(self) -> str | None: ...
104
+ @property
105
+ def remarks(self) -> str | None: ...
106
+ @property
107
+ def information_source(self) -> str | None: ...
108
+ def __repr__(self) -> str: ...
109
+
110
+ class Crs:
111
+ """A coordinate reference system. Build one with crs_from_epsg() or crs_from_wkt()."""
112
+
113
+ __hash__: ClassVar[None] # structural equality has no cheap, consistent hash
114
+
115
+ @property
116
+ def name(self) -> str: ...
117
+ @property
118
+ def authority(self) -> str: ...
119
+ @property
120
+ def authority_code(self) -> int | None:
121
+ """The authority code (the EPSG code), or None when the system carries none."""
122
+
123
+ @property
124
+ def dimension(self) -> int: ...
125
+ @property
126
+ def remarks(self) -> str: ...
127
+ @property
128
+ def axes(self) -> list[tuple[str, str]]:
129
+ """The axes, as (name, orientation) pairs in axis order."""
130
+
131
+ def to_wkt(self, version: WktVersion = ...) -> str:
132
+ """The system's Well-Known Text in the requested flavour."""
133
+
134
+ def compare(self, other: Crs) -> int:
135
+ """Graded structural similarity with another system, 0..100 (100 == equivalent)."""
136
+
137
+ def __eq__(self, other: object) -> bool:
138
+ """Structural equivalence: same mathematical definition, ignoring name, authority and axis order."""
139
+
140
+ def __repr__(self) -> str: ...
141
+
142
+ class Transformation:
143
+ """A coordinate transformation between two systems. Build one with transformation()."""
144
+
145
+ @property
146
+ def name(self) -> str: ...
147
+ @property
148
+ def authority(self) -> str: ...
149
+ @property
150
+ def authority_code(self) -> str | None:
151
+ """The EPSG code of the coordinate operation, or None when it is not one."""
152
+
153
+ @property
154
+ def area_of_use(self) -> str: ...
155
+ @property
156
+ def remarks(self) -> str: ...
157
+ @property
158
+ def source(self) -> Crs: ...
159
+ @property
160
+ def target(self) -> Crs: ...
161
+ @property
162
+ def source_dimension(self) -> int: ...
163
+ @property
164
+ def target_dimension(self) -> int: ...
165
+ @property
166
+ def is_identity(self) -> bool: ...
167
+ def transform(self, point: Sequence[SupportsFloat | SupportsIndex]) -> list[float]:
168
+ """Transforms a single point, given as a sequence of coordinates."""
169
+
170
+ def transform_points(self, points: numpy.typing.ArrayLike) -> numpy.typing.NDArray[numpy.float64]:
171
+ """Transforms a NumPy array of points, of shape (source_dimension,) or (n, source_dimension)."""
172
+
173
+ def __repr__(self) -> str: ...
174
+
175
+ def init(
176
+ epsg_database: os.PathLike[str] | str,
177
+ data_directory: os.PathLike[str] | str | None = None,
178
+ ) -> None:
179
+ """Initialises the library against an EPSG SQLite database."""
180
+
181
+ def is_initialized() -> bool:
182
+ """Whether the library already has an EPSG database (the host application may have set it)."""
183
+
184
+ def epsg_version() -> str:
185
+ """The EPSG Geodetic Parameter Dataset version of the active database (e.g. '12.057')."""
186
+
187
+ def crs_from_epsg(code: SupportsInt | SupportsIndex) -> Crs:
188
+ """The coordinate reference system with this EPSG code."""
189
+
190
+ def crs_from_wkt(wkt: str) -> Crs:
191
+ """The coordinate reference system described by this Well-Known Text (WKT 1 or WKT 2)."""
192
+
193
+ def compound_crs(horizontal: SupportsInt | SupportsIndex, vertical: SupportsInt | SupportsIndex) -> Crs:
194
+ """A compound CRS from the EPSG codes of a horizontal and a vertical system."""
195
+
196
+ def transformation(
197
+ source: Crs,
198
+ target: Crs,
199
+ *,
200
+ select_operation: SelectOperation | None = None,
201
+ unknown_crs_policy: UnknownCrsPolicy = ...,
202
+ ) -> Transformation:
203
+ """The transformation from one coordinate reference system to another.
204
+
205
+ When EPSG defines several operations between the two systems, select_operation chooses; without
206
+ it, an ambiguous pair raises TransformationNotFoundError.
207
+ """
crskit/crskit.dll ADDED
Binary file
crskit/py.typed ADDED
File without changes
@@ -0,0 +1,2 @@
1
+ Version: 1.13.0
2
+ Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-d3861lfx\\cp313-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '--exclude', 'crskit.dll', '--no-mangle-all', '--add-path', 'C:\\Windows\\System32', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-d3861lfx\\cp313-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-d3861lfx\\cp313-win_amd64\\built_wheel\\crskit-0.5.0-cp313-cp313-win_amd64.whl']
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: crskit
3
+ Version: 0.5.0
4
+ Summary: Coordinate reference systems and coordinate transformations (OGC Coordinate Transformation Services, EPSG, WKT 1 and WKT 2)
5
+ Keywords: EPSG,CRS,WKT,coordinate,transformation,projection,geodesy,GIS
6
+ Author-Email: José Ángel Martínez Torres <joseangelmt@outlook.com>
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Programming Language :: C++
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: GIS
14
+ Project-URL: Homepage, https://github.com/digi21/crskit
15
+ Project-URL: Repository, https://github.com/digi21/crskit
16
+ Requires-Python: >=3.10
17
+ Provides-Extra: epsg
18
+ Requires-Dist: crskit-epsg; extra == "epsg"
19
+ Provides-Extra: numpy
20
+ Requires-Dist: numpy>=1.23; extra == "numpy"
21
+ Description-Content-Type: text/markdown
22
+
23
+ # CrsKit for Python
24
+
25
+ Coordinate reference systems, Well-Known Text and coordinate transformations, backed by the full
26
+ EPSG catalogue. A thin binding over [CrsKit](https://github.com/digi21/crskit), a C++23
27
+ implementation of the OGC *Coordinate Transformation Services* model, conformance-tested against the
28
+ IOGP **GIGS** series.
29
+
30
+ ```bash
31
+ pip install crskit[epsg]
32
+ ```
33
+
34
+ ## Getting started
35
+
36
+ The `[epsg]` extra brings the EPSG catalogue with it, so `init()` needs no path — it finds the
37
+ database on its own:
38
+
39
+ ```python
40
+ import crskit
41
+
42
+ crskit.init()
43
+
44
+ etrs89 = crskit.crs_from_epsg(4258) # ETRS89, geographic 2D (latitude, longitude)
45
+ utm30n = crskit.crs_from_epsg(25830) # ETRS89 / UTM zone 30N (easting, northing)
46
+
47
+ madrid = crskit.transformation(etrs89, utm30n).transform([40.416775, -3.703790])
48
+ print(madrid) # [440291.2843479216, 4474254.600145094]
49
+ ```
50
+
51
+ Coordinates are given in the axis order the CRS declares — EPSG 4258 is *latitude, longitude*, not
52
+ the other way round. Ask the system if you are unsure:
53
+
54
+ ```python
55
+ >>> etrs89.axes
56
+ [('Lat', 'North'), ('Lon', 'East')]
57
+ >>> utm30n.axes
58
+ [('E', 'East'), ('N', 'North')]
59
+ ```
60
+
61
+ ## Transforming many points
62
+
63
+ `transform_points()` takes a NumPy array of shape `(n, source_dimension)` and crosses into C++ once
64
+ for the whole batch, releasing the GIL while it works — the path to use for point clouds:
65
+
66
+ ```python
67
+ import numpy as np
68
+
69
+ points = np.array([[40.416775, -3.703790], # Madrid
70
+ [41.385064, 2.173404], # Barcelona
71
+ [37.389092, -5.984459]]) # Sevilla
72
+
73
+ transformation = crskit.transformation(etrs89, utm30n)
74
+ projected = transformation.transform_points(points) # -> (3, 2) array
75
+ ```
76
+
77
+ NumPy is optional: `transform()` works with any sequence of floats, and the module imports without it.
78
+
79
+ ## Coordinate reference systems
80
+
81
+ Build a CRS from an EPSG code or from Well-Known Text (WKT 1 and WKT 2 are both understood; the
82
+ grammar is detected from the text):
83
+
84
+ ```python
85
+ crs = crskit.crs_from_wkt(open("layer.prj").read())
86
+
87
+ crs.name # 'ETRS89 / UTM zone 30N'
88
+ crs.authority_code # 25830, or None when the WKT carries no authority
89
+ crs.dimension # 2
90
+ crs.remarks
91
+ ```
92
+
93
+ Emit WKT in any of the flavours the library supports:
94
+
95
+ ```python
96
+ crs.to_wkt() # OGC WKT 1 (the default)
97
+ crs.to_wkt(crskit.WktVersion.WKT2_2019) # ISO 19162:2019
98
+ crs.to_wkt(crskit.WktVersion.WKT1_ESRI) # ESRI dialect, for a .prj ArcGIS will read
99
+ ```
100
+
101
+ Two systems compare by their **mathematical definition**, not by their name or authority: `==` asks
102
+ "are these the same CRS for transformation purposes?", ignoring naming and axis order.
103
+
104
+ ```python
105
+ >>> crskit.crs_from_wkt(utm30n.to_wkt()) == utm30n
106
+ True
107
+ >>> etrs89.compare(utm30n) # graded similarity, 0..100
108
+ 0
109
+ ```
110
+
111
+ ## Choosing between coordinate operations
112
+
113
+ Between two datums there is rarely a single transformation. EPSG defines **twelve** from ED50 to
114
+ ETRS89, differing in accuracy, in the area they are valid in, and in whether they need a grid file.
115
+ Choosing for you would mean silently deciding how wrong your coordinates are, so an ambiguous pair
116
+ raises `TransformationNotFoundError` unless you say which one to use:
117
+
118
+ ```python
119
+ def for_mainland_spain(source_name, target_name, operations):
120
+ for operation in operations:
121
+ print(f"EPSG:{operation.code} {operation.accuracy} m {operation.area_of_use}")
122
+ spain = [o for o in operations if "Spain - mainland" in o.area_of_use and not o.grid_files]
123
+ return min(spain, key=lambda o: o.accuracy)
124
+
125
+ transformation = crskit.transformation(ed50, etrs89, select_operation=for_mainland_spain)
126
+ ```
127
+
128
+ ```
129
+ EPSG:15932 0.2 m Spain - mainland and Balearic Islands onshore needs SPED2ETV2.gsb
130
+ EPSG:1588 1.0 m Norway - offshore north of 65°N; Svalbard
131
+ EPSG:1628 1.0 m Gibraltar
132
+ EPSG:1632 1.5 m Spain - mainland except northwest
133
+ EPSG:1650 2.0 m France
134
+ EPSG:5040 5.0 m Portugal - mainland - onshore
135
+ ...
136
+ ```
137
+
138
+ Each candidate tells you its `code`, `accuracy` in metres, `area_of_use`, `grid_files` and
139
+ `information_source` — enough to choose by geography and not only by the smallest number.
140
+
141
+ ## Heights above sea level
142
+
143
+ A GNSS receiver gives an *ellipsoidal* height, which is not the altitude anyone means. Turning it
144
+ into an orthometric height takes a geoid model. Pair a horizontal system with a vertical one and
145
+ transform in 3D:
146
+
147
+ ```python
148
+ etrs89_3d = crskit.crs_from_epsg(4937) # latitude, longitude, ellipsoidal height
149
+ utm_over_sea_level = crskit.compound_crs(25830, 5782) # UTM 30N + Alicante height
150
+
151
+ crskit.transformation(etrs89_3d, utm_over_sea_level).transform([40.416775, -3.703790, 700.0])
152
+ # [440291.284, 4474254.600, 648.888] <- 51.112 m of geoid undulation over Madrid
153
+ ```
154
+
155
+ Or transform straight to a vertical CRS, and get the point back with only its height changed —
156
+ EGM2008 (EPSG 3855) is the global model, so this works anywhere:
157
+
158
+ ```python
159
+ to_egm2008 = crskit.transformation(crskit.crs_from_epsg(4979), crskit.crs_from_epsg(3855),
160
+ select_operation=lambda source, target, ops: ops[0])
161
+
162
+ to_egm2008.transform([27.988056, 86.925278, 8820.43]) # Everest, ellipsoidal height
163
+ # [27.988056, 86.925278, 8848.86] <- the orthometric height everyone knows
164
+ ```
165
+
166
+ ## When a transformation needs a grid
167
+
168
+ Datum shifts and orthometric heights often need a grid file (a geoid model, an NTv2 grid) that
169
+ cannot be redistributed with the software. When one is missing, the error tells you exactly which
170
+ file to obtain and for which EPSG operation:
171
+
172
+ ```python
173
+ try:
174
+ crskit.transformation(source, target)
175
+ except crskit.GridFileNotFoundError as error:
176
+ print(error.grid_file) # 'egm08_25.gtx'
177
+ print(error.searched_path) # where it was looked for
178
+ print(error.operation_code) # the EPSG coordinate operation that needs it
179
+ print(error.information_source) # who publishes it
180
+ ```
181
+
182
+ Put the grids in the data directory (`init(..., data_directory=...)`, which defaults to the folder
183
+ holding the EPSG database) and the transformation builds.
184
+
185
+ ### Where to get the grids
186
+
187
+ Grid files belong to the agencies that publish them, so they are not shipped with CrsKit. The two
188
+ you are most likely to need:
189
+
190
+ **EGM2008**, the global geoid, published by the NGA — save the file under the name EPSG gives it,
191
+ which is the name in the link:
192
+
193
+ - [`Und_min2.5x2.5_egm2008_isw=82_WGS84_TideFree`](https://digi21.blob.core.windows.net/geodetic-grids/Und_min2.5x2.5_egm2008_isw%3D82_WGS84_TideFree) (2.5′, 149 MB) — enough for most work.
194
+ - [`Und_min1x1_egm2008_isw=82_WGS84_TideFree`](https://digi21.blob.core.windows.net/geodetic-grids/Und_min1x1_egm2008_isw%3D82_WGS84_TideFree) (1′, 933 MB) — the finer grid.
195
+
196
+ These are mirrors of the NGA files, in the little-endian layout the reader expects; the originals are
197
+ at [earth-info.nga.mil](https://earth-info.nga.mil/index.php?dir=wgs84&action=wgs84).
198
+
199
+ **Spain** — the EGM08-REDNAP geoid, which is the model EPSG uses for heights over Alicante datum:
200
+
201
+ - [`EGM08_REDNAP.txt`](https://digi21.blob.core.windows.net/geodetic-grids/EGM08_REDNAP.txt) (4 MB) — peninsula and Balearics.
202
+ - [`EGM08_REDNAP_Canarias.txt`](https://digi21.blob.core.windows.net/geodetic-grids/EGM08_REDNAP_Canarias.txt) (0.4 MB) — the Canary Islands.
203
+
204
+ The ED50↔ETRS89 NTv2 grids (`PENR2009.gsb`, `BALR2009.gsb`) come from the
205
+ [CNIG download centre](https://centrodedescargas.cnig.es/CentroDescargas/redes-geodesicas). All of
206
+ these are © *Instituto Geográfico Nacional de España*, mirrored under its CC BY 4.0-compatible
207
+ licence; the originals live at [datos-geodesia.ign.es](https://datos-geodesia.ign.es/geoide/).
208
+
209
+ `data/grid-sources.json` in the repository maps a grid name to where it can be obtained, so an
210
+ application can offer to fetch it when `GridFileNotFoundError` is raised.
211
+
212
+ Every error the library raises derives from `crskit.CrsError`, so one `except` catches them all;
213
+ `AuthorityCodeNotFoundError`, `WktParseError`, `TransformationNotFoundError`,
214
+ `DimensionMismatchError`, `CoordinateOutsideDomainError` and `UnsupportedFormatError` let you
215
+ discriminate when you care.
216
+
217
+ ## The EPSG database
218
+
219
+ The catalogue lives in its own package, [`crskit-epsg`](https://pypi.org/project/crskit-epsg/),
220
+ which the `[epsg]` extra installs. It is versioned after the dataset, not after the library, so a
221
+ newer EPSG release is `pip install -U crskit-epsg` — no new version of CrsKit needed.
222
+
223
+ `init()` looks for the database in this order: the path you pass, the `DIGI21_EPSG_SQLITE`
224
+ environment variable, and then the `crskit-epsg` package. Any SQLite built from the official EPSG
225
+ SQL scripts works — for instance one you build yourself with
226
+ [`tools/epsg-sqlite`](https://github.com/digi21/crskit/tree/main/tools/epsg-sqlite) for a version
227
+ newer than the packaged one:
228
+
229
+ ```python
230
+ crskit.init("/path/to/epsg.sqlite", data_directory="/path/to/grids")
231
+ ```
232
+
233
+ The data are the EPSG Geodetic Parameter Dataset (<https://epsg.org>), **owned by IOGP** and used
234
+ under its [Terms of Use](https://epsg.org/terms-of-use.html), which ship inside `crskit-epsg`. IOGP
235
+ provides them "as is" and does not endorse CrsKit.
236
+
237
+ ## Inside an application that embeds Python
238
+
239
+ The module links the CrsKit shared library rather than compiling it in. So when a host application
240
+ that already uses CrsKit runs a script through an embedded interpreter, the loader binds the module
241
+ to the library the application has *already* loaded, and both share its state: the EPSG catalogue
242
+ and settings are the ones the application set up, and there is nothing left to initialise.
243
+
244
+ ```python
245
+ if not crskit.is_initialized():
246
+ crskit.init()
247
+ ```
248
+
249
+ ## Learning it
250
+
251
+ - **[TUTORIAL.md](TUTORIAL.md)** — the long way in, from "what is a CRS" to geoids and point clouds.
252
+ Written for someone who knows Python and no geodesy; every output in it was produced by running the
253
+ code. Also in [español](TUTORIAL.es.md), [français](TUTORIAL.fr.md), [italiano](TUTORIAL.it.md) and
254
+ [deutsch](TUTORIAL.de.md).
255
+ - **[`examples/`](examples/)** — runnable scripts: a quick start, WKT round trips, a million points
256
+ with NumPy, choosing among candidate operations, and orthometric heights. The test suite runs them,
257
+ so they cannot rot.
258
+
259
+ ## Typing
260
+
261
+ The package ships type stubs and a `py.typed` marker (PEP 561), so editors complete the API and
262
+ `mypy` checks it, even though the module is compiled C++.
263
+
264
+ ## License
265
+
266
+ Apache-2.0. The EPSG dataset is IOGP's, used under its own terms; this product is not endorsed by
267
+ IOGP.
@@ -0,0 +1,11 @@
1
+ crskit/crskit.dll,sha256=eu-UubS1RsPe8T3oWkV3AZJiTl63l_nVNv-5ot7pjYs,1207296
2
+ crskit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ crskit/_crskit.cp313-win_amd64.pyd,sha256=IqTrIz6AlwAxk5DFKGgk0h4gMzc0JBoB1L7eS9DG_3Y,1384448
4
+ crskit/_crskit.pyi,sha256=408hQdG-x4Y1VThmwwlTdYO1asrC8J76rEQJHRwVb5w,7212
5
+ crskit/__init__.py,sha256=pjB9y3ClqM5XXJ9onGefOWrXjumg8GOdF09-P5NzFKM,3749
6
+ crskit-0.5.0.dist-info/DELVEWHEEL,sha256=ZzBid1kWSj8xXhRgbrU4rpLms8eo4-_4xVHiTmqdNas,484
7
+ crskit-0.5.0.dist-info/METADATA,sha256=5kcBAVKAXXTxLobkrq3mZ9nBD2XTgeok7BcmXqZeMLs,11498
8
+ crskit-0.5.0.dist-info/RECORD,,
9
+ crskit-0.5.0.dist-info/WHEEL,sha256=dXz53UX_wVrENU3pg7IjBHl1TfATF0jKSXtQDtrFnLw,105
10
+ crskit-0.5.0.dist-info/licenses/LICENSE,sha256=50SR7kufVBKR28DKYeC--HJ5QAcTK3XiD3jk0QraV7U,11574
11
+ crskit.libs/msvcp140.dll,sha256=fCZhTh1zOJLC3qx-JFzhFVBLHYBZLdCgGwjj5aVfico,643512
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: scikit-build-core 1.0.3
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-win_amd64
5
+
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2015-2026 Digi21 (José Ángel Martínez Torres)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
Binary file