MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / SpatialObjectToKML

Function SpatialObjectToKML

pkg/geo/encode.go:169–183  ·  view source on GitHub ↗

SpatialObjectToKML transforms a given SpatialObject to KML.

(so geopb.SpatialObject)

Source from the content-addressed store, hash-verified

167
168// SpatialObjectToKML transforms a given SpatialObject to KML.
169func SpatialObjectToKML(so geopb.SpatialObject) (string, error) {
170 t, err := ewkb.Unmarshal([]byte(so.EWKB))
171 if err != nil {
172 return "", err
173 }
174 kmlElement, err := kml.Encode(t)
175 if err != nil {
176 return "", err
177 }
178 var buf bytes.Buffer
179 if err := kmlElement.Write(&buf); err != nil {
180 return "", err
181 }
182 return buf.String(), nil
183}
184
185// GeoHashAutoPrecision means to calculate the precision of SpatialObjectToGeoHash
186// based on input, up to 32 characters.

Callers

nothing calls this directly

Calls 4

WriteMethod · 0.80
UnmarshalMethod · 0.65
EncodeMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…