-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_parser.go
67 lines (63 loc) · 1.24 KB
/
map_parser.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
package osm
func HasTagByKeyValue(item Taged, key, value string) bool {
for _, tag := range item.Tags() {
if tag.Key == key && tag.Value == value {
return true
}
}
return false
}
func HasTagByValue(item Taged, name string) bool {
for _, tag := range item.Tags() {
if tag.Value == name {
return true
}
}
return false
}
func HasTagByKey(item Taged, name string) bool {
for _, tag := range item.Tags() {
if tag.Key == name {
return true
}
}
return false
}
//func main() {
//
// //osmOriginal := loadFromBz2()
// //saveJson(osmOriginal)
// osm := loadFromJson()
//
// //For fast lookup
// nodes := map[uint64]Node{}
// ways := map[uint64]Way{}
// relations := map[uint64]Relation{}
//
// var frankstone_line_id uint64 = 344911
//
// for _, node := range osm.Node {
// nodes[node.Id] = node
// }
//
// for _, way := range osm.Way {
// ways[way.Id] = way
// }
//
// for _, relation := range osm.Relation {
// relations[relation.Id] = relation
// }
//
// frankstone_line := relations[frankstone_line_id]
//
// first_way_id := frankstone_line.Member[0].Ref
// first_way := ways[first_way_id]
// fmt.Println(first_way)
//
// for _, nd := range first_way.Nd {
// node := nodes[nd.Ref]
// fmt.Printf("%f %f\n", node.Lat, node.Lon)
//
// }
//
//}