[postgis-users] dynamic point values

kidult ekene at hypehypehype.net
Sun Nov 26 15:47:54 PST 2006


the sql query 

INSERT INTO location(geom, x, y, longitude, latitude, easting, northing) 
SELECT 
Transform(SetSRID(GeomFromText('POINT(primary_lat_dec primary_lon_dec)'),
10002), 2263) AS geom,
primary_lat_dec AS x,
primary_lon_dec AS y,
x(Transform(SetSRID(GeomFromText('POINT(primary_lat_dec primary_lon_dec)'),
10002), 4326)) AS longitude,
y(Transform(SetSRID(GeomFromText('POINT(primary_lat_dec primary_lon_dec)'),
10002), 4326)) AS latitude,
x(Transform(SetSRID(GeomFromText('POINT(primary_lat_dec primary_lon_dec)'),
10002), 2263))::int AS easting,
y(Transform(SetSRID(GeomFromText('POINT(primary_lat_dec primary_lon_dec)'),
10002), 2263))::int AS northing
FROM gnis;

throws the error 

ERROR:  parse error - invalid geometry
CONTEXT:  SQL function "geomfromtext" statement 1

because the POINT object parameters 

EX: Transform(SetSRID(GeomFromText('POINT(primary_lat_dec
primary_lon_dec)'), 10002), 2263)

are columns and not to static numeric decimal values. when i use static
numeric decimal values the query is successful. 

EX: Transform(SetSRID(GeomFromText('POINT(44.3475481 -73.6287475)'), 10002),
2263)

what is the correct syntax for using columns as parameters for the POINT
object?




-- 
View this message in context: http://www.nabble.com/dynamic-point-values-tf2709026.html#a7552826
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list