storing lat/long coordinates as points

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Wed Aug 16 08:59:34 EDT 2006


P Kishor wrote:
> On 8/15/06, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:
>> Ryan Ollerenshaw wrote:
>>> does anyone know how to store lat/long coordinates in PostgreSQL
>>> as POINTS?
>>>
>> Assuming you have PostGIS installed, you might try:
>>
>> select AddGeometryColumn('schema_name', 'table_name', 'the_geom', 4326,
>> 'POINT', 2);
>>
>> the_geom = the column
>> 4326 = SRID for WGS84
>> 'POINT' = Geometry type
>> 2 = the dimension of the point ie (X,Y)
>>
>> then you can do this:
>>
>> insert into schema_name.table_name (the_geom) values
>> (setsrid(makepoint(long, lat), 4326));
>>
> 
> 
> seriously! this is neat.
> 
> You mean, all that converting lon/lat to shapefile and then loading it
> into PostGIS is all unnecessary convolutions on my part?
> 
> 
Yup, give it a try. This makes multi-user web applications a snap.

-SteveW



More information about the mapserver-users mailing list