Skip to content

Commit 11c4d09

Browse files
Add data source to geo node
1 parent 8de2cdb commit 11c4d09

File tree

6 files changed

+112
-8
lines changed

6 files changed

+112
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ __pycache__
44
build/
55
dist/
66
venv
7+
.coverage

poetry.lock

Lines changed: 101 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ black = "^22.12.0"
1818
pylint = "^2.15.10"
1919
pre-commit = "^3.0.0"
2020
pytest = "^8.0.0"
21+
coverage = "^7.10.1"
2122

2223
[build-system]
2324
requires = ["poetry-core"]

yaramo/geo_node.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ class GeoNode(ABC, BaseElement):
1616
A GeoNode is characterized by it's x and y coordinates.
1717
"""
1818

19-
def __init__(self, x, y, dbref_crs: str = "ER0", **kwargs):
19+
def __init__(self, x, y, data_source: str = "unknown", dbref_crs: str = "ER0", **kwargs):
2020
super().__init__(**kwargs)
2121
self.x = x
2222
self.y = y
23+
self.data_source = data_source
2324
self.dbref_crs = dbref_crs
2425

2526
@abstractmethod
@@ -68,7 +69,7 @@ def to_wgs84(self) -> Wgs84GeoNode:
6869

6970
def to_dbref(self) -> DbrefGeoNode:
7071
x, y = transform_wgs84_to_dbref(self.x, self.y, self.dbref_crs)
71-
return DbrefGeoNode(x, y, self.dbref_crs, uuid=self.uuid)
72+
return DbrefGeoNode(x, y, self.data_source, self.dbref_crs, uuid=self.uuid)
7273

7374
def to_euclidean(self) -> EuclideanGeoNode:
7475
return self.to_dbref().to_euclidean()
@@ -81,7 +82,7 @@ def get_distance_to_other_geo_node(self, geo_node_b: GeoNode):
8182

8283
def to_wgs84(self) -> Wgs84GeoNode:
8384
x, y = transform_dbref_to_wgs84(self.x, self.y, self.dbref_crs)
84-
return Wgs84GeoNode(x, y, self.dbref_crs, uuid=self.uuid)
85+
return Wgs84GeoNode(x, y, self.data_source, self.dbref_crs, uuid=self.uuid)
8586

8687
def to_dbref(self) -> DbrefGeoNode:
8788
return self
@@ -91,7 +92,7 @@ def to_euclidean(self) -> EuclideanGeoNode:
9192
_x_shift = 4533770.0
9293
_y_shift = 5625780.0
9394
return EuclideanGeoNode(
94-
self.x - _x_shift, self.y - _y_shift, self.dbref_crs, uuid=self.uuid
95+
self.x - _x_shift, self.y - _y_shift, self.data_source, self.dbref_crs, uuid=self.uuid
9596
)
9697

9798

@@ -119,7 +120,7 @@ def to_wgs84(self) -> Wgs84GeoNode:
119120
def to_dbref(self) -> DbrefGeoNode:
120121
_x_shift = 4533770.0
121122
_y_shift = 5625780.0
122-
return DbrefGeoNode(self.x + _x_shift, self.y + _y_shift, self.dbref_crs, uuid=self.uuid)
123+
return DbrefGeoNode(self.x + _x_shift, self.y + _y_shift, self.data_source, self.dbref_crs, uuid=self.uuid)
123124

124125
def to_euclidean(self) -> EuclideanGeoNode:
125126
return self

yaramo/track.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def _count_node_occurrences_in_edges(_node: Node):
7575
if edge.is_node_connected(next_node) and not edge == previous_edge:
7676
next_edge = edge
7777
break
78-
78+
if next_edge is None:
79+
raise ValueError("Next Edge not found.")
7980
edges_in_order.append(next_edge)
8081
next_node = next_edge.get_other_node(next_node)
8182
previous_edge = next_edge

yaramo/utils/coordinateconversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __get_proj_dbref_str(coordinate_str: str):
5757
return CRS_CR0_STRING
5858
case "DR0":
5959
return CRS_DR0_STRING
60-
case "ER0":
60+
case "ER0" | "EA0":
6161
return CRS_ERO_STRING
6262
case "FR0":
6363
return CRS_FRO_STRING

0 commit comments

Comments
 (0)