Documentation
¶
Index ¶
- func CensusQuerySQL(ctx context.Context, args CensusQuerySQLArgs) (sql string, include []string, err error)
- func CheckOverlapsUK(coords []float64) error
- func ExtractSpecialCols(set *where.ValueSet) ([]string, *where.ValueSet, error)
- func FixGeotype(token string) (string, error)
- func MapGeotypes(set *where.ValueSet) (*where.ValueSet, error)
- func ValidateAllToken(set *where.ValueSet) error
- type CensusQuerySQLArgs
- type Chunk
- type CkmeansParser
- type Geodata
- func (app *Geodata) CKmeans(ctx context.Context, year int, cat []string, geotype []string, k int, ...) (map[string]map[string][]float64, error)
- func (app *Geodata) CKmeansRatio(ctx context.Context, year int, cat1 string, cat2 string, geotype string, k int) ([]float64, error)
- func (app *Geodata) CantabularMetrics(ctx context.Context, geocodes []string, catset *where.ValueSet, geotype string) ([]byte, error)
- func (app *Geodata) Geo(ctx context.Context, year int, geocode string, geoname string) (*Resp, error)
- func (app *Geodata) PGMetrics(ctx context.Context, year int, geocodes []string, catset *where.ValueSet, ...) ([]byte, error)
- func (app *Geodata) Query(ctx context.Context, year int, bbox, location string, radius int, ...) (string, error)
- func (app *Geodata) Query2(ctx context.Context, year int, bbox, location string, radius int, ...) ([]string, error)
- type Resp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CensusQuerySQL ¶
func CheckOverlapsUK ¶
CheckOverlapsUK validates each point in the flat coordinate list. Each point must be a valid lon/lat and the bounding box of all coordinates in the list must overlap the UK bounding box.
func ExtractSpecialCols ¶
ExtractSpecialCols removes special column names like "geography_code" from the ValueSet, returning a reduced ValueSet, and the list of special columns found.
func FixGeotype ¶
func MapGeotypes ¶
MapGeotypes changes case-insensitive geotypes given in query strings to the specific case-sensitive geotypes used in the db. For example, "lsoa" will be changed to "LSOA". Returns error if a geotype doesn't match at all.
func ValidateAllToken ¶
ValidateAllToken verifies that if there is an "ALL" specified, it is the only token.
Types ¶
type CensusQuerySQLArgs ¶
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk holds multiple catgeory data for a single geocode
type CkmeansParser ¶
type CkmeansParser struct {
// contains filtered or unexported fields
}
CkmeansParser holds data and methods neccessary to parse and process data for ckmeans queries
func NewCkmeansParser ¶
func NewCkmeansParser(divideBy string, k int) *CkmeansParser
New creates a new CkmeansParser.
type Geodata ¶
type Geodata struct {
// contains filtered or unexported fields
}
func (*Geodata) CKmeans ¶
func (app *Geodata) CKmeans(ctx context.Context, year int, cat []string, geotype []string, k int, divideBy string) (map[string]map[string][]float64, error)
CKmeans does an 'all rows' query for census data using sql generator from geodata pkg, parses the results by category and then by geotype, and gets ckmeans breaks for each geotype in each category. Optionally, if divideBy is not blank, will divide all categories by the cateogry indicated by the divideBy value, prior to getting ckmeans breaks.
func (*Geodata) CKmeansRatio ¶
func (app *Geodata) CKmeansRatio(ctx context.Context, year int, cat1 string, cat2 string, geotype string, k int) ([]float64, error)
!!!! DEPRECATED CKMEANSRATIO TO BE REMOVED WHEN FRONT END REMOVES DEPENDENCY ON IT !!!!
func (*Geodata) CantabularMetrics ¶
func (app *Geodata) CantabularMetrics(ctx context.Context, geocodes []string, catset *where.ValueSet, geotype string) ([]byte, error)
Retrieve metrics from Cantabular.
func (*Geodata) PGMetrics ¶
func (app *Geodata) PGMetrics(ctx context.Context, year int, geocodes []string, catset *where.ValueSet, include []string, censustable string) ([]byte, error)
Retrieve metrics from postgres.