Skip to content

Commit

Permalink
[#35] coordina str function
Browse files Browse the repository at this point in the history
  • Loading branch information
machallboyd committed May 13, 2022
1 parent af2f933 commit e3ead35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mappymatch/constructs/coordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ class Coordinate(NamedTuple):
geom: Point
crs: CRS

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

def __repr__(self):
return self._string_rep()

def __str__(self):
return self._string_rep()

@classmethod
def from_lat_lon(cls, lat: float, lon: float) -> Coordinate:
"""
Expand Down
6 changes: 6 additions & 0 deletions mappymatch/constructs/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def __add__(self, other: Trace) -> Trace:
def __len__(self):
return len(self._frame)

def __repr__(self):
return(f'_frame: \n{str(self._frame)}')

def __str__(self):
return(f'_frame: \n{str(self._frame)}')

@property
def index(self) -> pd.Index:
return self._frame.index
Expand Down

0 comments on commit e3ead35

Please sign in to comment.