[postgis-users] st_geomfromkml problem

Sandro Santilli strk at keybit.net
Fri Feb 24 00:13:28 PST 2012


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></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 :)

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------'




More information about the postgis-users mailing list