[postgis-users] St_AsEwkt

Tom van Tilburg tom.van.tilburg at gmail.com
Thu Jul 6 01:55:29 PDT 2017


Somehow I feel there is no need for plpgsql in what you are doing and that
indeed the ST_AsEwkt is too much.
I can't wrap my head around what this script is exactly trying to do
though. Can you elaborate a bit on your use-case? What is the original data
and what would you like to know from it?


Best,
 Tom

On Wed, Jul 5, 2017 at 7:54 PM, Olivier LeprĂȘtre <o.lepretre at gmail.com>
wrote:

> 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
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Garanti
> sans virus. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> <#m_-6220950655889643972_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170706/151f7721/attachment.html>


More information about the postgis-users mailing list