changeset 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 1c0307207162
files pkg/imports/dma.go pkg/imports/fd.go pkg/imports/wa.go pkg/imports/wp.go pkg/imports/wx.go
diffstat 5 files changed, 10 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/imports/dma.go	Tue Mar 19 12:20:54 2019 +0100
+++ b/pkg/imports/dma.go	Tue Mar 19 12:28:22 2019 +0100
@@ -138,8 +138,7 @@
 		return nil, err
 	}
 
-	urls, err := wfs.GetFeaturesGET(
-		caps, dma.FeatureType, wfs.FormatGeoJSON, dma.SortBy)
+	dl, err := wfs.GetFeatures(caps, dma.FeatureType, dma.SortBy)
 	if err != nil {
 		feedback.Error("Cannot create GetFeature URLs. %v", err)
 		return nil, err
@@ -172,7 +171,7 @@
 	// TODO: Fetch from parameters.
 	user, password := "", ""
 
-	if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error {
+	if err := dl.Download(user, password, func(url string, r io.Reader) error {
 		feedback.Info("Get features from: '%s'", url)
 		rfc, err := wfs.ParseRawFeatureCollection(r)
 		if err != nil {
--- a/pkg/imports/fd.go	Tue Mar 19 12:20:54 2019 +0100
+++ b/pkg/imports/fd.go	Tue Mar 19 12:28:22 2019 +0100
@@ -207,8 +207,7 @@
 		return nil, err
 	}
 
-	urls, err := wfs.GetFeaturesGET(
-		caps, fd.FeatureType, wfs.FormatGeoJSON, fd.SortBy)
+	dl, err := wfs.GetFeatures(caps, fd.FeatureType, fd.SortBy)
 	if err != nil {
 		feedback.Error("Cannot create GetFeature URLs. %v", err)
 		return nil, err
@@ -238,7 +237,7 @@
 	// TODO: Fetch from parameters.
 	user, password := "", ""
 
-	if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error {
+	if err := dl.Download(user, password, func(url string, r io.Reader) error {
 		feedback.Info("Get features from: '%s'", url)
 		rfc, err := wfs.ParseRawFeatureCollection(r)
 		if err != nil {
--- a/pkg/imports/wa.go	Tue Mar 19 12:20:54 2019 +0100
+++ b/pkg/imports/wa.go	Tue Mar 19 12:28:22 2019 +0100
@@ -145,8 +145,7 @@
 		feedback.Info("Features will be sorted by '%s'", wx.SortBy)
 	}
 
-	urls, err := wfs.GetFeaturesGET(
-		caps, wx.FeatureType, wfs.FormatGeoJSON, wx.SortBy)
+	dl, err := wfs.GetFeatures(caps, wx.FeatureType, wx.SortBy)
 	if err != nil {
 		feedback.Error("Cannot create GetFeature URLs. %v", err)
 		return nil, err
@@ -179,7 +178,7 @@
 	// TODO: Fetch from parameters.
 	user, password := "", ""
 
-	if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error {
+	if err := dl.Download(user, password, func(url string, r io.Reader) error {
 		feedback.Info("Get features from: '%s'", url)
 		rfc, err := wfs.ParseRawFeatureCollection(r)
 		if err != nil {
--- a/pkg/imports/wp.go	Tue Mar 19 12:20:54 2019 +0100
+++ b/pkg/imports/wp.go	Tue Mar 19 12:28:22 2019 +0100
@@ -217,8 +217,7 @@
 		feedback.Info("Features will be sorted by '%s'", wp.SortBy)
 	}
 
-	urls, err := wfs.GetFeaturesGET(
-		caps, wp.FeatureType, wfs.FormatGeoJSON, wp.SortBy)
+	dl, err := wfs.GetFeatures(caps, wp.FeatureType, wp.SortBy)
 	if err != nil {
 		feedback.Error("Cannot create GetFeature URLs. %v", err)
 		return err
@@ -247,7 +246,7 @@
 	// TODO: Fetch from parameters.
 	user, password := "", ""
 
-	if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error {
+	if err := dl.Download(user, password, func(url string, r io.Reader) error {
 		feedback.Info("Get features from: '%s'", url)
 		rfc, err := wfs.ParseRawFeatureCollection(r)
 		if err != nil {
--- a/pkg/imports/wx.go	Tue Mar 19 12:20:54 2019 +0100
+++ b/pkg/imports/wx.go	Tue Mar 19 12:28:22 2019 +0100
@@ -145,8 +145,7 @@
 		feedback.Info("Features will be sorted by '%s'", wx.SortBy)
 	}
 
-	urls, err := wfs.GetFeaturesGET(
-		caps, wx.FeatureType, wfs.FormatGeoJSON, wx.SortBy)
+	dl, err := wfs.GetFeatures(caps, wx.FeatureType, wx.SortBy)
 	if err != nil {
 		feedback.Error("Cannot create GetFeature URLs. %v", err)
 		return nil, err
@@ -179,7 +178,7 @@
 	// TODO: Fetch from parameters.
 	user, password := "", ""
 
-	if err := wfs.DownloadURLs(user, password, urls, func(url string, r io.Reader) error {
+	if err := dl.Download(user, password, func(url string, r io.Reader) error {
 		feedback.Info("Get features from: '%s'", url)
 		rfc, err := wfs.ParseRawFeatureCollection(r)
 		if err != nil {