[postgis-users] Adding Spatial Index to Existing Table

Brad Ediger brad at bradediger.com
Fri Dec 29 21:15:33 PST 2006


You'll have to cast explicitly since your data are in varchars.

MakePoint(longitude::double precision, latitude::double precision)

should do the trick.

On Dec 29, 2006, at 11:08 PM, Adam wrote:

> If I run without any quotes I get this error:
> ERROR:  function makepoint(character varying, character varying)  
> does not exist
> HINT:  No function matches the given name and argument types. You  
> may need to add explicit type casts.
>
> If I run with double quotes I get this error:
> ERROR:  function makepoint(character varying, character varying)  
> does not exist
> HINT:  No function matches the given name and argument types. You  
> may need to add explicit type casts.
>
> Any other ideas as to what the problem is?
>
> I looked up "MakePoint" in my functions and it is there:
>
>      Function Arguments Returns Programming language
>      makepoint double precision, double precision geometry c
>      Object File Link Symbol
>      $libdir/liblwgeom.so.1.1 LWGEOM_makepoint
>      Properties
>      IMMUTABLE
>      RETURNS NULL ON NULL INPUT
>      SECURITY INVOKER
>
>
> ----- Original Message ----- From: "Gregory S. Williamson"  
> <gsw at globexplorer.com>
> To: "PostGIS Users Discussion" <postgis- 
> users at postgis.refractions.net>; "PostGIS Users Discussion" <postgis- 
> users at postgis.refractions.net>
> Sent: Friday, December 29, 2006 11:02 PM
> Subject: RE: [postgis-users] Adding Spatial Index to Existing Table
>
>
> If you single quote something PostgreSQL will interpet it as a  
> string ... since they are lower case anyway, try not quoting them  
> at all, of double quote them if you need to preserve case:
> UPDATE locations SET point_geom = SetSRID(makepoint 
> (longitude,latitude), 4326);
>
> Or:
> UPDATE locations SET point_geom = SetSRID(makepoint 
> ("longitude","latitude"), 4326);
>
> G
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net on behalf of Adam
> Sent: Fri 12/29/2006 8:57 PM
> To: PostGIS Users Discussion
> Cc:
> Subject: Re: [postgis-users] Adding Spatial Index to Existing Table
>
> I tried: UPDATE locations SET point_geom = SetSRID(makepoint 
> ('longitude','latitude'), 4326);
> but got this error:
> ERROR:  invalid input syntax for type double precision:  
> "longitude"Could the problem be that my "longitude" column is type  
> "Character Varying"?-----  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
>
>
>
> -------------------------------------------------------
> Click link below if it is SPAM gsw at globexplorer.com
> "https://mailscanner.globexplorer.com/dspam/dspam.cgi? 
> signatureID=4595f117132351789821027&user=gsw at globexplorer.com&retrain= 
> spam&template=history&history_page=1"
> !DSPAM:4595f117132351789821027!
> -------------------------------------------------------
>
>
>
> _______________________________________________
> 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/d38bc1a0/attachment.html>


More information about the postgis-users mailing list