Mercurial > gemma
comparison pkg/imports/wx.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 |
---|---|
143 | 143 |
144 if wx.SortBy != "" { | 144 if wx.SortBy != "" { |
145 feedback.Info("Features will be sorted by '%s'", wx.SortBy) | 145 feedback.Info("Features will be sorted by '%s'", wx.SortBy) |
146 } | 146 } |
147 | 147 |
148 urls, err := wfs.GetFeaturesGET( | 148 dl, err := wfs.GetFeatures(caps, wx.FeatureType, wx.SortBy) |
149 caps, wx.FeatureType, wfs.FormatGeoJSON, wx.SortBy) | |
150 if err != nil { | 149 if err != nil { |
151 feedback.Error("Cannot create GetFeature URLs. %v", err) | 150 feedback.Error("Cannot create GetFeature URLs. %v", err) |
152 return nil, err | 151 return nil, err |
153 } | 152 } |
154 | 153 |
177 ) | 176 ) |
178 | 177 |
179 // TODO: Fetch from parameters. | 178 // TODO: Fetch from parameters. |
180 user, password := "", "" | 179 user, password := "", "" |
181 | 180 |
182 if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error { | 181 if err := dl.Download(user, password, func(url string, r io.Reader) error { |
183 feedback.Info("Get features from: '%s'", url) | 182 feedback.Info("Get features from: '%s'", url) |
184 rfc, err := wfs.ParseRawFeatureCollection(r) | 183 rfc, err := wfs.ParseRawFeatureCollection(r) |
185 if err != nil { | 184 if err != nil { |
186 return fmt.Errorf("parsing GetFeature document failed: %v", err) | 185 return fmt.Errorf("parsing GetFeature document failed: %v", err) |
187 } | 186 } |