[go: up one dir, main page]

Function infer_type

Source
pub fn infer_type(input: &str) -> Result<(GeometryType, Dimension), String>
Expand description

Infer the geometry type and dimension from an input WKT string slice.

An EMPTY WKT object will return None in place of the dimension.

use wkt::infer_type;
use wkt::types::{Dimension, GeometryType};

assert_eq!(
    infer_type("POINT (10 20.1)").unwrap(),
    (GeometryType::Point, Dimension::XY)
);

assert_eq!(
    infer_type("POINT Z EMPTY").unwrap(),
    (GeometryType::Point, Dimension::XYZ)
);