MCPcopy Create free account
hub / github.com/PDAL/PDAL / loadArrowGeoMetadata

Method loadArrowGeoMetadata

plugins/arrow/io/ArrowReader.cpp:96–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95
96void ArrowReader::loadArrowGeoMetadata(const std::shared_ptr<const arrow::KeyValueMetadata> &kv_metadata)
97{
98 if (!kv_metadata)
99 return;
100 auto geo = kv_metadata->Get("ARROW:extension:metadata");
101 NL::json metadata;
102
103 if (geo.ok())
104 {
105 // load up the JSON and set our stuff
106 try
107 {
108 metadata = NL::json::parse(*geo);
109 } catch (NL::json::parse_error& e)
110 {
111 log()->get(LogLevel::Warning) << "unable to parse GeoArrow metadata with error '"
112 << e.what() << "'" << std::endl;
113 return;
114 }
115
116
117 // std::string dimType = metadata["ARROW:extension:name"];
118 // if (!Utils::iequals(dimType, "geoarrow.point"))
119 // {
120 // std::stringstream oss;
121 // oss << "GeoArrow metadata does not contain 'geoarrow.point' data. It contains '"
122 // << dimType << "' data." << std::endl;
123 // throwError(oss.str());
124 // }
125
126 if (!metadata.contains("crs"))
127 {
128 log()->get(LogLevel::Warning) << "GeoArrow metadata does not contain 'crs' entry"
129 << std::endl;
130 return;
131 }
132 NL::json crs = metadata["crs"];
133
134 SpatialReference ref;
135 if (crs.is_object())
136 {
137 ref.set(crs.dump());
138 }
139 else if (crs.is_string())
140 {
141
142 ref.set(crs.get<std::string>());
143 }
144
145
146 setSpatialReference(ref);
147 } else
148 {
149 log()->get(LogLevel::Warning) << "No GeoArrow metadata available for this column" <<std::endl;
150 }
151
152}
153

Callers

nothing calls this directly

Calls 8

parseFunction · 0.50
logFunction · 0.50
setSpatialReferenceFunction · 0.50
getMethod · 0.45
whatMethod · 0.45
containsMethod · 0.45
setMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected