petern48 commented on code in PR #476: URL: https://github.com/apache/sedona-db/pull/476#discussion_r2656968224
########## c/sedona-geos/src/geos_to_wkb.rs: ########## @@ -0,0 +1,503 @@ +// 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 std::io::Write; + +use byteorder::{LittleEndian, WriteBytesExt}; +use datafusion_common::{error::Result, exec_err, DataFusionError}; +use geos::{Geom, Geometry, GeometryTypes}; + +// TODO: +const NATIVE_ENDIANNESS: u8 = 1; + +/// Write a GEOS geometry to WKB format. +/// +/// This is a fast, custom implementation that directly extracts coordinates +/// from GEOS geometries and writes them in WKB format into a buffer. +pub fn write_geos_geometry(geom: &Geometry, writer: &mut impl Write) -> Result<()> { Review Comment: I just realized I kinda just picked ISO WKB and it worked. Should I keep this, support EWKB instead or support both? i don't quite have the strongest understanding of how SRIDs fit into this picture. ik it's stored in metadata, so i'm guessing that just handled completely separate from the geos geometries and there's no need to worry about that here? -- 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]
