forked from paulmach/orb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset.go
More file actions
29 lines (24 loc) · 638 Bytes
/
set.go
File metadata and controls
29 lines (24 loc) · 638 Bytes
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
package maptile
import (
"github.com/paulmach/orb/geojson"
)
// Set is a map/hash of tiles.
type Set map[Tile]bool
// ToFeatureCollection converts a set of tiles into a feature collection.
// This method is mostly useful for debugging output.
func (s Set) ToFeatureCollection() *geojson.FeatureCollection {
fc := geojson.NewFeatureCollection()
fc.Features = make([]*geojson.Feature, 0, len(s))
for t := range s {
fc.Append(geojson.NewFeature(t.Bound().ToPolygon()))
}
return fc
}
// Merge will merge the given set into the existing set.
func (s Set) Merge(set Set) {
for t, v := range set {
if v {
s[t] = true
}
}
}