Open habrahamsson-skanetrafiken opened 2 months ago
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.