ParseCartesianBoundingBoxFromGeoHash converts a GeoHash to a CartesianBoundingBox.
(g string, precision int)
| 215 | |
| 216 | // ParseCartesianBoundingBoxFromGeoHash converts a GeoHash to a CartesianBoundingBox. |
| 217 | func 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 | |
| 232 | func parseGeoHash(g string, precision int) (geohash.Box, error) { |
| 233 | if len(g) == 0 { |
nothing calls this directly
no test coverage detected
searching dependent graphs…