Skip to content

Commit e3ead35

Browse files
committed
[#35] coordina str function
1 parent af2f933 commit e3ead35

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

mappymatch/constructs/coordinate.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ class Coordinate(NamedTuple):
2020
geom: Point
2121
crs: CRS
2222

23-
def __repr__(self):
23+
def _string_rep(self):
2424
crs_a = self.crs.to_authority() if self.crs else "Null"
2525
return f"Coordinate(coordinate_id={self.coordinate_id}, x={self.x}, y={self.y}, crs={crs_a})"
2626

27+
def __repr__(self):
28+
return self._string_rep()
29+
30+
def __str__(self):
31+
return self._string_rep()
32+
2733
@classmethod
2834
def from_lat_lon(cls, lat: float, lon: float) -> Coordinate:
2935
"""

mappymatch/constructs/trace.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def __add__(self, other: Trace) -> Trace:
4040
def __len__(self):
4141
return len(self._frame)
4242

43+
def __repr__(self):
44+
return(f'_frame: \n{str(self._frame)}')
45+
46+
def __str__(self):
47+
return(f'_frame: \n{str(self._frame)}')
48+
4349
@property
4450
def index(self) -> pd.Index:
4551
return self._frame.index

0 commit comments

Comments
 (0)