femtioelva

package module
v0.0.0-...-6a1454b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 16 Imported by: 0

README

femtioelva

Web experiment on top of Västtrafiks REST API.

Accumulates location of public transit and renders that information as a heatmap.

Fly.io

Deployed as femtioelva fly.io app.

Manually run flyctl deploy to release a new version.

Documentation

Index

Constants

View Source
const (
	GBG_LAT = 57.708870
	GBG_LON = 11.974560
)

Variables

View Source
var (
	// A square grid on top of Gothenburg
	BOX = GeoBox(GBG_LAT, GBG_LON, 10_000)
)
View Source
var (
	// UTM for Sweden
	UTM = wgs84.UTM(32, true)
)

Functions

func GetAccessToken

func GetAccessToken(apikey string) (string, error)

func LatLong2UTM

func LatLong2UTM(lat, long float64) (east float64, north float64)

func UTM2LatLong

func UTM2LatLong(east, north float64) (lat float64, long float64)

Types

type Box

type Box struct {
	LowLat   float64
	LowLong  float64
	HighLat  float64
	HighLong float64
	// contains filtered or unexported fields
}

func GeoBox

func GeoBox(lat, long, width float64) Box

GeoBox returns min/max long/lat for a square box with sides of width meters centered around long and lat.

type Grid

type Grid struct {
	// contains filtered or unexported fields
}

func NewGrid

func NewGrid(box Box, n int) Grid

NewGrid covering box with nxn cells.

func (Grid) At

func (g Grid) At(row, col int) int

func (Grid) Draw

func (g Grid) Draw(cell, margin int) *image.Gray

Draw grid with cell and margin pixel size as given.

func (Grid) Height

func (g Grid) Height() int

func (Grid) Incr

func (g Grid) Incr(row, col int)

func (Grid) IncrUTM

func (g Grid) IncrUTM(east, north float64)

func (Grid) Max

func (g Grid) Max() int

func (Grid) Set

func (g Grid) Set(row, col, val int)

func (Grid) String

func (g Grid) String() string

func (Grid) Width

func (g Grid) Width() int

type Vehicle

type Vehicle struct {
	// Some kind of ID.
	// Occurs across requests but other fields can be different
	// even if this is the same. Does it identify a vehicle?
	Gid string

	// "Y*1e6" in Västtrafiks API, increases north.
	Lat float64

	// "X*1e6" in Västtrafiks API, increases east.
	Long float64

	// Common name of transport.
	Name string

	// When this data was retrieved.
	Time time.Time
}

func GetVehicleLocations

func GetVehicleLocations(token string, box Box) ([]Vehicle, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL