spatial
Module[Spatial]: values of point, linestring and polygon attributes.
Contents
use utopia_database::validator::spatial::Spatial;Rust
pub struct SpatialA geometry of one spatial type: null, a WKT string (POINT(...),
LINESTRING(...), POLYGON(...)), or coordinates as arrays: a point
[x, y], a linestring of at least two points, a polygon of closed rings
of at least four points (or one such ring). Longitudes are within
±180, latitudes within ±90.
Rust
use utopia_database::validator::spatial::Spatial;
use utopia_database::value::{list, Value};
let point = Spatial::new("point");
assert!(point.is_valid(&list([Value::Float(10.0), Value::Float(20.0)])));
assert!(!point.is_valid(&list([Value::Float(200.0), Value::Float(20.0)])));
assert_eq!(point.description(), "Value must be a valid point: Longitude (x) must be between -180 and 180, got 200");