I'm need to write a query to check if a determined Point is inside a Polygon.
I'm trying to use GeoSparql, but isn't producing the expected results.
If I execute a simple query, like it:
PREFIX iot-lite: <http://purl.oclc.org/NET/UNIS/fiware/iot-lite#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT ?poligono ?pointGeo
WHERE{
?casa iot-lite:hasPoint ?poligono ;
rdf:type iot-lite:Polygon .
?point rdf:type geo:Point ;
iot-lite:hasPoint ?pointGeo .
}
The results are:
?poligon
"POLYGON((-16.67362 -49.24468, -16.67363 -49.24466, -16.67365 -49.24468, -16.67364 -49.2447, -16.67364 -49.24468))"^^<http://www.opengis.net/ont/sf#wktLiteral>
?pointgeo
"POINT((-16.67363 -49.24468))"^^<http://www.opengis.net/ont/sf#wktLiteral>
But if i add the filter below to the query, it return nothing. But the problem is: the point is within the polygon
FILTER (geof:sfWithin(?pointGeo, ?poligono))