regular routes journeys, persistent KV to store return states, ...

This commit is contained in:
2023-04-03 20:35:12 +02:00
parent 0ae5730e7f
commit 2f536dfb19
21 changed files with 1722 additions and 1070 deletions

View File

@@ -2,7 +2,6 @@ package tiles
import (
"github.com/paulmach/orb"
"github.com/rs/zerolog/log"
)
// GridId defines the position of a tile
@@ -13,17 +12,14 @@ const tilesize float64 = 1.0
// PointGridId returns the id on the grid for a given point
func PointGridId(point orb.Point) GridId {
log.Debug().Any("Point", point).Msg("PointGridId")
width := int64(360 / tilesize)
gridid := GridId(int64((point.Lat()+90)/tilesize)*width + int64((point.Lon()+180)/tilesize))
log.Debug().Any("value", gridid).Msg("")
return gridid
}
// LineStringGridIds returns the list of ids on the grid the linestring goes through.
// In some really specific cases on tile edges, this could be unaccurate if the polyline was too much simplified
func LineStringGridIds(linestring orb.LineString) []GridId {
log.Debug().Any("Linestring", linestring).Msg("LineStringGridIds")
results := []GridId{}
gidmap := map[int64]bool{}

View File

@@ -5,7 +5,6 @@ import (
"git.coopgo.io/coopgo-platform/carpool-service/storage"
"github.com/paulmach/orb"
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
)
@@ -27,11 +26,6 @@ func NewTilesHandler(cfg *viper.Viper, persistantStorage storage.Storage) (*Tile
func (h *TilesHandler) GetTiles(driverOrPassenger string, date time.Time, points ...orb.Point) (*Tileset, error) {
dateString := date.Format("2006-01-02")
log.Debug().
Any("points", points).
Str("date", dateString).
Msg("Get Tiles")
result := Tileset{}
grid_ids := []GridId{}