README
¶
STAC Utilities
Utilities for working with Spatio-Temporal Asset Catalog (STAC) resources.
The stac
command line utility can be used to crawl and validate STAC metadata. In addition, the github.com/planetlabs/go-stac
module can be used in Go projects.
Command Line Interface
The stac
program can be installed by downloading one of the archives from the latest release.
Extract the archive and place the stac
executable somewhere on your path. See a list of available commands by running stac
in your terminal.
Mac users can install the stac
program with brew
:
brew install planetlabs/tap/go-stac
CLI Usage
Run stac help
to see a full list of commands and their arguments. The primary stac
commands are documented below.
stac validate
The stac validate
command crawls STAC resources and validates them against the appropriate schema.
Example use:
stac validate --entry path/to/catalog.json
The --entry
can be a file path or URL pointing to a catalog, collection, or item. By default, all catalogs, collections, and items linked from the entry point will be validated. Use the --no-recursion
option to validate a single resource without crawling to linked resources. See stac validate --help
for a full list of supported options.
stac stats
The stac stats
command crawls STAC resources and prints out counts of resource type, versions, extensions, asset types, and conformance classes (for API endpoints).
Example use:
stac stats --entry path/to/catalog.json
The --entry
can be a file path or URL pointing to a catalog, collection, or item. The stats output is a JSON object with top-level properties for catalog, collection, and item stats.
The structure of the output conforms with the schema of the STAC Stats extension, so the results can be added to a STAC entrypoint to provide stats on child catalogs, collections, and items. The stac stats
command can write out a copy of the provided entrypoint with statistics added.
To write out a version of a catalog or collection that includes metadata for the STAC Stats extension, run the following:
stac stats --entry path/to/catalog.json --output path/to/catalog-with-stats.json
Library Use
Requires Go >= 1.18
Install the module into your project.
go get github.com/planetlabs/go-stac
See the reference documentation for example usage in a Golang project.
Development
See the development doc for information on developing and releasing the go-stac
library.
Documentation
¶
Index ¶
- Variables
- func DecodeExtendedItemProperties(itemExtension Extension, itemMap map[string]any) error
- func DecodeExtendedMap(extension Extension, data map[string]any) error
- func EncodeAssets(assets map[string]*Asset) (map[string]any, []string, error)
- func EncodeExtendedItemProperties(itemExtension Extension, itemMap map[string]any) error
- func EncodeExtendedMap(extension Extension, data map[string]any) error
- func EncodeLinks(links []*Link) ([]map[string]any, []string, error)
- func GetExtensionUris(data map[string]any) ([]string, error)
- func IsCoreItemProperty(prop string) bool
- func PopulateExtensionFromProperties(extension Extension, properties map[string]any) error
- func RegisterAssetExtension(pattern *regexp.Regexp, provider ExtensionProvider)
- func RegisterCatalogExtension(pattern *regexp.Regexp, provider ExtensionProvider)
- func RegisterCollectionExtension(pattern *regexp.Regexp, provider ExtensionProvider)
- func RegisterItemExtension(pattern *regexp.Regexp, provider ExtensionProvider)
- func RegisterLinkExtension(pattern *regexp.Regexp, provider ExtensionProvider)
- func SetExtensionUris(data map[string]any, uris []string)
- type Asset
- type Catalog
- type Collection
- type CollectionsList
- type Extension
- type ExtensionProvider
- type Extent
- type Item
- type ItemsList
- type Link
- type Provider
- type SpatialExtent
- type TemporalExtent
Constants ¶
This section is empty.
Variables ¶
var ErrExtensionDoesNotApply = errors.New("extension does not apply")
ErrExtensionDoesNotApply is returned when decoding JSON and an extension referenced in stac_extensions does not apply to a value.
Functions ¶
func DecodeExtendedItemProperties ¶ added in v0.24.0
func DecodeExtendedMap ¶ added in v0.28.0
func EncodeAssets ¶ added in v0.24.0
func EncodeExtendedItemProperties ¶ added in v0.24.0
func EncodeExtendedMap ¶ added in v0.28.0
func EncodeLinks ¶ added in v0.28.0
func GetExtensionUris ¶ added in v0.24.0
func IsCoreItemProperty ¶
func RegisterAssetExtension ¶ added in v0.24.0
func RegisterAssetExtension(pattern *regexp.Regexp, provider ExtensionProvider)
func RegisterCatalogExtension ¶ added in v0.26.0
func RegisterCatalogExtension(pattern *regexp.Regexp, provider ExtensionProvider)
func RegisterCollectionExtension ¶ added in v0.24.0
func RegisterCollectionExtension(pattern *regexp.Regexp, provider ExtensionProvider)
func RegisterItemExtension ¶ added in v0.24.0
func RegisterItemExtension(pattern *regexp.Regexp, provider ExtensionProvider)
func RegisterLinkExtension ¶ added in v0.28.0
func RegisterLinkExtension(pattern *regexp.Regexp, provider ExtensionProvider)
func SetExtensionUris ¶ added in v0.24.0
Types ¶
type Catalog ¶
type Catalog struct { Version string `json:"stac_version"` Id string `json:"id"` Title string `json:"title,omitempty"` Description string `json:"description"` Links []*Link `json:"links"` ConformsTo []string `json:"conformsTo,omitempty"` Extensions []Extension `json:"-"` }
func (Catalog) MarshalJSON ¶
func (*Catalog) UnmarshalJSON ¶ added in v0.26.0
type Collection ¶
type Collection struct { Version string `json:"stac_version"` Id string `json:"id"` Title string `json:"title,omitempty"` Description string `json:"description"` Keywords []string `json:"keywords,omitempty"` License string `json:"license"` Providers []*Provider `json:"providers,omitempty"` Extent *Extent `json:"extent"` Summaries map[string]any `json:"summaries,omitempty"` Links []*Link `json:"links"` Assets map[string]*Asset `json:"assets,omitempty"` Extensions []Extension `json:"-"` }
func (Collection) MarshalJSON ¶
func (collection Collection) MarshalJSON() ([]byte, error)
func (*Collection) UnmarshalJSON ¶ added in v0.24.0
func (collection *Collection) UnmarshalJSON(data []byte) error
type CollectionsList ¶
type CollectionsList struct { Collections []*Collection `json:"collections"` Links []*Link `json:"links"` }
type Extension ¶ added in v0.24.0
func GetAssetExtension ¶ added in v0.24.0
func GetCatalogExtension ¶ added in v0.26.0
func GetCollectionExtension ¶ added in v0.24.0
func GetItemExtension ¶ added in v0.24.0
func GetLinkExtension ¶ added in v0.28.0
type ExtensionProvider ¶ added in v0.24.0
type ExtensionProvider func() Extension
type Extent ¶
type Extent struct { Spatial *SpatialExtent `json:"spatial,omitempty"` Temporal *TemporalExtent `json:"temporal,omitempty"` }
type Item ¶
type Item struct { Version string `json:"stac_version"` Id string `json:"id"` Geometry any `json:"geometry"` Bbox []float64 `json:"bbox,omitempty"` Properties map[string]any `json:"properties"` Links []*Link `json:"links"` Assets map[string]*Asset `json:"assets"` Collection string `json:"collection,omitempty"` Extensions []Extension `json:"-"` }
func (Item) MarshalJSON ¶
func (*Item) UnmarshalJSON ¶ added in v0.24.0
type Link ¶
type Link struct { Href string `mapstructure:"href"` Rel string `mapstructure:"rel"` Type string `mapstructure:"type,omitempty"` Title string `mapstructure:"title,omitempty"` Extensions []Extension `mapstructure:"-"` AdditionalFields map[string]any `mapstructure:",remain"` }
func (*Link) MarshalJSON ¶ added in v0.20.0
func (*Link) UnmarshalJSON ¶ added in v0.20.0
type SpatialExtent ¶
type SpatialExtent struct {
Bbox [][]float64 `json:"bbox"`
}
type TemporalExtent ¶
type TemporalExtent struct {
Interval [][]any `json:"interval"`
}
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
stac
The stac program is a command line tool for working with STAC resources.
|
The stac program is a command line tool for working with STAC resources. |
Package crawler implements a STAC resource crawler.
|
Package crawler implements a STAC resource crawler. |
extensions
|
|
internal
|
|
Package validator implements a STAC resource validation.
|
Package validator implements a STAC resource validation. |