[postgis-users] How does makeline work?
Mark Cave-Ayland
m.cave-ayland at webbased.co.uk
Fri Sep 9 00:38:26 PDT 2005
Hi Guido,
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On
> Behalf Of Guido Lemoine
> Sent: 09 September 2005 08:17
> To: PostGIS Users Discussion
> Subject: [postgis-users] How does makeline work?
(cut)
> select astext(makeline(gcp_geom)) from testset where gcp_geom
> IN (select
> gcp_geom from testset order by gcp_id);
>
> this works, and produces the same line as when not using the where.
>
> select astext(makeline(gcp_geom)) from testset where gcp_geom
> IN (select
> gcp_geom from testset order by gcp_id desc);
>
> Now, I would expect the same line, but in reverse order. But
> this is not
> the case (it's the same as before).
IN only tests for set membership, and hence the order in the resulting
dataset cannot be relied upon.
> The manual says "You might want to use a subselect to order points
> before feeding them to this aggregate",
> and this gave me hope. My current workaround is a plpgsql
> function that
> solves the problem, but it's a bit
> awkward.
You should be able to use something like:
select astext(makeline(select gcp_geom from testset order by gcp_id desc))
from testset
Kind regards,
Mark.
------------------------
WebBased Ltd
17 Research Way
Tamar Science Park
Plymouth
PL6 8BT
T: +44 (0)1752 797131
F: +44 (0)1752 791023
W: http://www.webbased.co.uk
More information about the postgis-users
mailing list