cropprovider

package
v0.0.0-...-cd09ded Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCDLFileByBbox

func GetCDLFileByBbox(year string, minx string, miny string, maxx string, maxy string) (nassTiffReader, error)

GetCDLFileByBbox stores a NASS CDL Geotif for a given year and bounding box

func GetCDLFileByFIPS

func GetCDLFileByFIPS(year string, fips string) (nassTiffReader, error)

GetCDLFileByFIPS stores a NASS CDL Geotif for a given year and county FIPS

func GetCDLFileByFIPSFiltered

func GetCDLFileByFIPSFiltered(year string, fips string, cropType string) bool

GetCDLFileByFIPSFiltered provides a filtered geotif for a fips code. croptype is the list of values to keep and can be provided as a comma separated array of values to include

func GetCDLValue

func GetCDLValue(year string, x string, y string) crops.Crop

GetCDLValue returns a crop type for a year and x,y coordinates in the projection of USA Contiguous Albers Equal Area Conic (USGS version).

func Init

func Init(fp string) nassTiffReader

Init creates a streaming crop provider

Types

type NassCropProvider

type NassCropProvider struct {
	Year       string
	CropFilter map[string]crops.Crop
}

func InitNassCropProvider

func InitNassCropProvider(year string, cropFilter []string) NassCropProvider

func (NassCropProvider) ByBbox

func (NassCropProvider) ByFips

func (n NassCropProvider) ByFips(fipscode string, sp consequences.StreamProcessor)

type NoCropFoundError

type NoCropFoundError struct {
	Input string
}

func (NoCropFoundError) Error

func (c NoCropFoundError) Error() string

type StatisticsResult

type StatisticsResult struct {
	Success      bool            `json:"success"`
	ErrorMessage string          `json:"errorMessage"`
	Rows         []StatisticsRow `json:"rows"`
}

StatisticsResult describes the structure of the result from the NASS stats endpoint

func GetStatsByBbox

func GetStatsByBbox(year string, minx string, miny string, maxx string, maxy string) StatisticsResult

GetStatsByBbox returns the statistics of crops in a bounding box in the projection of USA Contiguous Albers Equal Area Conic (USGS version).

type StatisticsRow

type StatisticsRow struct {
	Value    int     `json:"value"`
	Count    int     `json:"count"`
	Category string  `json:"category"`
	Color    string  `json:"color"`
	Acreage  float64 `json:"acreage"`
}

StatisticsRow describes a row in the statistics result from the NASS stats endpoint

type XMLCDLValueResponse

type XMLCDLValueResponse struct {
	XMLName xml.Name `xml:"GetCDLValueResponse"`
	Result  string   `xml:"Result"`
}

XMLCDLValueResponse is the xml return for a getCDLValue response from the NASS API

type XMLExtractResponse

type XMLExtractResponse struct {
	XMLName   xml.Name `xml:"ExtractCDLByValuesResponse"`
	ReturnURL string   `xml:"returnURL"`
}

XMLExtractResponse is the xml return for the Export NASS endpoint

type XMLFileURLResponse

type XMLFileURLResponse struct {
	XMLName   xml.Name `xml:"GetCDLFileResponse"`
	ReturnURL string   `xml:"returnURL"`
}

XMLFileURLResponse is the xml return for the File NASS endpoint

type XMLStatsURLResponse

type XMLStatsURLResponse struct {
	XMLName   xml.Name `xml:"GetCDLStatResponse"`
	ReturnURL string   `xml:"returnURL"`
}

XMLStatsURLResponse is the xml return for a stats endpoint query

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL