Ahmad, The question I have for you is why you have your srid as -1.
KML spatial_ref is ALWAYS 4326 so I expect any ST_GeomFromKML to come back as srid = 4326. You can't create a KML file that is not 4326 (WGS 84) as I recall. If you were able to in the past, then that's a mistake and perhaps that was corrected in 2.0. > -----Original Message----- > From: postgis-users-boun...@postgis.refractions.net > [mailto:postgis-users-boun...@postgis.refractions.net] On > Behalf Of Sandro Santilli > Sent: Friday, February 24, 2012 3:13 AM > To: PostGIS Users Discussion > Subject: Re: [postgis-users] st_geomfromkml problem > > On Thu, Feb 23, 2012 at 09:17:11PM -0500, Ahmad Aburizaiza wrote: > > > 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></Poly > > gon>'); > > * > > > > > > 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 > > :) > > Did you upgrade from 1.x to 2.0 ? > If you did you probably did it too early, or not using the > correct method (hard upgrade). > In 2.0 any negative SRID gets converted to 0 so you'll never > meet the check for -1. The hard upgrade procedure updates > that constraint. > > --strk; > > ,------o-. > | __/ | Delivering high quality PostGIS 2.0 ! > | / 2.0 | http://strk.keybit.net - http://vizzuality.com > `-o------' > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users