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{}