trevor1940
asked on
PostgreSQL / PostGIS Update Syntax
Hi
I need to run the following update query on a PostgreSQL / PostGIS database
co_ord_string is a column name if I manually copy the row value into above the query runs otherwise I get
I'm pretty sure this is because of the single quotes around 'MULTIPOINT(co_ord_string) ' interprets co_ord_string as the literal string
The value of co_ord_string is a series of long lat points separated by a comma. These don’t create perfect polygons as they may contain internal points but using ST_ConvexHull a polygon is created
Could someone help with the syntax
I need to run the following update query on a PostgreSQL / PostGIS database
UPDATE geo_table
SET geom =ST_ConvexHull(
ST_GeomFromText('MULTIPOINT(co_ord_string)', 4326)
);
WHERE
Id =1234;
co_ord_string is a column name if I manually copy the row value into above the query runs otherwise I get
parse error – invalid geometry HINT: "MULTIPOINT(" <-- parse error at position 11 within geometry
I'm pretty sure this is because of the single quotes around 'MULTIPOINT(co_ord_string)
The value of co_ord_string is a series of long lat points separated by a comma. These don’t create perfect polygons as they may contain internal points but using ST_ConvexHull a polygon is created
Could someone help with the syntax
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the answer and the additional explanation I'm sure I'll need that again
For more information, check out the docs:
https://www.postgresql.org/docs/9.1/static/functions-string.html
For a quick example, check out:
http://sqlfiddle.com/#!17/4680d/2
https://www.postgresql.org/docs/9.1/static/functions-string.html
For a quick example, check out:
http://sqlfiddle.com/#!17/4680d/2
ASKER
Can you tell me what the double pipe is doing? I thought || meant OR