#2739 closed defect (fixed)
ST_Intersection problem
Reported by: | pascal | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | |
Component: | postgis | Version: | 2.1.x |
Keywords: | Cc: |
Description
The ST_Intersection of the following two Polygon-Tables in PostgreSQL DB result in a wrong intersection-geometry:
Table A: "SRID=21781;POLYGON((652487.310697571 166905.704519917,652646.295802968 166543.52900648,652525.223101453 166292.782810446,652525.223101453 166292.782810446,651985.3579406 165631.183348616,651980.065144905 165631.183348616,651853.038048234 166139.291735302,6 (…)" "SRID=21781;POLYGON((652525.223101453 166292.782810446,652526.8368147 166305.841154341,654187.160949569 166372.174745866,655557.995034481 166017.557434325,652377.024822003 164360.912381903,652377.024822003 164360.912381903,651980.065144905 165631.183348616, (…)" "SRID=21781;POLYGON((652526.8368147 166305.841154341,652644.509155265 166539.828790745,652855.11313311 166689.246287948,654119.42970467 166448.093284111,654187.160949569 166372.174745866,652526.8368147 166305.841154341))" "SRID=21781;POLYGON((651792.92747552 165636.217563159,651980.065144905 165631.183348616,651853.038048234 166139.291735302,651704.839768784 166901.45431533,651574.948487674 166891.790206689,651094.095728285 166224.521543424,651094.095728285 166224.521543424, (…)" "SRID=21781;POLYGON((651704.839768784 166901.45431533,651574.948487674 166891.790206689,651444.19411769 167068.852341229,652488.173531591 166906.747111024,652487.310697571 166905.704519917,651853.038048234 166139.291735302,651704.839768784 166901.45431533))"
Table B: "SRID=21781;MULTIPOLYGON(((651629.556330106 166612.81993413,651956.345108947 166568.130870357,652076.446967838 166193.859961257,651956.345108947 166087.723434796,651978.689640834 165892.208780788,651917.046727391 165883.257018676,651925.425926848 165849.740 (…)"
SQL: CRATE TABLE inters AS (SELECT ST_Intersection(a.geom,b.geom) AS intersection_geom FROM tableA AS a, tableB AS b WHERE a.geom && b.geom);
Result: "SRID=21781;GEOMETRYCOLLECTION(LINESTRING(651925.425926848 165849.740220846,651918.909381221 165875.806403356),LINESTRING(651918.909381221 165875.806403356,651917.046727391 165883.257018676),POLYGON((651917.046727391 165883.257018676,651853.038048234 166139 (…)" "SRID=21781;GEOMETRYCOLLECTION EMPTY" "SRID=21781;GEOMETRYCOLLECTION EMPTY" "SRID=21781;MULTIPOLYGON(((651918.909381221 165875.806403356,651925.425926848 165849.740220846,651869.760047887 165848.916250258,651851.255982418 165952.608843544,651898.337289386 165958.094770693,651853.038048234 166139.291735302,651917.046727391 165883.25 (…)" "SRID=21781;POLYGON((652026.642685167 166349.064004929,651853.038048234 166139.291735302,651764.552769598 166594.358882576,651956.345108947 166568.130870357,652026.642685167 166349.064004929))"
Attachments (1)
Change History (6)
comment:1 by , 11 years ago
Milestone: | → PostGIS 2.1.4 |
---|
by , 11 years ago
Attachment: | intersection.sql added |
---|
comment:2 by , 11 years ago
Thanks for hint. The sql dump file is in attachement. Version details: "PostgreSQL 9.3.2, compiled by Visual C++ build 1600, 32-bit"; "POSTGIS="2.1.1 r12113" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER"
comment:3 by , 11 years ago
Not following you. What do you think is wrong here:
I'm running this query:
SELECT b.id_0 As b, a.id_0 as a, ST_AsText(ST_Intersection(a.geom,b.geom)) AS intersection_geom FROM verschn_fehler.object AS a, verschn_fehler.parcels AS b WHERE a.geom && b.geom; --and get 4 rows back b | a | intersection_geom ---+----+------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------ 1 | 10 | GEOMETRYCOLLECTION(LINESTRING(651917.046727391 165883.257018676,651918.909381221 165875.80 6403356),LINESTRING(651918.909381221 165875.806403356,651925.425926848 165849.740220846),POLYGON((65 2026.642685167 166349.064004929,652076.446967838 166193.859961257,651956.345108947 166087.723434796, 651978.689640834 165892.208780788,651917.046727391 165883.257018676,651853.038048234 166139.29173530 2,652026.642685167 166349.064004929))) 2 | 10 | GEOMETRYCOLLECTION EMPTY 4 | 10 | MULTIPOLYGON(((651629.556330106 166612.81993413,651764.552769598 166594.358882576,651853.0 38048234 166139.291735302,651718.934457652 166490.972408686,651629.556330106 166612.81993413)),((651 917.046727391 165883.257018676,651918.909381221 165875.806403356,651925.425926848 165849.740220846,6 51869.760047887 165848.916250258,651851.255982418 165952.608843544,651898.337289386 165958.094770693 ,651853.038048234 166139.291735302,651917.046727391 165883.257018676))) 5 | 10 | POLYGON((651764.552769598 166594.358882576,651956.345108947 166568.130870357,652026.642685 167 166349.064004929,651853.038048234 166139.291735302,651764.552769598 166594.358882576)) (4 rows)
If I run the more proper:
SELECT b.id_0 As b, a.id_0 as a, ST_AsText(ST_Intersection(a.geom,b.geom)) AS intersection_geom FROM verschn_fehler.object AS a, verschn_fehler.parcels AS b WHERE ST_Intersects(a.geom,b.geom);
I get 3 rows back (minus the empty geometry colloection)
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
You are right. The ST_Intersection result is correct. The problem was the GEOMETRYCOLLECTION, GIS couldn't represent this type. So, everything is O.K. I'm really sorry for wasting your time!
comment:5 by , 11 years ago
Milestone: | PostGIS 2.1.4 |
---|
Your table geometries got cut off and they are ST_AsText representations so don't have the full resolution of the original geometries. Can you provide an sql dump file that contains the two tables in question each containing the geometry in question?
Also please provide your version details: