45342 {
45343
45344
45346
45347 unique_ptr<CoordinateReferenceSystem> duckdb_crs;
45348
45349 if (!extension_metadata.empty()) {
45351 duckdb_yyjson::yyjson_read(extension_metadata.data(), extension_metadata.size(),
45352 duckdb_yyjson::YYJSON_READ_NOFLAG),
45353 duckdb_yyjson::yyjson_doc_free);
45354 if (!doc) {
45355 throw SerializationException("Invalid JSON in GeoArrow metadata");
45356 }
45357
45360 throw SerializationException("Invalid GeoArrow metadata: not a JSON object");
45361 }
45362
45365 throw NotImplementedException("Can't import non-planar edges");
45366 }
45367
45368
45370
45371 if (crs) {
45372 if (duckdb_yyjson::yyjson_is_str(crs)) {
45375 } else if (duckdb_yyjson::yyjson_is_obj(crs)) {
45376
45378 size_t len = 0;
45380 if (crs_str) {
45381 const auto str = string(crs_str, len);
45382 free(crs_str);
45384 } else {
45385 throw SerializationException("Could not serialize CRS object from GeoArrow metadata");
45386 }
45387 }
45388 }
45389 }
45390
45391
45392 auto geo_type = duckdb_crs ? LogicalType::GEOMETRY(*duckdb_crs) : LogicalType::GEOMETRY();
45393
45396 return make_uniq<ArrowType>(std::move(geo_type), make_uniq<ArrowStringInfo>(ArrowVariableSizeType::NORMAL));
45397 }
45399 return make_uniq<ArrowType>(std::move(geo_type),
45400 make_uniq<ArrowStringInfo>(ArrowVariableSizeType::SUPER_SIZE));
45401 }
45403 return make_uniq<ArrowType>(std::move(geo_type), make_uniq<ArrowStringInfo>(ArrowVariableSizeType::VIEW));
45404 }
45405 throw InvalidInputException(
"Arrow extension type \"%s\" not supported for geoarrow.wkb",
format.c_str());
45406 }
static unique_ptr< CoordinateReferenceSystem > TryIdentify(ClientContext &context, const string &source_crs)
Definition duckdb.cpp:121550
yyjson_api_inline bool yyjson_is_str(yyjson_val *val)
Definition duckdb.cpp:41935
yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)
Definition duckdb.cpp:42203
yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)
Definition duckdb.cpp:42014
yyjson_api_inline char * yyjson_val_write(const yyjson_val *val, yyjson_write_flag flg, size_t *len)
Definition duckdb.cpp:38495
static const yyjson_write_flag YYJSON_WRITE_NOFLAG
Definition duckdb.cpp:38117
uint32_t yyjson_write_flag
Definition duckdb.cpp:38110
yyjson_api_inline bool yyjson_is_obj(yyjson_val *val)
Definition duckdb.cpp:41943
struct yyjson_doc yyjson_doc
Definition duckdb.cpp:37748
struct yyjson_val yyjson_val
Definition duckdb.cpp:37755
std::basic_string< Char > format(const S &format_str, Args &&... args)
Definition duckdb.cpp:16295
yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)
Definition duckdb.cpp:41868
const char * format
Array type description.
Definition duckdb.hpp:11265