[postgis-users] correcting polygons

Malm Paul paul.malm at saabgroup.com
Fri Jun 1 01:49:58 PDT 2007


Thanks, Paul!

I'm not to good in SQL and have looked at old userGroup qestions and
found this (Regina Obe):
(converting multi polygons to polygons by creating a new tabel)
/////////////////////////////////////////
String table = "depare_area";
String qq;
myStat = con.createStatement();

qq= "SELECT geometryN(the_geom, generate_series(1,
numgeometries(the_geom))) AS poli FROM " + table;
Statement myStat2 = con.createStatement();
ResultSet myResult2 = myStat2.executeQuery(qq);

qq = "CREATE TABLE " + table + "2 " + "(gid serial, CONSTRAINT " + "pk_"
+ table + "2 " + " PRIMARY KEY(gid))";
myStat.execute(qq);

qq = "SELECT AddGeometryColumn('public','" + table + "2', 'poli', '-1',
'POLYGON',2)";
myStat.execute(qq);

qq = "INSERT INTO " + table + "2(poli) SELECT geometryn(the_geom,
generate_series(1, numgeometries(the_geom))) As poli FROM " + table;
myStat.execute(qq);
			
qq = "CREATE INDEX idx_" + table + "2_poli  ON " + table + "2  USING
gist (poli)";
myStat.execute(qq);
//////////////////////////////////////////////

Du you know how I at the same time can use your suggestion to use
buffer(xxxx, 0.0) to correct the polygons?

I have not found anything of how to update objects, only how to create
new objects.

Kind regards,
Paul
  

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: den 30 maj 2007 20:01
To: PostGIS Users Discussion
Subject: Re: [postgis-users] correcting polygons

buffer(polygon,0.0) should re-build it with correct structure

On 30-May-07, at 7:29 AM, Malm Paul wrote:

> Hi list,
> Is there a simple way to correct a polygon that has a hole and where 
> one of the coordinates of that hole is exactly the same as one 
> coordinate in the external ring?
>
> Kind regards,
> Paul
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list