[postgis-users] Join variation

RAVI KUMAR ravivundavalli at yahoo.com
Thu Sep 13 23:17:09 PDT 2007


Hi Regina,
this gave me the result, but there are lot of overlapping polygons.
Is there any more syntax (keywords) to ask system to polygonise such that there are no overlapping polygons.
cheers
Ravi Kumar


"Obe, Regina" <robe.dnd at cityofboston.gov> wrote:     First I would call your field something other than geometry  since that is confusing and could get you into trouble since its a psuedo  keyword
  
 So would be something like
  
 DROP TABLE  abc
 CREATE TABLE abc(code smallint, info smallint,  the_geom geometry) with oids
  
 (you might want to use addgeomtrycolumn to create the_geom  field so geometry_columns table is updated, but I'm not sure what you are  expecting for a geometry so not sure what parameters to feed you but would be  something like this.
  
 CREATE TABLE  abc(code smallint, info smallint) with oids;
 SELECT  AddGeometryColumn('public', 'abc', 'the_geom', 4326, 'MULTIPOLYGON',  2);
  
 --The insert
  
 INSERT INTO abc(code, info,  the_geom)
  SELECT newtb.code,  newtb.info, geomunion(newtb.cgeom)  as thenewgeom
 FROM 
 (  SELECT a.code, b.info, geomunion(a.geometry, b.geometry) as cgeom
     FROM a
         INNER  JOIN b ON a.geometry  && b.geometry AND intersects(a.geometry, b.geometry)
     UNION ALL
     SELECT a.code, null As info, a.geometry  as cgeom      FROM a 
         LEFT  JOIN b ON a.geometry  && b.geometry AND intersects(a.geometry, b.geometry)

         WHERE b.geometry  IS NULL
     UNION ALL
     SELECT null as code, b.info, b.geometry  as cgeom
              FROM b LEFT JOIN a ON a.geometry  && b.geometry AND intersects(a.geometry, b.geometry)
             WHERE a.geometry IS NULL
 )  AS newtb
 GROUP BY newtb.code,  newtb.info


  
---------------------------------
 From:  postgis-users-bounces at postgis.refractions.net  [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of RAVI  KUMAR
Sent: Thursday, September 13, 2007 8:17 AM
To:  postgis
Subject: [postgis-users] Join variation


 
Hi Andreas and Regina,
I have used the following to get a result  which will have polygons that do not overlap.
But failed. 
Pl help me and  correct the following query.
All I want is that after UNION of two layers,  the polygons must split and have both the attributes of source layers. (NO PLace  for overlapping polygons)

drop table abc;
create table abc (code  smallint, info smallint, geometry geometry) with oids;

insert into abc  (select a.code, b.info,(geomunion(a.geometry,
 b.geometry)) AS abc FROM  b inner JOIN a ON (a.geometry && b.geometry AND   intersects(a.geometry, b.geometry)));

I can actually send two small shape  files 'a' and 'b' If U want to private mail Ids..
Along with the result I  wish to get..

Cheers
Ravi Kumar
  

---------------------------------
 Got a little couch potato? 
Check out fun summer  activities for kids.

---------------------------------

  The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer. 
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


       
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070913/9ddf6472/attachment.html>


More information about the postgis-users mailing list