You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Different parts of the OTP code base are using different ways to represent coordinates.
These are the main ways:
WgsCoordinate - an internal value object class. Takes parameters as lat, lon.
jts Coordinate class. Takes parameters as x, y.
Unstructured lat, lon values.
Unstructured x, y values. Here x = longitude and y = latitude.
Using unstructured x, y and lat, long values are a bit error prone since it is easy to get the order wrong. At the call site it's not obvious which of these is the correct: new Vertex(lat, lon) or new Vertex(lon, lat) since it depends on if the Vertex class operates on x, y or on lat, lon.
Goal / high level use-case
Treating coordinates in a consistent way within OTP would make code less brittle and easier to maintain.
Describe the solution you'd like
Consistently use our internal data object WgsCoordinate for representing coordinates.
Describe alternatives you've considered
We could leave the code as it is.
We could use the jts Coordinate class instead of the WgsCoordinate class.
The text was updated successfully, but these errors were encountered:
The jts Coordinate uses (x, y, z) while the WgsCoordinate only has (lat,long), all doubles. The memory footprint would be 16 + 3 x 8 vs 16 + 2 x 8 bytes. In addition there is 8 bytes for each reference. If memory is an issue, we could also change the WgsCoordinate to use integers for the lat/long - the precision is good enough. Hopefully we will be able to inline WgsCoordinate later.
Is your feature request related to a problem? Please describe.
Different parts of the OTP code base are using different ways to represent coordinates.
These are the main ways:
WgsCoordinate
- an internal value object class. Takes parameters aslat, lon
.Coordinate
class. Takes parameters asx, y
.lat, lon
values.x, y
values. Here x = longitude and y = latitude.Using unstructured x, y and lat, long values are a bit error prone since it is easy to get the order wrong. At the call site it's not obvious which of these is the correct:
new Vertex(lat, lon)
ornew Vertex(lon, lat)
since it depends on if theVertex
class operates onx, y
or onlat, lon
.Goal / high level use-case
Treating coordinates in a consistent way within OTP would make code less brittle and easier to maintain.
Describe the solution you'd like
Consistently use our internal data object
WgsCoordinate
for representing coordinates.Describe alternatives you've considered
Coordinate
class instead of theWgsCoordinate
class.The text was updated successfully, but these errors were encountered: