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


##########
parquet-geospatial/src/types.rs:
##########
@@ -0,0 +1,394 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow_schema::{ArrowError, DataType, extension::ExtensionType};
+use serde::{Deserialize, Serialize};
+
+/// Hints at the likely Parquet geospatial logical type represented by a 
[`Metadata`].
+///
+/// Based on the `algorithm` field:
+/// - [`Hint::Geometry`]: WKB format with linear/planar edge interpolation
+/// - [`Hint::Geography`]: WKB format with explicit non-linear/non-planar edge 
interpolation
+///
+/// See the [Parquet Geospatial 
specification](https://github.com/apache/parquet-format/blob/master/Geospatial.md)
+/// for more details.
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
+pub enum Hint {
+    /// Geospatial features in WKB format with linear/planar edge interpolation
+    Geometry,
+    /// Geospatial features in WKB format with explicit non-linear/non-planar 
edge interpolation
+    Geography,
+}
+
+/// The metadata associated with a [`WkbType`].
+#[derive(Clone, Debug, Default, Serialize, Deserialize)]
+pub struct Metadata {
+    /// The Coordinate Reference System (CRS) of the [`WkbType`], if present.
+    ///
+    /// This may be a raw string value (e.g., "EPSG:3857") or a JSON object 
(e.g., PROJJSON).
+    /// Note: Common lon/lat CRS representations (EPSG:4326, OGC:CRS84) are 
canonicalized
+    /// to `None` during serialization to match Parquet conventions.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub crs: Option<serde_json::Value>,

Review Comment:
   Unlike GeoArrow, the Parquet spec for this metadata does not carry any 
notion of `crs_type`. There are some "recommended" conventions for how to 
communicate the type, but they are guidelines as opposed to actual spec defined 
rules:
   
https://github.com/apache/parquet-format/blob/master/Geospatial.md#crs-customization
   
   My reading of the Parquet spec suggests that _technically_ any string (or 
lack thereof) is a valid value for `crs`. Again, I think that the general sense 
was CRS validation (outside of avoiding double-escaped json strings) was not 
really the job of this code and that should be handled by users. If we want 
some additional validation here I'd be happy to add this.



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