Skip to content

Commit 23b1125

Browse files
committed
Add error_check parameter to Projector.transform() method
1 parent a2ee0c0 commit 23b1125

4 files changed

Lines changed: 219 additions & 226 deletions

File tree

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# NGI Python Coordinate Projector Package
22

3+
## Version 0.0.15
4+
_2025-09-01_
5+
6+
- Add new parameter `error_check` to the `Projector.transform()` method.
7+
If set to `True` (default is `False`), the method will raise a `ValueError` if the transformation fails instead of
8+
returning Infinity values.
39

410
## Version 0.0.14
511
_2025-08-19_

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "coordinate-projector"
3-
version = "0.0.14"
3+
version = "0.0.15"
44
description = "Project points from one projection to another using pyproj"
55
authors = [
66
{ name = "Helge Smebye" },

src/coordinate_projector/projector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def _get_transformer(from_srid: int | str, to_srid: int | str) -> Transformer:
2929

3030
return transformer
3131

32-
def transform(self, from_srid: int | str, to_srid: int | str, east: float, north: float) -> tuple[float, float]:
32+
def transform(
33+
self, from_srid: int | str, to_srid: int | str, east: float, north: float, error_check=False
34+
) -> tuple[float, float]:
3335
transformer: Transformer = self._get_transformer(from_srid, to_srid)
34-
projected_east, projected_north = transformer.transform(east, north)
36+
projected_east, projected_north = transformer.transform(east, north, errcheck=error_check)
3537
return projected_east, projected_north

0 commit comments

Comments
 (0)