[postgis-users] create a point fom lat/lon

Stephen Woodbridge woodbri at swoodbridge.com
Wed May 30 18:39:48 PDT 2007


Try:

update iter_rco_2005g set the_geom=makepoint(lon,lat);

   or if you want to set the srid for the points to say wgs84 srid=4326:

update iter_rco_2005g set the_geom=setsrid(makepoint(lon,lat), 4326);

this is faster and probably more accurate the using string/text 
manipulation.

-Steve W.

Nahum Castro wrote:
> Hello all:
> 
> I have two columns lat and lon, from these columns I
> want to create a point on the_geom column.
> 
> this is how i did
> 
> update iter_rco_2005g
> set
> the_geom=geomfromtext('point(lon lat)', 4326);
> 
> and
> 
> update iter_rco_2005g
> set
> the_geom=geomfromtext('point(lon, lat)', 4326);
> 
> lat an lon are in dd.
> 
> I get
> ERROR:  Invalid OGC WKT (does not start with P,L,M or
> G)
> 
> here is a sample data 
>  mun | loc  |       lat        |       lon
> -----+------+------------------+------------------
>  020 | 0001 | 21.1197222222222 | 101.680555555556
>  020 | 0261 | 21.0405555555556 | 101.503888888889
>  020 | 0262 | 21.0241666666667 | 101.714444444444
>  020 | 0263 |            21.15 | 101.607777777778
>  020 | 0264 | 21.1944444444444 | 101.530555555556
>  020 | 0266 | 20.9416666666667 | 101.613888888889
>  020 | 0267 | 21.0494444444444 |         101.6875
>  020 | 0271 | 20.9941666666667 | 101.589722222222
> 
> Thanks.
> 
> 
> 
> 
> --
> Nahum Castro
> Leon, Guanajuato, Mexico
> http://www.leon-linux.com
> e-mail: pedro1_72 [en] yahoo [punto] com
> 
> 
> 	
> 	
> 		
> ___________________________________________________________ 
> Do You Yahoo!? 
> La mejor conexión a Internet y <b >2GB</b> extra a tu correo por $100 al mes. http://net.yahoo.com.mx 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list