Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to infer only geometry type/dimension #117

Open
kylebarron opened this issue Sep 24, 2024 · 1 comment
Open

API to infer only geometry type/dimension #117

kylebarron opened this issue Sep 24, 2024 · 1 comment

Comments

@kylebarron
Copy link
Contributor

In cases like GeoArrow, it's nice to know if all input geometries have a common geometry type.

This would mean an API like

pub enum GeometryType {
    Point,
    LineString,
    ...,
    PointZ,
    PointM,
    PointZM,
}

and then

pub fn infer_type(wkt: &str) -> GeometryType {}

infer_type would only parse up to the first ( character, using that text to infer the geometry type and dimension.

There's a tradeoff between time spent first parsing the text to get the geometry types and then again to actually parse the geometries, vs memory overhead of parsing all objects first to Wkt objects and then inferring what type of array builder to use.

But I figure that scanning a string for the first instance of ( and matching those first characters should be very fast, especially if no numeric parsing needs to happen for that first stage.

Thoughts?

@kylebarron
Copy link
Contributor Author

For reference, in geoarrow-rs we plan to use the wkt crate directly for reading/writing WKT instead of using the geozero wrapper. See geoarrow/geoarrow-rs#790, geoarrow/geoarrow-rs#762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant