help Function ST_Overlaps

30 views
Skip to first unread message

ugo montorsi

unread,
Apr 4, 2016, 5:33:25 AM4/4/16
to SpatiaLite Users
Hello, I work in qgis with Roberto Angeletti, my query is:

SELECT a.pk_uid AS IdCatanzaro,

a.gid AS GidCatanzaro,

a.cod_reg AS CodregCatanzaro,

a.cod_pro AS CodCatanzaro,

a.nome_pro AS ProCatanzaro,

a.Geometry AS GeometryCatanzaro,

b.pk_uid AS IdProVoli6,

b.gid AS GidProVoli6,

b.cod_pro AS CodProVoli6,

b.nome_pro AS ProVoli6,

b.Geometry AS GeometryProVoli6,

ST_Intersection(a.Geometry, b.Geometry) AS IntersCatanzaroProVoli6

FROM ProvinciaCatanzaro AS a, ProvinceVoli6 AS b

WHERE ST_Overlaps(a.Geometry, b.Geometry) = 1

GROUP BY b.cod_pro

ORDER BY b.nome_pro;

As I need to extrapolate those polygons whose geometries intersect and overlap between two polygons, so, the "ST_Overlaps" put in the where condition is set as above ie:

where ST_Overlaps (a.geom, b.geom) = 1

or it this way

where ST_Overlaps (a.geom, b.geom)
Could you give me support this request.
Thanks for your support,
Greetings,
Ugo Montorsi

a.fu...@lqt.it

unread,
Apr 4, 2016, 5:54:59 AM4/4/16
to spatiali...@googlegroups.com
On Mon, 4 Apr 2016 02:33:25 -0700 (PDT), ugo montorsi wrote:
> As I need to extrapolate those polygons whose geometries intersect
> and
> overlap between two polygons, so, the "ST_Overlaps" put in the where
> condition is set as above ie:
>
> where ST_Overlaps (a.geom, b.geom) = 1
>
> or it this way
>
> where ST_Overlaps (a.geom, b.geom)
>

Ciao Ugo,

in SpatiaLite ST_Overlaps (and many others Spatial SQL functions
such as ST_Crosses, ST_Equals, ST_Intersects, ST_Touches ...)
will possibly return:

1: if the spatial relationship between the two geometries
is effectively satisfied
0: if not
-1: if same error is detected (e.g. passing illegal arguments)

Accordingly to the SQL syntax rules, when you specify a construct
like:

WHERE ST_Overlaps (a.geom, b.geom)

then the WHERE condition will be assumed to be satisfied if the
function returns any boolean TRUE value, that is any other
integer value different from 0. so even the "illegal args" case
will lead to a misleading TRUE condition.

this is the real reason fully explaining why the correct
way to write such a test should always be:

WHERE ST_Overlaps (a.geom, b.geom) = 1

bye Sandro

Roberto Angeletti

unread,
Apr 4, 2016, 6:34:10 AM4/4/16
to spatiali...@googlegroups.com, monto...@gmail.com
Hi Sandro,

I have a this question from my collegue:
Reply all
Reply to author
Forward
0 new messages