models

package
v0.0.0-...-6b7575b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: MIT Imports: 8 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorReadingBody = errors.New("Failed to read message body")
	ErrorNoData      = errors.New("Bad request - Missing data in body")
)

A list of errors returned from package

View Source
var (
	LegendPositionBefore = "before"
	LegendPositionAfter  = "after"
)

possible values for the 2 LegendPositions. 'None' is the default.

Functions

This section is empty.

Types

type AnalyseRequest

type AnalyseRequest struct {
	Geography    *Geography `json:"geography"`
	CSV          string     `json:"csv"`
	IDIndex      int        `json:"id_index"`
	ValueIndex   int        `json:"value_index"`
	HasHeaderRow bool       `json:"has_header_row"`
}

AnalyseRequest represents the structure of a request to analyse data and ensure it matches a topology

func CreateAnalyseRequest

func CreateAnalyseRequest(reader io.Reader) (*AnalyseRequest, error)

CreateAnalyseRequest manages the creation of an AnalyseRequest from a reader

func (*AnalyseRequest) ValidateAnalyseRequest

func (r *AnalyseRequest) ValidateAnalyseRequest() error

ValidateAnalyseRequest checks the content of the request structure

type AnalyseResponse

type AnalyseResponse struct {
	Data              []*DataRow  `json:"data"`
	Messages          []*Message  `json:"messages"`
	Breaks            [][]float64 `json:"breaks"`
	BestFitClassCount int         `json:"best_fit_class_count"`
	MinValue          float64     `json:"min_value"`
	MaxValue          float64     `json:"max_value"`
}

AnalyseResponse represents the structure of an analyse data response

type Choropleth

type Choropleth struct {
	ReferenceValue           float64            `json:"reference_value,omitempty"`
	ReferenceValueText       string             `json:"reference_value_text,omitempty"`
	ValuePrefix              string             `json:"value_prefix,omitempty"`
	ValueSuffix              string             `json:"value_suffix,omitempty"`
	Breaks                   []*ChoroplethBreak `json:"breaks,omitempty"`
	UpperBound               float64            `json:"upper_bound,omitempty"`                 // used only in displaying the upperbound in the legend
	HorizontalLegendPosition string             `json:"horizontal_legend_position, omitempty"` // before, after or none (the default)
	VerticalLegendPosition   string             `json:"vertical_legend_position, omitempty"`   // before, after or none (the default)
}

Choropleth contains details required to create a choropleth map

type ChoroplethBreak

type ChoroplethBreak struct {
	LowerBound float64 `json:"lower_bound"` // the lower bound for this colour
	Colour     string  `json:"color,omitempty"`
}

ChoroplethBreak represents a single break - the point at which a colour changes

type DataRow

type DataRow struct {
	ID    string  `json:"id,omitempty"`
	Value float64 `json:"value,omitempty"`
}

DataRow holds a single row of data.

type Geography

type Geography struct {
	Topojson     *topojson.Topology `json:"topojson,omitempty"`
	IDProperty   string             `json:"id_property,omitempty"`
	NameProperty string             `json:"name_property,omitempty"`
}

Geography holds the topojson topology and supporting information

type Message

type Message struct {
	Level string `json:"level"`
	Text  string `json:"text"`
}

Message represents a message with a level type

type RenderRequest

type RenderRequest struct {
	Title              string      `json:"title,omitempty"`
	Subtitle           string      `json:"subtitle,omitempty"`
	Source             string      `json:"source,omitempty"`
	SourceLink         string      `json:"source_link,omitempty"`
	Licence            string      `json:"licence,omitempty"`
	Filename           string      `json:"filename,omitempty"`
	Footnotes          []string    `json:"footnotes,omitempty"`
	MapType            string      `json:"map_type,omitempty"`
	Geography          *Geography  `json:"geography,omitempty"`
	Data               []*DataRow  `json:"data,omitempty"` // ID's in Data should match values of IDProperty in Geography
	Choropleth         *Choropleth `json:"choropleth,omitempty"`
	DefaultWidth       float64     `json:"width,omitempty"`     // used when determining the viewBox dimensions and the switch point between displaying the horizontal and vertical legends in responsive design. Optional if min and max width specified
	MinWidth           float64     `json:"min_width,omitempty"` // the minimum width in a responsive design. optional.
	MaxWidth           float64     `json:"max_width,omitempty"` // the maximum width in a responsive design. Required if min width specified.
	IncludeFallbackPng bool        `json:"include_fallback_png"`
	FontSize           int         `json:"font_size"`
}

RenderRequest represents a structure for a map render job

func CreateRenderRequest

func CreateRenderRequest(reader io.Reader) (*RenderRequest, error)

CreateRenderRequest manages the creation of a RenderRequest from a reader

func (*RenderRequest) ValidateRenderRequest

func (r *RenderRequest) ValidateRenderRequest() error

ValidateRenderRequest checks the content of the request structure

Jump to

Keyboard shortcuts

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