Skip to main content

st_within

Function st_within 

Source
pub fn st_within(a: &[u8], b: &[u8]) -> Result<bool>
Expand description

ST_Within: true if A is completely inside B.

ยงExample

use sqlitegis::core::functions::predicates::st_within;
use sqlitegis::core::functions::io::geom_from_text;

let pt = geom_from_text("POINT(2 2)", None).unwrap();
let poly = geom_from_text("POLYGON((0 0,4 0,4 4,0 4,0 0))", None).unwrap();
assert!(st_within(&pt, &poly).unwrap());

let outside = geom_from_text("POINT(100 100)", None).unwrap();
assert!(!st_within(&outside, &poly).unwrap());