paleolimbot commented on code in PR #45459:
URL: https://github.com/apache/arrow/pull/45459#discussion_r1974517390
##########
cpp/src/parquet/arrow/schema_internal.cc:
##########
@@ -110,8 +111,62 @@ Result<std::shared_ptr<ArrowType>>
MakeArrowTimestamp(const LogicalType& logical
}
}
+Result<std::string> MakeGeoArrowCrsMetadata(
+ const std::string& crs,
+ const std::shared_ptr<const ::arrow::KeyValueMetadata>& metadata) {
+ std::string srid_prefix{"srid:"};
+ std::string projjson_prefix{"projjson:"};
+
+ if (crs.empty()) {
+ return R"("crs": "OGC:CRS84", "crs_type": "authority_code")";
+ } else if (crs.rfind(srid_prefix, 0) == 0) {
+ return R"("crs": ")" + crs.substr(srid_prefix.size()) + R"(", "crs_type":
"srid")";
+ } else if (crs.rfind(projjson_prefix, 0) == 0) {
+ std::string metadata_field = crs.substr(projjson_prefix.size());
+ if (metadata && metadata->Contains(metadata_field)) {
+ ARROW_ASSIGN_OR_RAISE(std::string projjson_value,
metadata->Get(metadata_field));
+ return R"("crs": )" + projjson_value + R"(, "crs_type": "projjson")";
+ } else {
+ // Pass on the value of the field so the user can sort this out if needed
+ return R"("crs": )" + metadata_field + R"(, "crs_type": "projjson")";
+ }
+ } else {
+ return Status::Invalid("Can't convert invalid Parquet CRS string to
GeoArrow: ", crs);
Review Comment:
I lost track of how strict the wording was in the final spec change...it
seems it's just recommended and not required. I think it's a good idea to pass
any other string on to GeoArrow verbatim 🙂
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]