[postgis-users] st_geomfromkml problem

Ahmad Aburizaiza ahmadoa4 at gmail.com
Thu Feb 23 18:17:11 PST 2012


Hello everyone,


I have a question please and hope someone can help. I have a table with the
following structure:


*CREATE TABLE table1 (*

*    "id" integer DEFAULT nextval('id_seq'::regclass) NOT NULL,*

*    name character varying,*

*    geom geometry,*

*    geom_kml text,*

*    CONSTRAINT enforce_dims_geom CHECK ((st_ndims(geom) = 2)),*

*    CONSTRAINT enforce_geotype_geom CHECK (((geometrytype(geom) =
'POLYGON'::text) OR (geom IS NULL))),*

    CONSTRAINT *enforce_srid_geom* CHECK ((st_srid(geom) = (-1))));


So the table has a geom column and a column to store the KML text besides
name and id. I want the geom field to store a polygon from the KML column.
So first I inserted id, name, and KML as text and geom as NULL. Than I ran
the below update SQL statement:


*Update table1 set geom
= st_geomfromkml('<Polygon><outerBoundaryIs><LinearRing><coordinates>39.788212,21.424540
........ 39.788212,21.424540</coordinates></LinearRing></outerBoundaryIs></Polygon>');
*


But an error appears that this conflicts with
*enforce_srid_geom*constraint. I removed it and I was able to update
the geom column but it
really does not make sense. The geom I am trying to insert does not
conflict with the constraints. I created the kml polygon in Google Earth
and the srid for that is -1. Please help :)



*---------------------------------------------------------------------------
*

*Ahmad Aburizaiza*

*PhD student at George Mason University*

*Geography and Geoinformation Science Department*

*Fairfax, VA, USA*

*Tel : +1-703-981-0354*
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120223/3189788b/attachment.html>


More information about the postgis-users mailing list