Mercurial > gemma
comparison pkg/imports/fd.go @ 2721:56c8ef515d93
WFS downloader: Use new GML/GeoJSON factory function in gemma.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 19 Mar 2019 12:28:22 +0100 |
parents | 2b6f73c30016 |
children | a10022399e24 |
comparison
equal
deleted
inserted
replaced
2719:2b6f73c30016 | 2721:56c8ef515d93 |
---|---|
205 if err != nil { | 205 if err != nil { |
206 feedback.Error("Unsupported CRS name '%s'", ft.DefaultCRS) | 206 feedback.Error("Unsupported CRS name '%s'", ft.DefaultCRS) |
207 return nil, err | 207 return nil, err |
208 } | 208 } |
209 | 209 |
210 urls, err := wfs.GetFeaturesGET( | 210 dl, err := wfs.GetFeatures(caps, fd.FeatureType, fd.SortBy) |
211 caps, fd.FeatureType, wfs.FormatGeoJSON, fd.SortBy) | |
212 if err != nil { | 211 if err != nil { |
213 feedback.Error("Cannot create GetFeature URLs. %v", err) | 212 feedback.Error("Cannot create GetFeature URLs. %v", err) |
214 return nil, err | 213 return nil, err |
215 } | 214 } |
216 | 215 |
236 ) | 235 ) |
237 | 236 |
238 // TODO: Fetch from parameters. | 237 // TODO: Fetch from parameters. |
239 user, password := "", "" | 238 user, password := "", "" |
240 | 239 |
241 if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error { | 240 if err := dl.Download(user, password, func(url string, r io.Reader) error { |
242 feedback.Info("Get features from: '%s'", url) | 241 feedback.Info("Get features from: '%s'", url) |
243 rfc, err := wfs.ParseRawFeatureCollection(r) | 242 rfc, err := wfs.ParseRawFeatureCollection(r) |
244 if err != nil { | 243 if err != nil { |
245 return fmt.Errorf("parsing GetFeature document failed: %v", err) | 244 return fmt.Errorf("parsing GetFeature document failed: %v", err) |
246 } | 245 } |