Documentation
¶
Index ¶
- Constants
- Variables
- func BBox2Geot(width, height int, bbox []float64) []float64
- func CompileWMSRegexMap() map[string]*regexp.Regexp
- func CompileWPSRegexMap() map[string]*regexp.Regexp
- func ExecuteWriteTemplateFile(w io.Writer, data interface{}, filePath string) error
- func GenerateDates(name string, start, end time.Time, stepMins time.Duration) []string
- func GenerateDatesAux(start, end time.Time, stepMins time.Duration) []string
- func GenerateDatesChirps20(start, end time.Time, stepMins time.Duration) []string
- func GenerateDatesMCD43A4(start, end time.Time, stepMins time.Duration) []string
- func GenerateDatesRegular(start, end time.Time, stepMins time.Duration) []string
- func GenerateMonthlyDates(start, end time.Time, stepMins time.Duration) []string
- func GenerateYearlyDates(start, end time.Time, stepMins time.Duration) []string
- func GetArea(wgs84Poly geo.Geometry) float64
- func GetCoordinates(params WMSParams) (float64, float64, error)
- func GetLayerIndex(params WMSParams, config *Config) (int, error)
- func NormaliseKeys(params map[string][]string) map[string][]string
- func ParsePost(rc io.ReadCloser) (map[string][]string, error)
- type CacheLevel
- type CompData
- type Config
- type Data
- type DataInputs
- type Execute
- type FileList
- type Input
- type Layer
- type LitData
- type Mask
- type Palette
- type Process
- type ServiceConfig
- type WMSParams
- type WPSParams
Constants ¶
const ISOFormat = "2006-01-02T15:04:05.000Z"
string used to format Go ISO times
const ISOZeroTime = "0001-01-01T00:00:00.000Z"
const WGS84WKT = `` /* 257-byte string literal not displayed */
Variables ¶
var DataDir = "/usr/local/share"
var EtcDir = "/usr/local/etc"
var LibexecDir = "/usr/local/libexec"
var WMSRegexpMap map[string]string = map[string]string{"service": `^WMS$`,
"request": `^GetCapabilities$|^GetFeatureInfo$|^DescribeLayer$|^GetMap$|^GetLegendGraphic$`,
"crs": `^(?i)(?:[A-Z]+):(?:[0-9]+)$`,
"bbox": `^[-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?(,[-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)?){3}$`,
"x": `^[0-9]+$`,
"y": `^[0-9]+$`,
"width": `^[0-9]+$`,
"height": `^[0-9]+$`,
"time": `^\d{4}-(?:1[0-2]|0[1-9])-(?:3[01]|0[1-9]|[12][0-9])T[0-2]\d:[0-5]\d:[0-5]\d\.\d+Z$`}
WMSRegexMap maps WMS request parameters to regular expressions for doing validation when parsing. --- These regexp do not avoid every case of --- invalid code but filter most of the malformed --- cases. Error free JSON deserialisation into types --- also validates correct values.
var WPSRegexpMap map[string]string = map[string]string{"service": `^WPS$`,
"request": `^GetCapabilities$|^DescribeProcess$|^Execute$`,
"time": `^\d{4}-(?:1[0-2]|0[1-9])-(?:3[01]|0[1-9]|[12][0-9])T[0-2]\d:[0-5]\d:[0-5]\d\.\d+Z$`}
WPSRegexMap maps WPS request parameters to regular expressions for doing validation when parsing. --- These regexp do not avoid every case of --- invalid code but filter most of the malformed --- cases. Error free JSON deserialisation into types --- also validates correct values.
Functions ¶
func BBox2Geot ¶
BBox2Geot return the geotransform from the parameters received in a WMS GetMap request
func CompileWMSRegexMap ¶
func CompileWPSRegexMap ¶
func ExecuteWriteTemplateFile ¶
General template compilation, execution and writting in to a stream.
func GenerateDates ¶
func GenerateDatesAux ¶
func GenerateDatesChirps20 ¶
func GenerateDatesMCD43A4 ¶
GenerateDates function is used to generate the list of ISO dates from its especification in the Config.Layer struct.
func GenerateDatesRegular ¶
func GenerateMonthlyDates ¶
func GenerateYearlyDates ¶
func GetCoordinates ¶
GetCoordinates returns the x and y coordinates in the original projection from the tile relative WMS parameters.
func GetLayerIndex ¶
GetLayerIndex returns the index of the specified layer inside the Config.Layers field.
Types ¶
type CacheLevel ¶
type CacheLevel struct { Path string `json:"path"` MinRes float64 `json:"min_res"` MaxRes float64 `json:"max_res"` }
DataSource contains the source files of one layer as well as the max and min resolutions it represents. Its fields encode the path to the collection and the maximum and mimum resolution that can be served. This enables the definition of different versions of the same dataset with different resolutions to speedup response times.
type CompData ¶
type CompData struct { Identifier string `json:"identifier"` Title string `json:"title"` Abstract string `json:"abstract"` MimeType string `json:"mime_type"` Encoding string `json:"encoding"` Schema string `json:"schema"` }
DataInput contains the description of a variable used to compute a WPS operation
type Config ¶
type Config struct { ServiceConfig ServiceConfig `json:"service_config"` Layers []Layer `json:"layers"` Processes []Process `json:"processes"` }
Config is the struct representing the configuration of a WMS server. It contains information about the file index API as well as the list of WMS layers that can be served.
func (*Config) LoadConfigFile ¶
GetConfig marshall the config.json document returning an instance of a Config variable containing all the values
type DataInputs ¶
type DataInputs struct {
Input Input
}
type Execute ¶
type Execute struct { Version string `xml:"version,attr"` Service string `xml:"service,attr"` Identifier string DataInputs DataInputs }
type FileList ¶
type FileList struct {
Files []string `json:"files"`
}
FileList is the struct used to unmarshal the reponse from the index API
type Layer ¶
type Layer struct { OWSHostname string `json:"ows_hostname"` Name string `json:"name"` Title string `json:"title"` Abstract string `json:"abstract"` MetadataURL string `json:"metadata_url"` DataURL string `json:"data_url"` //CacheLevels []CacheLevel `json:"cache_levels"` DataSource string `json:"data_source"` StartISODate string `json:"start_isodate"` EndISODate string `json:"end_isodate"` StepDays int `json:"step_days"` StepHours int `json:"step_hours"` StepMinutes int `json:"step_minutes"` Accum bool `json:"accum"` TimeGen string `json:"time_generator"` ResFilter *int `json:"resolution_filter"` Dates []string `json:"dates"` RGBProducts []string `json:"rgb_products"` Mask *Mask `json:"mask"` OffsetValue float64 `json:"offset_value"` ClipValue float64 `json:"clip_value"` ScaleValue float64 `json:"scale_value"` Palette *Palette `json:"palette"` LegendPath string `json:"legend_path"` ZoomLimit float64 `json:"zoom_limit"` }
Layer contains all the details that a layer needs to be published and rendered
type LitData ¶
type LitData struct { Identifier string `json:"identifier"` Title string `json:"title"` Abstract string `json:"abstract"` DataType string `json:"data_type"` DataTypeRef string `json:"data_type_ref"` AllowedValues []string `json:"allowed_values"` }
DataInput contains the description of a variable used to compute a WPS operation
type Process ¶
type Process struct { Paths []string `json:"paths"` Identifier string `json:"identifier"` Title string `json:"title"` Abstract string `json:"abstract"` MaxArea float64 `json:"max_area"` LiteralData []LitData `json:"literal_data"` ComplexData []CompData `json:"complex_data"` }
Process contains all the details that a WPS needs to be published and processed
type ServiceConfig ¶
type WMSParams ¶
type WMSParams struct { Service *string `json:"service,omitempty"` Request *string `json:"request,omitempty"` CRS *string `json:"crs,omitempty"` BBox []float64 `json:"bbox,omitempty"` Format *string `json:"format,omitempty"` X *int `json:"x,omitempty"` Y *int `json:"y,omitempty"` Height *int `json:"height,omitempty"` Width *int `json:"width,omitempty"` Time *time.Time `json:"time,omitempty"` Layers []string `json:"layers,omitempty"` Styles []string `json:"styles,omitempty"` Version *string `json:"version,omitempty"` }
WMSParams contains the serialised version of the parameters contained in a WMS request.
type WPSParams ¶
type WPSParams struct { Service *string `json:"service"` Request *string `json:"request"` Identifier *string `json:"identifier"` Product *string `json:"product"` FeatCol geo.FeatureCollection `json:"feature_collection"` }
WPSParams contains the serialised version of the parameters contained in a WPS request.