Mercurial > gemma
diff pkg/wfs/download.go @ 2622:02505fcff63c
WFS downloads: Accept 'geojson' as mime type, too.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 13 Mar 2019 15:39:12 +0100 |
parents | a8ebc785823d |
children | d7ef169fd0d3 |
line wrap: on
line diff
--- a/pkg/wfs/download.go Wed Mar 13 15:21:00 2019 +0100 +++ b/pkg/wfs/download.go Wed Mar 13 15:39:12 2019 +0100 @@ -43,6 +43,8 @@ ErrOutputFormatNotSupported = errors.New("Output format not supported") ) +var FormatGeoJSON = []string{"geojson", "application/json"} + // GetCapabilities downloads a capabilities document for a given URL. func GetCapabilities(capURL string) (*Capabilities, error) { @@ -108,8 +110,8 @@ // for a given feature type from a WFS servers. func GetFeaturesGET( caps *Capabilities, - featureTypeName, - outputFormat string, + featureTypeName string, + outputFormats []string, sortBy string, ) ([]string, error) { @@ -140,8 +142,12 @@ getU = getU.ResolveReference(base) } - if !op.SupportsOutputFormat(outputFormat) { - return nil, ErrOutputFormatNotSupported + var outputFormat string + + if len(outputFormats) > 0 { + if outputFormat = op.SupportsOutputFormat(outputFormats...); outputFormat == "" { + return nil, ErrOutputFormatNotSupported + } } wfsVersion := caps.HighestWFSVersion(WFS200)