MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / addGeoPolygonToCluster

Function addGeoPolygonToCluster

query/common_test.go:149–172  ·  view source on GitHub ↗
(uid uint64, pred string, polygon [][][]float64)

Source from the content-addressed store, hash-verified

147}
148
149func addGeoPolygonToCluster(uid uint64, pred string, polygon [][][]float64) error {
150 coordinates := "["
151 for i, ring := range polygon {
152 coordinates += "["
153 for j, point := range ring {
154 coordinates += fmt.Sprintf("[%v, %v]", point[0], point[1])
155
156 if j != len(ring)-1 {
157 coordinates += ","
158 }
159 }
160
161 coordinates += "]"
162 if i != len(polygon)-1 {
163 coordinates += ","
164 }
165 }
166 coordinates += "]"
167
168 triple := fmt.Sprintf(
169 `<%d> <%s> "{'type':'Polygon', 'coordinates': %s}"^^<geo:geojson> .`,
170 uid, pred, coordinates)
171 return addTriplesToCluster(triple)
172}
173
174func addGeoMultiPolygonToCluster(uid uint64, polygons [][][][]float64) error {
175 coordinates := "["

Callers 1

populateClusterFunction · 0.85

Calls 1

addTriplesToClusterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…