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

Function ParseCartesianBoundingBoxFromGeoHash

pkg/geo/parse.go:217–230  ·  view source on GitHub ↗

ParseCartesianBoundingBoxFromGeoHash converts a GeoHash to a CartesianBoundingBox.

(g string, precision int)

Source from the content-addressed store, hash-verified

215
216// ParseCartesianBoundingBoxFromGeoHash converts a GeoHash to a CartesianBoundingBox.
217func ParseCartesianBoundingBoxFromGeoHash(g string, precision int) (CartesianBoundingBox, error) {
218 box, err := parseGeoHash(g, precision)
219 if err != nil {
220 return CartesianBoundingBox{}, err
221 }
222 return CartesianBoundingBox{
223 BoundingBox: geopb.BoundingBox{
224 LoX: box.Lon.Min,
225 HiX: box.Lon.Max,
226 LoY: box.Lat.Min,
227 HiY: box.Lat.Max,
228 },
229 }, nil
230}
231
232func parseGeoHash(g string, precision int) (geohash.Box, error) {
233 if len(g) == 0 {

Callers

nothing calls this directly

Calls 1

parseGeoHashFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…