[postgis-users] Intersection - No GID

Marcus C. England marcuscengland at gmail.com
Tue Jun 3 11:57:33 PDT 2008

Hi all,

I figured out how to use Intersection and get a resulting table with 
apparently correct results using the example from the PostGIS website:

CREATE TABLE new_fields AS
   Intersection(f.the_geom, c.the_geom) AS the_geom,
   fields f,
   clu c
   f.the_geom && c.the_geom
   Intersects(f.the_geom, c.the_geom)

However, this example does not create a gid column and I therefore can 
not view the results in a GIS program. Is there a way to create a gid 
column after-the-fact?

Optional questions for those feeling super-helpful:

(1) How should the above SQL be rewritten to include gid in the 
resulting table?

(2) I know that eliminating the first line will simply give me a table 
spit onto the SQL results in pgAdmin. How do I alter the SQL above to 
give me the acreages rather then a list of the geometries? I can get the 
acreages from the table resulting from the above, but I can't figure out 
how to skip the step of creating a table.

(3) What is the syntax using ST_Intersection rather than Intersection?



More information about the postgis-users mailing list