Mercurial > gemma
comparison pkg/imports/dma.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 |
---|---|
136 if err != nil { | 136 if err != nil { |
137 feedback.Error("Unsupported CRS name '%s'", ft.DefaultCRS) | 137 feedback.Error("Unsupported CRS name '%s'", ft.DefaultCRS) |
138 return nil, err | 138 return nil, err |
139 } | 139 } |
140 | 140 |
141 urls, err := wfs.GetFeaturesGET( | 141 dl, err := wfs.GetFeatures(caps, dma.FeatureType, dma.SortBy) |
142 caps, dma.FeatureType, wfs.FormatGeoJSON, dma.SortBy) | |
143 if err != nil { | 142 if err != nil { |
144 feedback.Error("Cannot create GetFeature URLs. %v", err) | 143 feedback.Error("Cannot create GetFeature URLs. %v", err) |
145 return nil, err | 144 return nil, err |
146 } | 145 } |
147 | 146 |
170 ) | 169 ) |
171 | 170 |
172 // TODO: Fetch from parameters. | 171 // TODO: Fetch from parameters. |
173 user, password := "", "" | 172 user, password := "", "" |
174 | 173 |
175 if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error { | 174 if err := dl.Download(user, password, func(url string, r io.Reader) error { |
176 feedback.Info("Get features from: '%s'", url) | 175 feedback.Info("Get features from: '%s'", url) |
177 rfc, err := wfs.ParseRawFeatureCollection(r) | 176 rfc, err := wfs.ParseRawFeatureCollection(r) |
178 if err != nil { | 177 if err != nil { |
179 return fmt.Errorf("parsing GetFeature document failed: %v", err) | 178 return fmt.Errorf("parsing GetFeature document failed: %v", err) |
180 } | 179 } |