mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 14:02:39 +00:00
add direction decoder
This commit is contained in:
@@ -10,4 +10,14 @@ export class PostgresDirectionEncoder implements DirectionEncoderPort {
|
||||
coordinates.map((point) => [point.lon, point.lat].join(' ')).join(),
|
||||
")'",
|
||||
].join('');
|
||||
decode = (direction: string): Coordinates[] =>
|
||||
direction
|
||||
.split('(')[1]
|
||||
.split(')')[0]
|
||||
.split(',')
|
||||
.map((coordinates) => coordinates.split(' '))
|
||||
.map((point) => ({
|
||||
lon: parseFloat(point[0]),
|
||||
lat: parseFloat(point[1]),
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user