package pbf
import "github.com/codesoap/pbf"
package extractor provides functions for extracting OSM entities within a given area from PBF files. The entities can further be filtered by their tags.
The entities, as well as the filter options, do not contain all available data and metadata in order to simplify the interface and reduce resource use.
Index ¶
- type Entities
- type Entity
- type Filter
- type LocationFilter
- type Node
- func (n Node) Coords() (lat, lon int64)
- func (n Node) ID() int64
- func (n Node) Tags() map[string]string
- type Relation
- func (r Relation) ID() int64
- func (r Relation) Nodes() []int64
- func (r Relation) Relations() []int64
- func (r Relation) Tags() map[string]string
- func (r Relation) Ways() []int64
- type Way
Types ¶
type Entities ¶
type Entities struct { Nodes map[int64]Node // Nodes by their ID. Ways map[int64]Way // Ways by their ID. Relations map[int64]Relation // Relations by their ID. }
func ExtractEntities ¶
ExtractEntities extracts all entities matching filter from the given pbfFile.
type Entity ¶
An Entity is an OSM entity: either a Node, Way or Relation.
type Filter ¶
type Filter struct { // Location filters results by geographic location. If it is nil, this // filter is inactive. // // Note that ways and relations which only pass through Location, but // have no nodes there, will be missed. // // Example: // myFilter.Location = func(lat, lon int64) bool { // return lat >= 50_000_000_000 && // lat <= 50_010_000_000 && // lon >= 10_000_000_000 && // lon <= 10_010_000_000 // } Location LocationFilter // The Tags filter will filter entities by their tags. Keys are tags // and values are accepted values. If a value is an empty slice, every // value for this tag is accepted, but a value for this tag must be // present. Tags map[string][]string // If ExcludePartial is true, the filter will not match ways and // relations, where only some of their nodes lay within Location. This // can improve performance. ExcludePartial bool }
Filter is a filter for OSM entities.
type LocationFilter ¶
LocationFilter is a function that takes a latitude and longitude in nanodegrees and returns true if the given coordinates match the filter.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (Node) Coords ¶
func (Node) ID ¶
func (Node) Tags ¶
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
func (Relation) ID ¶
func (Relation) Nodes ¶
func (Relation) Relations ¶
func (Relation) Tags ¶
func (Relation) Ways ¶
type Way ¶
type Way struct {
// contains filtered or unexported fields
}
func (Way) ID ¶
func (Way) Nodes ¶
func (Way) Tags ¶
Source Files ¶
doc.go entity.go extractor.go filter.go
Directories ¶
Path | Synopsis |
---|---|
fileblock | |
pbfproto | |
util |
- Version
- v0.1.2 (latest)
- Published
- Oct 4, 2024
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 1 week ago –
Tools for package owners.