<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [postgis-users] HELP adding spatial field to table</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>I think it is rare that you'd want corrupt data. My usual approach has been to load my data set into a temporary table (only lasts for the session (or transaction)) and then apply sanity checks and either delete offending rows or modify them if you know sane values to set them to.<BR>
<BR>
Then create the geometries from the data set and insert it into my real table, possibly with something like<BR>
  INSERT INTO some_real_table SELECT gid,label_name,the_geom FROM foo WHERE IsValid(the_geom);<BR>
<BR>
HTH,<BR>
<BR>
Greg W.<BR>
(sorry for top-posting, challenged reader and pressed for time)<BR>
<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net on behalf of Richard Heimann [C]<BR>
Sent: Tue 12/11/2007 4:57 PM<BR>
To: 'Michael Smedberg'; Richard.Heimann@nrl.navy.mil; 'PostGIS Users Discussion'<BR>
Subject: RE: [postgis-users] HELP adding spatial field to table<BR>
<BR>
Thanks for the prompt response. And youre right there are some such values.<BR>
Is there a work around?<BR>
<BR>
 Rich<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Michael Smedberg [<A HREF="mailto:Michael.Smedberg@redfin.com">mailto:Michael.Smedberg@redfin.com</A>]<BR>
Sent: Tuesday, December 11, 2007 6:55 PM<BR>
To: Richard.Heimann@nrl.navy.mil; PostGIS Users Discussion<BR>
Subject: RE: [postgis-users] HELP adding spatial field to table<BR>
<BR>
Are you sure that x and y always have legit values?  If one were null or<BR>
the zero-length string, I think you'd get an error like that.<BR>
<BR>
-----Original Message-----<BR>
From: postgis-users-bounces@postgis.refractions.net<BR>
[<A HREF="mailto:postgis-users-bounces@postgis.refractions.net">mailto:postgis-users-bounces@postgis.refractions.net</A>] On Behalf Of<BR>
Richard Heimann [C]<BR>
Sent: Tuesday, December 11, 2007 3:44 PM<BR>
To: 'PostGIS Users Discussion'<BR>
Subject: [postgis-users] HELP adding spatial field to table<BR>
<BR>
 All,<BR>
<BR>
Im getting some strange behavior that I cant explain and sadly know its<BR>
likely trivial. My pursuit is simple, add a spatial filed to a table<BR>
containing x,y.<BR>
<BR>
First. AddGeometryColumn<BR>
<BR>
        SELECT AddGeometryColumn( 'crimetest', 'geom', 4326, 'POINT', 2)<BR>
<BR>
Next (and where the trouble lies)<BR>
<BR>
        UPDATE crimetest<BR>
        SET geom = PointFromText('POINT(' || x || ' ' || y || ')', 4326)<BR>
<BR>
This is the error I receive.<BR>
<BR>
ERROR: Invalid OGC WKT (too short)<BR>
SQL state: XX000<BR>
Context: SQL function "geomfromtext" statement 1<BR>
SQL function "pointfromtext" statement 1<BR>
<BR>
Can anyone shed some light on this?<BR>
<BR>
<BR>
Thanks<BR>
Rich<BR>
<BR>
<BR>
<BR>
_______________________________________________<BR>
postgis-users mailing list<BR>
postgis-users@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
<BR>
<BR>
<BR>
<BR>
<BR>
_______________________________________________<BR>
postgis-users mailing list<BR>
postgis-users@postgis.refractions.net<BR>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>