Mercurial > gemma
comparison pkg/imports/wp.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 |
---|---|
215 | 215 |
216 if wp.SortBy != "" { | 216 if wp.SortBy != "" { |
217 feedback.Info("Features will be sorted by '%s'", wp.SortBy) | 217 feedback.Info("Features will be sorted by '%s'", wp.SortBy) |
218 } | 218 } |
219 | 219 |
220 urls, err := wfs.GetFeaturesGET( | 220 dl, err := wfs.GetFeatures(caps, wp.FeatureType, wp.SortBy) |
221 caps, wp.FeatureType, wfs.FormatGeoJSON, wp.SortBy) | |
222 if err != nil { | 221 if err != nil { |
223 feedback.Error("Cannot create GetFeature URLs. %v", err) | 222 feedback.Error("Cannot create GetFeature URLs. %v", err) |
224 return err | 223 return err |
225 } | 224 } |
226 | 225 |
245 ) | 244 ) |
246 | 245 |
247 // TODO: Fetch from parameters. | 246 // TODO: Fetch from parameters. |
248 user, password := "", "" | 247 user, password := "", "" |
249 | 248 |
250 if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error { | 249 if err := dl.Download(user, password, func(url string, r io.Reader) error { |
251 feedback.Info("Get features from: '%s'", url) | 250 feedback.Info("Get features from: '%s'", url) |
252 rfc, err := wfs.ParseRawFeatureCollection(r) | 251 rfc, err := wfs.ParseRawFeatureCollection(r) |
253 if err != nil { | 252 if err != nil { |
254 return fmt.Errorf("parsing GetFeature document failed: %v", err) | 253 return fmt.Errorf("parsing GetFeature document failed: %v", err) |
255 } | 254 } |