[postgis-users] How does makeline work?
Guido Lemoine
guido.lemoine at jrc.it
Fri Sep 9 00:57:10 PDT 2005
Mark,
Thanks for the clarification.
I tried your suggestion, already as part of my original tests. Your
version gives
a syntax error at the inner select statement inside makeline. If I add
extra brackets
to make it an expression, it returns the following error.
select astext(makeline((select gcp_geom from testset order by gcp_id)))
from testset;
ERROR: more than one row returned by a subquery used as an expression
I didn't report this one, because I thought it was logical (similar
error for other aggregate
functions). But now I am not so sure.
Guido
Mark Cave-Ayland wrote:
>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
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
More information about the postgis-users
mailing list