[postgis-users] how to sum two point geometries

Raúl Marín Rodríguez rmrodriguez at carto.com
Fri Jan 25 07:02:20 PST 2019


Hi,

I understand that you are trying to move a geometry, not summing 2
random geometries (how would that work with polygons for example). If
so, have a look at St_Translate
(https://postgis.net/docs/ST_Translate.html).


On Fri, Jan 25, 2019 at 3:54 PM Antonio Silva <aolinto.lst at gmail.com> wrote:
>
> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users



-- 
Raúl Marín Rodríguez
carto.com


More information about the postgis-users mailing list