blob: beee761a55d8b3edd72df613f27bc0df2e2e16c1 (
plain) (
blame)
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
|
package main
import (
"time"
"github.com/paulmach/orb"
"github.com/paulmach/osm"
)
type Coords struct {
Type string `json:"type" bson:"type"`
Coordinates []float64 `json:"coordinates" bson:"coordinates"`
}
type ItemType string
const (
NodeType ItemType = "node"
WayType ItemType = "way"
RelationType ItemType = "relation"
)
type ID struct {
ID int64 `json:"id" bson:"id"`
Type ItemType `json:"type" bson:"type"`
Version int `json:"version" bson:"version"`
}
type Object struct {
ID ID `json:"_id" bson:"_id"`
Timestamp time.Time `json:"timestamp" bson:"timestamp"`
Tags []Tag `json:"tags" bson:"tags"`
Location Coords `json:"location,omitempty" bson:"location,omitempty"`
Nodes []int64 `json:"nodes,omitempty" bson:"nodes,omitempty"`
Members []Member `json:"members,omitempty" bson:"members,omitempty"`
}
type Member struct {
Type osm.Type `json:"type" bson:"type"`
Ref int64 `json:"ref" bson:"ref"`
Role string `json:"role" bson:"role"`
Location *Coords `json:"location" bson:"location"`
// Orientation is the direction of the way around a ring of a multipolygon.
// Only valid for multipolygon or boundary relations.
Orientation orb.Orientation `json:"orienation" bson:"orienation"`
}
type Tag struct {
Key string `json:"key" bson:"key"`
Value string `json:"value" bson:"value"`
}
|