[postgis-users] how to sum two point geometries

Antonio Silva aolinto.lst at gmail.com
Fri Jan 25 09:09:24 PST 2019


Thanks Raúl

That's what I need!

Thank you very much for your attention.

Regards

Antônio Olinto

===================================================
SELECT ST_MakePoint(-46,-24)
-- 010100000000000000000047C000000000000038C0

SELECT
ST_MakePoint(ST_X('010100000000000000000047C000000000000038C0')-0.5,ST_Y('010100000000000000000047C000000000000038C0')-0.5)
-- 010100000000000000004047C000000000008038C0

SELECT ST_AsText('010100000000000000004047C000000000008038C0')
-- POINT(-46.5 -24.5)

SELECT ST_Translate('010100000000000000000047C000000000000038C0',-0.5,-0.5)
-- 010100000000000000004047C000000000008038C0

SELECT ST_AsText('010100000000000000004047C000000000008038C0')
-- POINT(-46.5 -24.5)
===================================================


Em sex, 25 de jan de 2019 às 13:02, Raúl Marín Rodríguez <
rmrodriguez at carto.com> escreveu:

> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users



-- 
Antônio Olinto Ávila da Silva
Biólogo / Oceanógrafo
Instituto de Pesca (Fisheries Institute)
São Paulo, Brasil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20190125/e36c7173/attachment.html>


More information about the postgis-users mailing list