BlakeOrth commented on code in PR #8801:
URL: https://github.com/apache/arrow-rs/pull/8801#discussion_r2504961693


##########
parquet-geospatial/src/crs.rs:
##########
@@ -0,0 +1,97 @@
+use std::{collections::HashMap, sync::Arc};
+
+use arrow_schema::{Schema, SchemaBuilder};
+use serde_json::{Value, json};
+
+#[derive(Debug)]
+pub enum Crs {
+    Projjson(serde_json::Value),
+    Srid(u64),
+    Other(String),
+}
+
+impl Crs {
+    // TODO: make fallible
+    fn try_from_parquet_str(crs: &str, metadata: &HashMap<String, String>) -> 
Self {
+        let de: Value = serde_json::from_str(crs).unwrap();
+
+        // A CRS that does not exist or is empty defaults to 4326
+        // TODO: http link to parquet geospatial doc
+        let Some(crs) = de["crs"].as_str() else {
+            return Crs::Srid(4326);
+        };

Review Comment:
   Can you help me understand this a bit better?
   
   This code was an attempt to solve the case where a parquet file omits the 
CRS metadata. The spec states:
   
   > The default CRS OGC:CRS84 means that the geospatial features must be 
stored in the order of longitude/latitude based on the WGS84 datum.
   > ...
   > For geographic CRS, longitudes are bound by [-180, 180] and latitudes are 
bound by [-90, 90].
   
   Doesn't this functionally bind an unspecified CRS to `SRID:4326` ? 
`SRID:3857` also WGS84 datum, but it doesn't satisfy the lon/lat bounding 
conditions.



-- 
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]

Reply via email to