| 244 | } |
| 245 | |
| 246 | void geohashDecode(const char * encoded_string, size_t encoded_len, Float64 * longitude, Float64 * latitude) |
| 247 | { |
| 248 | const uint8_t precision = static_cast<uint8_t>(std::min(encoded_len, MAX_PRECISION)); |
| 249 | if (precision == 0) |
| 250 | { |
| 251 | // Empty string is converted to (0, 0) |
| 252 | *longitude = 0; |
| 253 | *latitude = 0; |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | Encoded lat_encoded; |
| 258 | Encoded lon_encoded; |
| 259 | std::tie(lon_encoded, lat_encoded) = split(base32Decode(encoded_string, precision), precision); |
| 260 | |
| 261 | *longitude = decodeCoordinate(lon_encoded, LON_MIN, LON_MAX, singleCoordBitsPrecision(precision, LONGITUDE)); |
| 262 | *latitude = decodeCoordinate(lat_encoded, LAT_MIN, LAT_MAX, singleCoordBitsPrecision(precision, LATITUDE)); |
| 263 | } |
| 264 | |
| 265 | GeohashesInBoxPreparedArgs geohashesInBoxPrepare( |
| 266 | Float64 longitude_min, |
no test coverage detected