[postgis-users] Error when adding a polygon to a topology

Paolo Crosato paolo.crosato at targaubiest.com
Mon Jan 14 02:03:53 PST 2013


Hi,

I'm building a topology from a big set of features, around 100k with 37 
million vertexes. Since loading the whole set at once with toTopoGeom 
wasn't feasible,
I partitioned my data country by country first, then I tried to load 
polygon by polygon. No matter the method, after around 25k polygons I 
get this error:

DBD::Pg::db do failed: ERROR:  GEOSContains: TopologyException: side 
location conflict at 0.097239999999999993 48.088819999999998
CONTEXT:  SQL statement "UPDATE eu_geom_base_topo.edge_data SET 
left_face = CASE WHEN left_face = 25444 THEN 25612 ELSE left_face END, 
right_face = CASE WHEN right_face = 25444 THEN 25612 ELSE right_face END 
WHERE ( left_face = 25444 OR right_face = 25444) AND NOT edge_id = ANY 
('{87330,87328,87153,87155,87036,87152,87327,87328,87174,87245,87246,87279,87283,87278,87282,87167,87168,87170,87018,87020,87052,87054,87055,87247,87248,87250,87301,87303,87293,87226,87292,87329}') 
AND NOT 
ST_Contains('0103000020E610000001000000C30B0000B858518369189E3F336DFFC.........'::geometry, 
geom)"
PL/pgSQL function "_st_addfacesplit" line 114 at instruction EXECUTE
SQL statement "SELECT topology._ST_AddFaceSplit(atopology, 
newedge.edge_id, newedge.left_face, false)"
PL/pgSQL function "st_addedgemodface" line 506 at instruction SQL
PL/pgSQL function "topogeo_addlinestring" line 124 at assignment
SQL statement "SELECT array_cat(edges, array_agg(x)) FROM ( select 
topology.TopoGeo_addLinestring(atopology, rec.geom, tol) as x ) as foo"
PL/pgSQL function "topogeo_addpolygon" line 24 at assignment
PL/pgSQL function "totopogeom" line 100 at loop FOR su righe di SELECT 
at ./processWorkDb.pl line 797.

Had to truncate the geometry in ST_contains because of the message size 
limit, the hexdump of the geometry is around 200k.

The instruction that fails is something like:

UPDATE eu_geom_base
SET topogeom = toTopoGeom(geom, 'eu_geom_base_topo', 1)
WHERE eu_geom_base.named_place_id= 20077019

It doesn't fail with just a specific geometry, this example is the last 
one I found.

If I try to issue it in pgadmin it keeps failing, so it's not something 
related to the loader script.
I tried to look for the error, it seems it's failing at this line

result = GEOSContains( g1, g2);

of postgis/lwgeom_geos.c 
<http://postgis.net/docs/doxygen/2.1/d4/d06/postgis_2lwgeom__geos_8c_source.html>. 
I'd guess it's geos throwing a topologyexception because of the geometry.

My postgis full version is: "POSTGIS="2.0.1 r9979" 
GEOS="3.3.6-CAPI-1.7.6" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 
1.9.2, released 2012/10/08" LIBXML="2.7.8" TOPOLOGY RASTER"

Would upgrade to postgis 2.0.2 help for this issue?

I'm loading geometries with a "default" 1 tolerance, would play with 
this parameter help to solve the issue? Would it dissolve geometries?

Thanks for any feedback.

Regards,

Paolo

-- 
Paolo Crosato

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130114/3df8bc88/attachment.html>


More information about the postgis-users mailing list