[postgis-users] GeometryCollection
benton101
Ben.Davies at dec.wa.gov.au
Thu May 14 02:14:04 PDT 2009
Hi,
I have imported two shape files into PostGIS tables using QGIS. One file is
a polygon file and the other is a line file. I have then created a union of
these files intersecting them with a buffer from a third file.
I now want to write the results out to another table so that I can view the
results in QGIS. The only problem is the insert fails and return the
following error ...
new row for relation "spl_mga_results" violates check constraint
"enforce_geotype_the_geom"
I have made sure that the geotype is "POLYGON" for the new table create
statement.
When I place this line in my query ...
GeometryType(ST_Intersection(get_buffer.the_geom,get_union.the_geom)) AS
geom_type
one of the attributes returned is GeometryCollection.
I thought I would ST_Dump it but nothing happened because it must be a
result of the actions I have carried out during the course of the query.
This is the query that I have formed ...
<pre>
SELECT get_union.species
, get_union.res_year
, get_union.area_m
, ST_Intersection(get_buffer.the_geom,get_union.the_geom) AS the_geom
FROM (SELECT gid
, "NAME" as name
, ST_Buffer(the_geom, 200000) AS the_geom
FROM spl_mga_towns_pnt
WHERE "NAME" = 'CRANBROOK'
) AS get_buffer
, (SELECT get_trans.gid
, INITCAP(get_trans.species) AS species
, get_trans.res_year
, ST_Area(ST_Buffer(get_trans.the_geom, 3, 10)) AS area_m
, ST_Buffer(get_trans.the_geom, 3, 10) AS the_geom
FROM (SELECT a.gid
, b.name AS species
, c.res_year
, ST_Transform(a.the_geom, 28350) AS the_geom
FROM spl_geo_trees_lin a
, aspl_species_lkup b
, aspl_resource_year_lkup c
WHERE a.spe_id = b.id
AND a.res_year = c.id
) AS get_trans
UNION
SELECT gid
, "SPECIES" AS species
, "RES_YEAR" AS res_year
, ST_Area(the_geom) AS area_m
, ST_Transform(the_geom, 28350) AS the_geom
FROM spl_geo_trees_ply
) get_union;
</pre>
Cheers for any assistance
Ben
--
View this message in context: http://www.nabble.com/GeometryCollection-tp23536981p23536981.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
More information about the postgis-users
mailing list