Opened 11 years ago

Closed 9 years ago

#2391 closed defect (duplicate)

TopoGeo_AddLineString splits again on second call

Reported by: robe Owned by: strk
Priority: medium Milestone: PostGIS 2.2.0
Component: topology Version: 2.1.x
Keywords: Cc:

Description (last modified by robe)

strk,

Not sure if this is related to issue #2273 I complained about.

POSTGIS="2.2.0dev r11710" GEOS="3.4.0dev-CAPI-1.8.0 r3846" 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 PostgreSQL 9.3beta2, compiled by Visual C++ build 1600, 64-bit

and I tried with my PostgreSQL 9.2 64-bit install too and have the same issue.

Anyway I'm puzzled by this to recreate

run the attached ch08_staging (for the record data is the city boundary file from here http://www.victoria.ca/EN/main/city/open-data-catalogue.html)

SELECT CreateTopology('ch08_topology',4326);
SELECT gid, TopoGeo_AddLineString('ch08_topology', geom) As edge_id 
FROM (SELECT gid, (ST_Dump(geom)).geom 
 FROM ch08_staging.cityboundary
) As f;
-- outputs --
gid | edge_id
1,1

SELECT topologysummary('ch08_topology');

outputs:

                  topologysummary
----------------------------------------------------
 Topology ch08_topology (1), SRID 4326, precision 0+
 1 nodes, 1 edges, 1 faces, 0 topogeoms in 0 layers+

run the add again

SELECT gid, TopoGeo_AddLineString('ch08_topology', geom) As edge_id 
FROM (SELECT gid, (ST_Dump(geom)).geom 
 FROM ch08_staging.cityboundary
) As f;

Get output:

 gid | edge_id
-----+---------
   1 |       1
   1 |       2

Where did edge_id 2 come from.

SELECT topologysummary('ch08_topology');

outputs:

                  topologysummary
----------------------------------------------------
 Topology ch08_topology (1), SRID 4326, precision 0+
 2 nodes, 2 edges, 1 faces, 0 topogeoms in 0 layers+

Is this a bug or just an occupational hazard with tolerances? Unfortunately if I repeat the above exercise with something like I still get an additional split the second call.

SELECT gid, TopoGeo_AddLineString('ch08_topology', geom, 0.0001) As edge_id 
FROM (SELECT gid, (ST_Dump(geom)).geom 
 FROM ch08_staging.cityboundary
) As f;

I've also tested on 2.1.0 and have same issue, but haven't tested on 2.0.

Attachments (2)

ch08_staging.sql (3.9 KB ) - added by robe 11 years ago.
fig_victoria_after.png (38.3 KB ) - added by robe 11 years ago.

Download all attachments as: .zip

Change History (10)

by robe, 11 years ago

Attachment: ch08_staging.sql added

comment:1 by robe, 11 years ago

Description: modified (diff)

comment:2 by strk, 11 years ago

Sounds like a duplicate of #2175 — please verify and close this one if convinced

comment:3 by robe, 11 years ago

I didn't read through all the #2175, but I've concluded this isn't really a bug since I end up with the same face in both cases. The only difference is when you run the second time, the first edge is split at ( -123.39807825809805 48.41413244074219 )

and ( -123.38462716264604 48.44945686262085 )

and In the second its just a single line string. If you take the set of points that forms both, (I tested with ST_AsText EXCEPT), you end up with the same set of points as well.

comment:4 by robe, 11 years ago

Then again, I'm still bothered why running a process twice results in different keys. Only reason I am bothered by this is that it means you can't easily use this function to populate a table since the second time you run it, the edge ids will be different.

comment:5 by robe, 11 years ago

Summary: TopoGeo_AddPolygon splits again on second callTopoGeo_AddLineString splits again on second call

comment:6 by robe, 11 years ago

strk,

I think you are right that it's a duplicate of #2175. See attached image.

by robe, 11 years ago

Attachment: fig_victoria_after.png added

comment:7 by strk, 11 years ago

Yes, that's what you'd get. I think you could get a single node by pre-normalizing the curve to start at the lowest-leftmost vertex (but we don't have that ST_Rebase function yet…)

comment:8 by strk, 9 years ago

Resolution: duplicate
Status: newclosed

Definitely a duplicate of #2175

Note: See TracTickets for help on using tickets.