-
Notifications
You must be signed in to change notification settings - Fork 6
/
types.go
72 lines (61 loc) · 1.28 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package overpass
import "time"
// ElementType represents possible types for Overpass response elements.
type ElementType string
// Possible values are node, way and relation.
const (
ElementTypeNode ElementType = "node"
ElementTypeWay ElementType = "way"
ElementTypeRelation ElementType = "relation"
)
// Meta contains fields common for all OSM types.
type Meta struct {
ID int64
Timestamp *time.Time
Version int64
Changeset int64
User string
UID int64
Tags map[string]string
}
// Node represents OSM node type.
type Node struct {
Meta
Lat float64
Lon float64
}
// Way represents OSM way type.
type Way struct {
Meta
Nodes []*Node
Bounds *Box
Geometry []Point
}
type Point struct {
Lat, Lon float64
}
// Relation represents OSM relation type.
type Relation struct {
Meta
Members []RelationMember
Bounds *Box
}
type Box struct {
Min, Max Point
}
// RelationMember represents OSM relation member type.
type RelationMember struct {
Type ElementType
Node *Node
Way *Way
Relation *Relation
Role string
}
// Result returned by Query and contains parsed result of Overpass query.
type Result struct {
Timestamp time.Time
Count int
Nodes map[int64]*Node
Ways map[int64]*Way
Relations map[int64]*Relation
}