MCPcopy Create free account
hub / github.com/apache/arrow / GetWKBPointCoordinateXY

Function GetWKBPointCoordinateXY

cpp/src/parquet/test_util.cc:238–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238std::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
261std::shared_ptr<::arrow::DataType> geoarrow_wkb(
262 std::string metadata, const std::shared_ptr<::arrow::DataType> storage) {

Callers 2

TestWriteAndReadMethod · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.85

Calls 1

GeometryTypeToWKBFunction · 0.85

Tested by

no test coverage detected