From 1f5a78cb8d04840d3dd63c334a064477c20612bc Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Sun, 26 May 2019 02:17:25 +0300 Subject: Initial --- models.go | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 models.go (limited to 'models.go') 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"` +} -- cgit v1.2.3