[postgis-users] WKT in issue

Carl Anderson candrsn at mindspring.com
Thu Oct 3 13:31:09 PDT 2002


Occasionally while reloading pg_dump's of tables containing fields of 
type geometry

I get a
      polygon has ring where first point != last point

I does not happen every time, nor does it happen on the same tuple 

As a test I
	create table test (the_geom, rec int4);
then from an existing table containing 	MultiPolygon Geometries (about 
43,000 of them)
	insert into test (the_geom,rec) (select the_geom,oid from 
my_shapes);

and again occasionally still I get
      polygon has ring where first point != last point

So random geometries that earilier validated occasionally do not 
validate.

to visualize what is going on I added to postgis_inout.c 
--- postgis-0.7.3/postgis_inout.c       Thu Jul  4 19:38:10 2002
+++ postgis-0.7.3a/postgis_inout.c      Thu Oct  3 12:06:51 2002
@@ -1065,7 +1066,13 @@
                          &&FPeq(pts[points_offset].y , 
pts[points_offset + npoints[t]-1].y   )
                          &&FPeq(pts[points_offset].z , 
pts[points_offset + npoints[t]-1].z   )    )   )
                 {
+#ifdef DEBUG
+       printf("1st points in ring are: [%18.18g,%18.18g,%g]", 
pts[points_offset].x, pts[points_offset].y ,pts[points_offset].z );
+       printf("-> (%d) [%18.18g,%18.18g,%g]\n", npoints[t], 
pts[points_offset + npoints[t]-1].x ,pts[points_offset + 
npoints[t]-1].y ,pts[points_offset + npoints[t]-1].z );
+       printf("%s\n",str);
+#endif
                         elog(ERROR,"polygon has ring where first point 
!= last point");
                         pfree(npoints);
                         return FALSE; //invalid poly



and I got (each time a different geometry fails, if any do at all.
so this is one instance)

1st points in ring are: [2289955.92001368012,1472488.84436563007,0]-> 
(54) [2289
955.92001368012,1472424.84436563007,0]
(2289955.92001368 1472488.84436563,2289956.19683051 
1472577.19683308,2290206.25 1472311.75,2290205.75 
1472311.125,2290204.75 1472310.375,2290204 1472309.5,22902
03 1472308.75,2290202.25 1472308,2290200.75 1472306.25,2290199.75 
1472305.5,2290
199 1472304.625,2290198.25 1472303.875,2290197.25 1472303,2290195.75 
1472301.25,
2290195 1472300.5,2290193.5 1472298.75,2290192.5 1472297.875,2290188.75 
1472293.
5,2290188 1472292.5,2290185.75 1472289.875,2290185 
1472288.875,2290184.5 1472288
,2290183.75 1472287.125,2290183 1472286.125,2290182.25 
1472285.25,2290181.5 1472
284.25,2290181 1472283.375,2290180.25 1472282.375,2290179.5 
1472281.5,2290178.75
  1472280.5,2290178.25 1472279.5,2290177.5 1472278.625,2290176.75 
1472277.625,229
0176.25 1472276.625,2290175.5 1472275.625,2290175 
1472274.625,2290174.25 1472273
.75,2290173.5 1472272.75,2290173 1472271.75,2290172.25 
1472270.75,2290171.25 147
2268.75,2290170.5 1472267.75,2290170 1472266.75,2290169.25 
1472265.625,2290168.2
5 1472263.625,2290167.5 1472262.625,2290167 1472261.625,2290166.5 
1472260.5,2290
165.5 1472258.5,2290164.75 1472257.375,2290164.5 
1472256.875,2289955.94298167 14
72366.13100364,2289956.74000007 1472488.84005,2289955.92001368 
1472488.84436563)
))





I tried this using GCC 3.0.4 and GCC 2.96
for each recompile Postgresql and postgis completely, initdb,  load 
data (may take multiple tries)
then try the insert from table to table;


I am using RH 7.2+ (2.4.19-ac4) on a i686 which has been very stable 
otherwise.


Does anyone have a hint of where to start?


C.





More information about the postgis-users mailing list