[postgis-users] Adding Spatial Index to Existing Table

Brad Ediger brad at bradediger.com
Fri Dec 29 20:30:35 PST 2006


You use the AddGeometryColumn function rather than standard SQL DDL  
to create geometry columns:

SELECT AddGeometryColumn('public', 'table', 'location', 4326,  
'POINT', 2);

assuming "public" schema and "table" table.

On Dec 29, 2006, at 10:23 PM, Adam wrote:

> And when I add the new "location" column, do I add it as type  
> "geometry"?
> ----- Original Message -----
> From: Brad Ediger
> To: PostGIS Users Discussion
> Sent: Friday, December 29, 2006 1:18 PM
> Subject: Re: [postgis-users] Adding Spatial Index to Existing Table
>
> If your lat/longs are WGS84, you should be able to say:
>
> UPDATE table SET location = SetSRID(MakePoint(Long,Lat), 4326);
>
> That should update all points in one statement, and set the proper  
> SRID.
>
> Brad
>
> On Dec 29, 2006, at 1:08 PM, Adam wrote:
>
>> 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.
>>
>> 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.
>>
>> Is this right?
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061229/581cdeb5/attachment.html>


More information about the postgis-users mailing list