<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">You use the AddGeometryColumn function rather than standard SQL DDL to create geometry columns:<BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN> </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>SELECT AddGeometryColumn('public', 'table', 'location', 4326, 'POINT', 2);</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>assuming "public" schema and "table" table.</DIV><BR><DIV><DIV>On Dec 29, 2006, at 10:23 PM, Adam wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"> <DIV><FONT face="Arial" size="2">And when I add the new "location" column, do I add it as type "geometry"?</FONT></DIV> <BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV> <DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> <A title="brad@bradediger.com" href="mailto:brad@bradediger.com">Brad Ediger</A> </DIV> <DIV style="FONT: 10pt arial"><B>To:</B> <A title="postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">PostGIS Users Discussion</A> </DIV> <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, December 29, 2006 1:18 PM</DIV> <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [postgis-users] Adding Spatial Index to Existing Table</DIV> <DIV><BR></DIV> <DIV><SPAN class="Apple-style-span" style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN class="Apple-style-span" style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2"><SPAN class="Apple-style-span" style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">If your lat/longs are WGS84, you should be able to say:<BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN></DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>UPDATE table SET location = SetSRID(MakePoint(Long,Lat), 4326);</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>That should update all points in one statement, and set the proper SRID.</DIV> <DIV><BR class="khtml-block-placeholder"></DIV> <DIV>Brad</DIV><BR> <DIV> <DIV>On Dec 29, 2006, at 1:08 PM, Adam wrote:</DIV><BR class="Apple-interchange-newline"> <BLOCKQUOTE type="cite"> <DIV><FONT face="Arial" size="2">This is my first try at adding spatial to my table. Currently I have a 'Lat' and 'Long' columns that have my Latitiude and Longitude.</FONT></DIV> <DIV><FONT face="Arial" size="2"></FONT> </DIV> <DIV><FONT face="Arial" size="2">Do I need to add another column named 'Location' and insert each rows 'Lat' and 'Long' into the corresponding 'Location' row by doing: "INSERT INTO table ( Location ) VALUES ( GeometryFromText('Point xx.xxx yy.yyyy', 4326) )" ? This will assume WGS 84 datum.</FONT></DIV> <DIV><FONT face="Arial" size="2"></FONT> </DIV> <DIV><FONT face="Arial" size="2">Is this right?</FONT></DIV> <DIV style="MARGIN: 0px">_______________________________________________</DIV> <DIV style="MARGIN: 0px">postgis-users mailing list</DIV> <DIV style="MARGIN: 0px"><A href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A></DIV> <DIV style="MARGIN: 0px"><A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A></DIV></BLOCKQUOTE></DIV><BR><DIV> <BR class="khtml-block-placeholder"></DIV><HR><DIV><BR class="khtml-block-placeholder"></DIV>_______________________________________________<BR>postgis-users mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">postgis-users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>