[postgis-users] St_AsEwkt

Olivier Leprêtre o.lepretre at gmail.com
Wed Jul 5 10:54:41 PDT 2017


Hi,

 

I'm using pgplsql to calculate shortest distance between points. This works
but I'm wondering if my code is optimized because I'm using many ST_AsEwkt.

 

sqls='SELECT id code,ST_AsEwkt(ST_StartPoint(the_geom)) as
geom1,ST_AsEwkt(ST_EndPoint(the_geom)) as geom2 FROM ' || schem ||
'.trench';

FOR row IN 

            EXECUTE (sqls)

LOOP

 

            sqls1='SELECT id
code1,ST_Distance(ST_AsEwkt(the_geom),St_AsEwkt(''%2$s'')) FROM %1$s.nodes
order by ST_Distance(ST_AsEwkt(the_geom),ST_AsEwkt(''%2$s'')) LIMIT 1';

            sqls1=format(sqls1,schem,row.geom1);

 

            FOR row1 IN

                        EXECUTE (sqls1)

...

 

Would it be possible to have a smarter syntax with less ST_AsEwkt ?

 

Thanks, 

 

Olivier



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170705/eaba3a1e/attachment.html>


More information about the postgis-users mailing list