Documentation
¶
Index ¶
- Constants
- Variables
- func AllRoles() []string
- func AppendPlacetype(pt WOFPlacetype) error
- func AppendPlacetypeSpecification(spec *WOFPlacetypeSpecification) error
- func IsAncestor(a *WOFPlacetype, b *WOFPlacetype) bool
- func IsDescendant(a *WOFPlacetype, b *WOFPlacetype) bool
- func IsValidPlacetype(name string) bool
- func IsValidPlacetypeId(id int64) bool
- type WOFPlacetype
- func Ancestors(pt *WOFPlacetype) []*WOFPlacetype
- func AncestorsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
- func Children(pt *WOFPlacetype) []*WOFPlacetype
- func Descendants(pt *WOFPlacetype) []*WOFPlacetype
- func DescendantsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
- func GetPlacetypeById(id int64) (*WOFPlacetype, error)
- func GetPlacetypeByName(name string) (*WOFPlacetype, error)
- func Placetypes() ([]*WOFPlacetype, error)
- func PlacetypesForRoles(roles []string) ([]*WOFPlacetype, error)
- type WOFPlacetypeAltNames
- type WOFPlacetypeDefinition
- type WOFPlacetypeName
- type WOFPlacetypeSpecification
- func (spec *WOFPlacetypeSpecification) Ancestors(pt *WOFPlacetype) []*WOFPlacetype
- func (spec *WOFPlacetypeSpecification) AncestorsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
- func (spec *WOFPlacetypeSpecification) AppendPlacetype(pt WOFPlacetype) error
- func (spec *WOFPlacetypeSpecification) AppendPlacetypeSpecification(other_spec *WOFPlacetypeSpecification) error
- func (spec *WOFPlacetypeSpecification) Catalog() map[string]WOFPlacetype
- func (spec *WOFPlacetypeSpecification) Children(pt *WOFPlacetype) []*WOFPlacetype
- func (spec *WOFPlacetypeSpecification) Descendants(pt *WOFPlacetype) []*WOFPlacetype
- func (spec *WOFPlacetypeSpecification) DescendantsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
- func (spec *WOFPlacetypeSpecification) GetPlacetypeById(id int64) (*WOFPlacetype, error)
- func (spec *WOFPlacetypeSpecification) GetPlacetypeByName(name string) (*WOFPlacetype, error)
- func (spec *WOFPlacetypeSpecification) GraphPlacetypes() (graph.Graph[string, *WOFPlacetype], error)
- func (spec *WOFPlacetypeSpecification) IsAncestor(a *WOFPlacetype, b *WOFPlacetype) bool
- func (spec *WOFPlacetypeSpecification) IsDescendant(a *WOFPlacetype, b *WOFPlacetype) bool
- func (spec *WOFPlacetypeSpecification) IsValidPlacetype(name string) bool
- func (spec *WOFPlacetypeSpecification) IsValidPlacetypeId(id int64) bool
- func (spec *WOFPlacetypeSpecification) Placetypes() ([]*WOFPlacetype, error)
- func (spec *WOFPlacetypeSpecification) PlacetypesForRoles(roles []string) ([]*WOFPlacetype, error)
- func (spec *WOFPlacetypeSpecification) PlacetypesToGraphviz(wr io.Writer) error
Constants ¶
const COMMON_COLOUR string = "blue"
COMMON_COLOUR defines the Graphviz edge colour for the "common" placetype role.
const COMMON_OPTIONAL_COLOUR string = "green"
COMMON_OPTIONAL_COLOUR defines the Graphviz edge colour for the "common_optional" placetype role.
const COMMON_OPTIONAL_ROLE string = "common_optional"
COMMON_OPTIONAL_ROLE defines the string label for the "common_optional" placetype role.
const COMMON_ROLE string = "common"
COMMON_ROLE defines the string label for the "common" placetype role.
const CUSTOM_COLOUR string = "black"
CUSTOM_COLOUR defines the Graphviz edge colour for the "custom" placetype role.
const CUSTOM_ROLE string = "custom"
CUSTOM_ROLE defines the string label for the "custom" placetype role.
const OPTIONAL_COLOUR string = "orange"
OPTIONAL_COLOUR defines the Graphviz edge colour for the "optional" placetype role.
const OPTIONAL_ROLE string = "optional"
OPTIONAL_ROLE defines the string label for the "optional" placetype role.
Variables ¶
var FS embed.FS
Functions ¶
func AllRoles ¶ added in v0.6.0
func AllRoles() []string
AllRoles returns a list of all the known placetype roles.
func AppendPlacetype ¶ added in v0.2.0
func AppendPlacetype(pt WOFPlacetype) error
AppendPlacetype appends 'pt' to the catalog of available placetypes.
func AppendPlacetypeSpecification ¶ added in v0.2.2
func AppendPlacetypeSpecification(spec *WOFPlacetypeSpecification) error
AppendPlacetypeSpecification appends the placetypes defined in 'other_spec' to the catalog of available placetypes in 'spec'.
func IsAncestor ¶ added in v0.4.0
func IsAncestor(a *WOFPlacetype, b *WOFPlacetype) bool
Returns true is 'b' is an ancestor of 'a'.
func IsDescendant ¶ added in v0.4.0
func IsDescendant(a *WOFPlacetype, b *WOFPlacetype) bool
Returns true is 'b' is a descendant of 'a'.
func IsValidPlacetype ¶
IsValidPlacetypeId returns a boolean value indicating whether 'name' is a known and valid placetype name.
func IsValidPlacetypeId ¶
IsValidPlacetypeId returns a boolean value indicating whether 'id' is a known and valid placetype ID.
Types ¶
type WOFPlacetype ¶
type WOFPlacetype struct {
Id int64 `json:"id"`
Name string `json:"name"`
Role string `json:"role"`
Parent []int64 `json:"parent"`
}
Type WOFPlacetype defines an individual placetype encoded in a `WOFPlacetypeSpecification` instance. The choice of naming this "WOFPlacetype" is unfortunate because since it is easily confused with the actual JSON definition files for placetypes. However, we're stuck with it for now in order to preserve backwards compatibility. Womp womp...
func Ancestors ¶
func Ancestors(pt *WOFPlacetype) []*WOFPlacetype
Ancestors returns the ancestors of role "common" for 'pt'.
func AncestorsForRoles ¶
func AncestorsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
AncestorsForRoles returns the ancestors matching any role in 'roles' for 'pt'.
func Children ¶
func Children(pt *WOFPlacetype) []*WOFPlacetype
Children returns the immediate child placetype of 'pt'.
func Descendants ¶
func Descendants(pt *WOFPlacetype) []*WOFPlacetype
Descendants returns the descendants of role "common" for 'pt'.
func DescendantsForRoles ¶
func DescendantsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
DescendantsForRoles returns the descendants matching any role in 'roles' for 'pt'.
func GetPlacetypeById ¶
func GetPlacetypeById(id int64) (*WOFPlacetype, error)
GetPlacetypesByName returns the `WOFPlacetype` instance associated with 'id'.
func GetPlacetypeByName ¶
func GetPlacetypeByName(name string) (*WOFPlacetype, error)
GetPlacetypesByName returns the `WOFPlacetype` instance associated with 'name'.
func Placetypes ¶ added in v0.1.1
func Placetypes() ([]*WOFPlacetype, error)
Placetypes returns all the known placetypes which are descendants of "planet" for the 'common', 'optional', 'common_optional', and 'custom' roles.
func PlacetypesForRoles ¶ added in v0.1.2
func PlacetypesForRoles(roles []string) ([]*WOFPlacetype, error)
Placetypes returns all the known placetypes which are descendants of "planet" whose role match any of those defined in 'roles'.
func (*WOFPlacetype) IsCorePlacetype ¶ added in v0.6.0
func (pt *WOFPlacetype) IsCorePlacetype() bool
IsCorePlacetype returns a boolean value if 'pt' is one of the "core" Who's On First placetypes.
func (*WOFPlacetype) String ¶ added in v0.6.0
func (pt *WOFPlacetype) String() string
String returns the value of the `Name` property for 'pt'.
type WOFPlacetypeAltNames ¶
type WOFPlacetypeDefinition ¶ added in v0.6.0
type WOFPlacetypeDefinition struct {
Id int64 `json:"wof:id"`
Name string `json:"wof:name"`
Role string `json:"wof:role"`
Parent []string `json:"wof:parent"`
Concordances map[string]string `json:"wof:concordances"`
}
Type WOFPlacetypeDefinition is a struct that maps to the JSON definition files for individual placetypes in the `whosonfirst-placetypes` repo. Note that as of this writing it does not account for BCP-47 name: properties.
type WOFPlacetypeName ¶
type WOFPlacetypeSpecification ¶
type WOFPlacetypeSpecification struct {
// contains filtered or unexported fields
}
func DefaultWOFPlacetypeSpecification ¶ added in v0.2.1
func DefaultWOFPlacetypeSpecification() (*WOFPlacetypeSpecification, error)
func NewWOFPlacetypeSpecification ¶ added in v0.2.1
func NewWOFPlacetypeSpecification(body []byte) (*WOFPlacetypeSpecification, error)
NewWOFPlacetypeSpecification returns a `WOFPlacetypeSpecification` derived from 'body'.
func NewWOFPlacetypeSpecificationWithReader ¶ added in v0.2.3
func NewWOFPlacetypeSpecificationWithReader(r io.Reader) (*WOFPlacetypeSpecification, error)
func (*WOFPlacetypeSpecification) Ancestors ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) Ancestors(pt *WOFPlacetype) []*WOFPlacetype
Ancestors returns the ancestors of role "common" for 'pt'.
func (*WOFPlacetypeSpecification) AncestorsForRoles ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) AncestorsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
AncestorsForRoles returns the ancestors matching any role in 'roles' for 'pt'.
func (*WOFPlacetypeSpecification) AppendPlacetype ¶ added in v0.2.0
func (spec *WOFPlacetypeSpecification) AppendPlacetype(pt WOFPlacetype) error
AppendPlacetype appends 'pt' to the catalog of available placetypes.
func (*WOFPlacetypeSpecification) AppendPlacetypeSpecification ¶ added in v0.2.2
func (spec *WOFPlacetypeSpecification) AppendPlacetypeSpecification(other_spec *WOFPlacetypeSpecification) error
AppendPlacetypeSpecification appends the placetypes defined in 'other_spec' to the catalog of available placetypes in 'spec'.
func (*WOFPlacetypeSpecification) Catalog ¶ added in v0.2.0
func (spec *WOFPlacetypeSpecification) Catalog() map[string]WOFPlacetype
Catalog returns the catalog of placetypes contained by 'spec'.
func (*WOFPlacetypeSpecification) Children ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) Children(pt *WOFPlacetype) []*WOFPlacetype
Children returns the immediate child placetype of 'pt'.
func (*WOFPlacetypeSpecification) Descendants ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) Descendants(pt *WOFPlacetype) []*WOFPlacetype
Descendants returns the descendants of role "common" for 'pt'.
func (*WOFPlacetypeSpecification) DescendantsForRoles ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) DescendantsForRoles(pt *WOFPlacetype, roles []string) []*WOFPlacetype
DescendantsForRoles returns the descendants matching any role in 'roles' for 'pt'.
func (*WOFPlacetypeSpecification) GetPlacetypeById ¶ added in v0.2.0
func (spec *WOFPlacetypeSpecification) GetPlacetypeById(id int64) (*WOFPlacetype, error)
GetPlacetypesByName returns the `WOFPlacetype` instance associated with 'id'.
func (*WOFPlacetypeSpecification) GetPlacetypeByName ¶ added in v0.2.0
func (spec *WOFPlacetypeSpecification) GetPlacetypeByName(name string) (*WOFPlacetype, error)
GetPlacetypesByName returns the `WOFPlacetype` instance associated with 'name'.
func (*WOFPlacetypeSpecification) GraphPlacetypes ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) GraphPlacetypes() (graph.Graph[string, *WOFPlacetype], error)
GraphPlacetypes will generate a directed graph for all the placetypes defined in 'spec'.
func (*WOFPlacetypeSpecification) IsAncestor ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) IsAncestor(a *WOFPlacetype, b *WOFPlacetype) bool
Returns true is 'b' is an ancestor of 'a'.
func (*WOFPlacetypeSpecification) IsDescendant ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) IsDescendant(a *WOFPlacetype, b *WOFPlacetype) bool
Returns true is 'b' is a descendant of 'a'.
func (*WOFPlacetypeSpecification) IsValidPlacetype ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) IsValidPlacetype(name string) bool
IsValidPlacetypeId returns a boolean value indicating whether 'name' is a known and valid placetype name.
func (*WOFPlacetypeSpecification) IsValidPlacetypeId ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) IsValidPlacetypeId(id int64) bool
IsValidPlacetypeId returns a boolean value indicating whether 'id' is a known and valid placetype ID.
func (*WOFPlacetypeSpecification) Placetypes ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) Placetypes() ([]*WOFPlacetype, error)
Placetypes returns all the known placetypes which are descendants of "planet" for the 'common', 'optional', 'common_optional', and 'custom' roles.
func (*WOFPlacetypeSpecification) PlacetypesForRoles ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) PlacetypesForRoles(roles []string) ([]*WOFPlacetype, error)
Placetypes returns all the known placetypes which are descendants of "planet" whose role match any of those defined in 'roles'.
func (*WOFPlacetypeSpecification) PlacetypesToGraphviz ¶ added in v0.6.0
func (spec *WOFPlacetypeSpecification) PlacetypesToGraphviz(wr io.Writer) error
PlacetypesToGraphviz will generate a DOT description for 'spec' and write it to 'wr'.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
wof-compile-spec
command
|
|
|
wof-placetype-ancestors
command
|
|
|
wof-placetype-children
command
|
|
|
wof-placetype-descendants
command
|
|
|
wof-placetypes
command
|
|
|
wof-render-spec
command
|
|
|
wof-valid-placetype
command
|
|
|
Package draw provides methods for graphical representations of a placetypes specification
|
Package draw provides methods for graphical representations of a placetypes specification |