Package osm extracts and manipulates OpenStreetMap (OSM) data. Refer to openstreetmap.org for more information about OSM data.
- type Data
- func ExtractFile(ctx context.Context, file string, keep KeepFunc, keepTags bool) (*Data, error)
- func ExtractPBF(ctx context.Context, rs io.ReadSeeker, keep KeepFunc, keepTags bool) (*Data, error)
- func ExtractTag(rs io.ReadSeeker, tag string, keepTags bool, values ...string) (*Data, error)
- func ExtractXML(ctx context.Context, rs io.ReadSeeker, keep KeepFunc, keepTags bool) (*Data, error)
- type GeomTags
- type GeomType
- type KeepFunc
- type Member
- type Node
- type ObjectType
- type Relation
- type TagCount
- type Tags
- type Way
Data holds OpenStreetMap data and relationships.
func ExtractFile ¶
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. keepTags determines whether the tags and other metadata should be removed from each record to reduce memeory use.
func ExtractPBF ¶
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. keepTags determines whether the tags and other metadata should be removed from each record to reduce memeory use.
func ExtractXML ¶
ExtractXML extracts OpenStreetMap data from osm file rs. keep determines which records are included in the output.
Check checks OSM data to ensure that all necessary components are present.
CountTags returns the different tags in the receiver and the number of instances of each one.
Filter returns a copy of the receiver where only objects selected by keep are retained.
GeomTags holds a geometry object and the tags that apply to it.
type GeomType int
GeomType specifies the valid geometry types.
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 ¶
KeepBounds keeps OSM objects that overlap with b. Using KeepBounds in combination with other KeepFuncs may result in unexpected results.
KeepTags keeps OSM objects that contain the given tag key with at least one of the given tag values, where the keys and values correspond to the keys and values of the 'tags' input. If no tag valuse are given, then all object with the given key will be kept.
Node holds a subset of the information specifying an OpenStreetMap node.
type ObjectType ¶
type ObjectType int
ObjectType specifies the valid OpenStreetMap types.
const ( // NodeType is an OpenStreetMap node. NodeType ObjectType = iota // WayType can be either open or closed. WayType // ClosedWayType is an OpenStreetMap way that is closed (i.e., a polygon). ClosedWayType // OpenWayType is an OpenStreetMap way that is open (i.e., a line string). OpenWayType // RelationType is an OpenStreetMap relation. RelationType )
Relation holds a subset of the information specifying an OpenStreetMap way.
TagCount hold information about the number of instances of the specified tag in a database.
type Tags *TagCount
Tags holds information about the tags that are in a database.
CountTags returns the different tags in the database and the number of instances of each one.
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.
Len returns the length of the receiver to implement the sort.Sort interface.
Less returns whether item i is less than item j to implement the sort.Sort interface.
Swap swaps elements i and j to implement the sort.Sort interface.