diff options
author | Alexander NeonXP Kiryukhin <a.kiryukhin@mail.ru> | 2019-05-26 02:17:25 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <a.kiryukhin@mail.ru> | 2019-05-26 02:17:25 +0300 |
commit | 1f5a78cb8d04840d3dd63c334a064477c20612bc (patch) | |
tree | 66332f43dee4a3c5e5aaf0b3a75615b85e0b5f43 /models.go |
Initial
Diffstat (limited to 'models.go')
-rw-r--r-- | models.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/models.go b/models.go new file mode 100644 index 0000000..1c7d0ee --- /dev/null +++ b/models.go @@ -0,0 +1,57 @@ +package main + +import ( + "time" + + "github.com/paulmach/orb" + "github.com/paulmach/osm" + "go.mongodb.org/mongo-driver/bson/primitive" +) + +type Coords struct { + Type string `bson:"type"` + Coordinates []float64 `bson:"coordinates"` +} + +type Node struct { + ID primitive.ObjectID `bson:"_id,omitempty"` + OsmID int64 `bson:"osm_id"` + Visible bool `bson:"visible"` + Version int `bson:"version,omitempty"` + Timestamp time.Time `bson:"timestamp"` + Tags map[string]string `bson:"tags,omitempty"` + Location Coords `bson:"location"` +} + +type Way struct { + ID primitive.ObjectID `bson:"_id,omitempty"` + OsmID int64 `bson:"osm_id"` + Visible bool `bson:"visible"` + Version int `bson:"version"` + Timestamp time.Time `bson:"timestamp"` + Nodes []int64 `bson:"nodes"` + Tags map[string]string `bson:"tags"` +} + +type Relation struct { + ID primitive.ObjectID `bson:"_id,omitempty"` + OsmID int64 `bson:"osm_id"` + Visible bool `bson:"visible"` + Version int `bson:"version"` + Timestamp time.Time `bson:"timestamp"` + Members []Member `bson:"members"` + Tags map[string]string `bson:"tags"` +} + +type Member struct { + Type osm.Type `bson:"type"` + Ref int64 `bson:"ref"` + Role string `bson:"role"` + + Version int + Location Coords `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 `bson:"orienation,omitempty"` +} |