Re: different results for ST_Relate with 3 parameters compared to those for ST_Relate with 2 parameters
Scott <[email protected]> Wed, 15 Oct 2025 10:45:24 -0700
| Newsgroups | gmane.comp.gis.postgis |
|---|---|
| Message-ID | <[email protected]> |
Not sure if it matters, but 3 variants of st_relate exist. The WHERE for bool is variant 1 and the WHERE for text is variant 2. Variant 2 and 3 return text, but are different return types. Maybe 2 different results is to be expected? Docs: https://postgis.net/docs/ST_Relate.html Scott On 10/15/25 10:28, Paul Ramsey via postgis-users wrote: > Maybe you have found an old bug? Running exactly the same SQL as you, I > get two rows from each query. > > postgis=# SELECT d.id <http://d.id>, > > ST_Relate(d.geom, > l.geom) as patternMatrix > > FROM docks as d, lakes as l > > WHERE ST_Relate(d.geom, l.geom, '1FF00F212'); > id | patternmatrix > ----+--------------- > 1 | 1FF00F212 > 2 | 1FF00F212 > (2 rows) > > postgis=# SELECT > postgis-# d.id <http://d.id>, > postgis-# ST_Relate(d.geom, l.geom) as patternMatrix > postgis-# FROM docks as d, lakes as l > postgis-# WHERE ST_Relate(d.geom, l.geom) = '1FF00F212'; > id | patternmatrix > ----+--------------- > 1 | 1FF00F212 > 2 | 1FF00F212 > (2 rows) > > postgis=# > postgis=# select postgis_full_version(); > > > > postgis_full_version > ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > POSTGIS="3.7.0dev 3.6.0rc2-134-g5dc95f1bc" [EXTENSION] PGSQL="180" > GEOS="3.15.0dev-CAPI-1.21.0" PROJ="9.6.2 NETWORK_ENABLED=ON > URL_ENDPOINT=https://cdn.proj.org <https://cdn.proj.org> > USER_WRITABLE_DIRECTORY=/Users/pramsey/Library/Application Support/proj > DATABASE_PATH=/opt/homebrew/Cellar/proj/9.6.2/share/proj/ > proj.db" (compiled against PROJ 9.6.2) LIBXML="2.9.13" LIBJSON="0.18" > LIBPROTOBUF="1.5.2" WAGYU="0.5.0 (Internal)" (core procs from "3.7.0dev > 3.6.0rc2-125-g747d7732b" need upgrade) > > On Wed, Oct 15, 2025 at 9:22 AM Antonio Valanzano <[email protected] > <mailto:[email protected]>> wrote: > > I am following the "Introduction to PostGIS " tutorial at https:// > postgis.net/workshops/postgis-intro/ <https://postgis.net/workshops/ > postgis-intro/> > and for chapter 26 "Dimensionally Extended 9-Intersection Model" I > am trying to replicate the examples. > > If I use the two different versions of ST_Relate I do not obtain the > same result > > SELECT > d.id <http://d.id>, > ST_Relate(d.geom, l.geom) as patternMatrix > FROM docks as d, lakes as l > WHERE ST_Relate(d.geom, l.geom, '1FF00F212') = true; > -- 1 row > "id" "patternmatrix" > 1 "1FF00F212" > > > > SELECT > d.id <http://d.id>, > ST_Relate(d.geom, l.geom) as patternMatrix > FROM docks as d, lakes as l > WHERE ST_Relate(d.geom, l.geom) = '1FF00F212'; > -- 2 rows > "id" "patternmatrix" > 1 "1FF00F212" > 2 "1FF00F212" > > Could someone give me an explanation of such a difference ? > >