Documentation ¶
Overview ¶
Package osm extracts and manipulates OpenStreetMap (OSM) data. Refer to openstreetmap.org for more information about OSM data.
Index ¶
- type Data
- func ExtractFile(ctx context.Context, file string, keep KeepFunc) (*Data, error)
- func ExtractPBF(ctx context.Context, rs io.ReadSeeker, keep KeepFunc) (*Data, error)
- func ExtractTag(rs io.ReadSeeker, tag string, values ...string) (*Data, error)
- func ExtractXML(ctx context.Context, rs io.ReadSeeker, keep KeepFunc) (*Data, error)
- type GeomTags
- type GeomType
- type KeepFunc
- type ObjectType
- type TagCount
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { Nodes map[osm.NodeID]*osm.Node Ways map[osm.WayID]*osm.Way Relations map[osm.RelationID]*osm.Relation // contains filtered or unexported fields }
Data holds OpenStreetMap data and relationships.
func ExtractFile ¶ added in v0.2.5
ExtractFile extracts OpenStreetMap data from the given file path, determining whether it is an XML or PBF file from the extension (.osm or .pbf, respectively). keep determines which records are included in the output.
func ExtractPBF ¶ added in v0.2.4
ExtractPBF extracts OpenStreetMap data from osm.pbf file rs. keep determines which records are included in the output.
func ExtractTag ¶
ExtractTag extracts OpenStreetMap data with the given tag set to one of the given values.
func ExtractXML ¶ added in v0.2.4
ExtractXML extracts OpenStreetMap data from osm file rs. keep determines which records are included in the output.
func (*Data) CountTags ¶ added in v0.2.4
CountTags returns the different tags in the receiver and the number of instances of each one.
type GeomType ¶
type GeomType int
func DominantType ¶
DominantType returns the most frequently occurring type among the given features.
type KeepFunc ¶ added in v0.2.4
KeepFunc is a function that determines whether an OSM object should be included in the output. The object may be either *osmpbf.Node, *osmpbf.Way, or *osmpbf.Relation
func KeepBounds ¶ added in v0.2.4
KeepBounds keeps OSM objects that overlap with b. Using KeepBounds in combination with other KeepFuncs may result in unexpected results.
type ObjectType ¶
type ObjectType int
ObjectType specifies the valid OpenStreetMap types.
const ( // Node is an OpenStreetMap node. Node ObjectType = iota // Way can be either open or closed. Way // ClosedWay is an OpenStreetMap way that is closed (i.e., a polygon). ClosedWay // OpenWay is an OpenStreetMap way that is open (i.e., a line string). OpenWay // Relation is an OpenStreetMap relation. Relation )
type TagCount ¶
type TagCount struct {
Key, Value string
ObjectCount map[ObjectType]int
TotalCount int
}
TagCount hold information about the number of instances of the specified tag in a database.
func (*TagCount) DominantType ¶
func (t *TagCount) DominantType() ObjectType
DominantType returns the most frequently occuring ObjectType for this tag.
type Tags ¶
type Tags []*TagCount
Tags holds information about the tags that are in a database.
func CountTags ¶
CountTags returns the different tags in the database and the number of instances of each one.
func (*Tags) Filter ¶
Filter applies function f to all records in the receiver and returns a copy of the receiver that only contains the records for which f returns true.
func (*Tags) Less ¶
Less returns whether item i is less than item j to implement the sort.Sort interface.