view pkg/wfs/global.go @ 2672:b997e1fd1d3d import-overview-rework

Fixed warning SQL prefix for selection.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 14 Mar 2019 17:29:36 +0100
parents 49ce3c11ca72
children d7ef169fd0d3
line wrap: on
line source

// This is Free Software under GNU Affero General Public License v >= 3.0
// without warranty, see README.md and license for details.
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// License-Filename: LICENSES/AGPL-3.0.txt
//
// Copyright (C) 2019 by via donau
//   – Österreichische Wasserstraßen-Gesellschaft mbH
// Software engineering by Intevation GmbH
//
// Author(s):
//  * Sascha L. Teichmann <sascha.teichmann@intevation.de>

package wfs

import (
	"io"
	"log"
	"os/exec"
)

type (
	Downloader interface {
		Download(handler func(string, io.Reader) error) error
	}

	GeoJSONDownloader []string
	GMLDownloader     []string
)

var GetFeatures = setup()

func setup() func(*Capabilities, string, string) (Downloader, error) {
	path, err := exec.LookPath("ogr2ogr")
	if err != nil {
		log.Println("info: ogr2ogr not installed. Using direct GeoJSON WFS download.")
		return GetFeaturesGeoJSON
	}
	log.Printf("info: ogr2ogr found at %s. Using GML WFS download.\n", path)
	return GetFeaturesGML
}

func GetFeaturesGeoJSON(
	caps *Capabilities,
	featureTypeName string,
	sortBy string,
) (Downloader, error) {
	return nil, nil
}

func GetFeaturesGML(
	caps *Capabilities,
	featureTypeName string,
	sortBy string,
) (Downloader, error) {
	return nil, nil
}

func (gjd GeoJSONDownloader) Download(handler func(string, io.Reader)) error {
	// TODO: Implement, me!
	return nil
}

func (gmd GMLDownloader) Download(handler func(string, io.Reader)) error {
	// TODO: Implement, me!
	return nil
}