[postgis-users] how to sum two point geometries

Antonio Silva aolinto.lst at gmail.com
Fri Jan 25 06:49:37 PST 2019


Hello list!

Here goes my first e-mail to this list. My name is Antonio Olinto and I
work with fisheries research at São Paulo Fisheries Institute, Brazil.

I have a point geometry field in a table and I want to add -0.5° to both
longitude and latitude.

Suppose I have a point at 010100000000000000000047C000000000000038C0
(-46,-24) and I want to add 0101000000000000000000E0BF000000000000E0BF
(-0.5,-05) to have 010100000000000000004047C000000000008038C0 (-46.5,-24.5).

What I'm doing is
SELECT
ST_MakePoint(ST_X('010100000000000000000047C000000000000038C0')-0.5,ST_Y('010100000000000000000047C000000000000038C0')-0.5)

Is there any way to do the sum using only geometries? Something like?
SELECT
'010100000000000000000047C000000000000038C0'+'0101000000000000000000E0BF000000000000E0BF'
 or
SELECT ST_SUM('010100000000000000000047C000000000000038C0',
'0101000000000000000000E0BF000000000000E0BF')?

Thanks for any suggestion. Best regards.

-- 
Antônio Olinto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190125/4325e32f/attachment.html>


More information about the postgis-users mailing list