Name

st_contains — Returns true if all points of a given geometry g2 are in another geometry g1.

Synopsis

st_contains ( in g1 any ,
  in g2 any ,
  in prec double precision );
 

Description

Returns true if all points of a given geometry g2 are in another geometry g1. If prec is supplied, this is a tolerance for the matching in units of linear distance appropriate to the srid. Both geometries should have the same srid.

Parameters

g1

The first geometry.

g2

The second geometry.

prec

A tolerance for the matching in units of linear distance appropriate to the srid. Default is 0.

Return Types

Returns int.

Examples

Example 24.145. Simple Use

SQL>SPARQL
SELECT ?c COUNT (*)
WHERE
  {
    ?m geo:geometry ?geo .
    ?m a ?c .
    FILTER (bif:st_contains (?geo, bif:st_point (0, 52)))
  }
GROUP BY ?c ?geo
ORDER BY DESC 2;

c                                                                     callret-1
ANY                                                                   ANY
________________________________________________________________________________
 http://dbpedia.org/class/yago/Landmark108624891	              12
 http://www.w3.org/2002/07/owl#Thing	                              3
 http://dbpedia.org/ontology/Place	                              3
 http://dbpedia.org/ontology/PopulatedPlace	                      2
 http://dbpedia.org/class/yago/TowersInTheNetherlands	              2
 http://dbpedia.org/class/yago/TowersInGermany	                      1
 http://dbpedia.org/class/yago/HillsOfWarwickshire	              1
 http://dbpedia.org/class/yago/PrehistoricSitesInPembrokeshire	      1
 http://dbpedia.org/class/yago/HillsOfSomerset	                      1
 http://dbpedia.org/class/yago/PeninsulasOfTheFalklandIslands	      1
 http://dbpedia.org/class/yago/HillsOfWiltshire	                      1
 http://dbpedia.org/class/yago/HillsOfOxfordshire	              1
 http://dbpedia.org/class/yago/HillsOfGloucestershire	              1
 http://dbpedia.org/ontology/City	                              1
 http://dbpedia.org/class/yago/HillsOfWorcestershire	              1
 http://dbpedia.org/class/yago/GuyedMasts	                      1
 http://dbpedia.org/ontology/Building	                              1
 http://dbpedia.org/class/yago/Cities,TownsAndVillagesInGelderland    1
 http://dbpedia.org/ontology/Area	                              1
 http://dbpedia.org/class/yago/FormerMunicipalitiesOfGelderland	      1
No. of rows in result: 20