| 236 | } |
| 237 | |
| 238 | std::optional<std::pair<double, double>> GetWKBPointCoordinateXY(const ByteArray& value) { |
| 239 | if (value.len != kWkbPointXYSize) { |
| 240 | return std::nullopt; |
| 241 | } |
| 242 | |
| 243 | if (value.ptr[0] != kWkbNativeEndianness) { |
| 244 | return std::nullopt; |
| 245 | } |
| 246 | |
| 247 | uint32_t expected_geom_type = GeometryTypeToWKB(geospatial::GeometryType::kPoint, |
| 248 | /*has_z=*/false, /*has_m=*/false); |
| 249 | uint32_t geom_type = 0; |
| 250 | std::memcpy(&geom_type, &value.ptr[1], 4); |
| 251 | if (geom_type != expected_geom_type) { |
| 252 | return std::nullopt; |
| 253 | } |
| 254 | double out_x, out_y; |
| 255 | std::memcpy(&out_x, &value.ptr[5], 8); |
| 256 | std::memcpy(&out_y, &value.ptr[13], 8); |
| 257 | |
| 258 | return {{out_x, out_y}}; |
| 259 | } |
| 260 | |
| 261 | std::shared_ptr<::arrow::DataType> geoarrow_wkb( |
| 262 | std::string metadata, const std::shared_ptr<::arrow::DataType> storage) { |
no test coverage detected