Opened 9 years ago

Closed 9 years ago

#3123 closed enhancement (invalid)

Aggregates for ST_AsTWKB removed?

Reported by: usmanm Owned by: pramsey
Priority: medium Milestone: PostGIS 2.2.0
Component: postgis Version: master
Keywords: Cc:

Description

Aggregates for the TWK format were added in the svn-trunk branch but seem to have been removed by #3085? I tried looking for a discussion around this change, but couldn't find any. All source code related to the aggregates has been removed but the tests have only been commented out, so I'm unsure about what the future holds for these aggregate functions. Is there any plan to add them in the future, or are they gone for good?

http://postgis.net/docs/manual-dev/ST_AsTWKBAgg.html

Change History (2)

comment:1 by nicklas, 9 years ago

You are right they are removed, but the functionality remains. The syntax is just changed.

What has happened is that the ordinary ST_AsTWKB can take arrays of geoemetries together with array of id.

So instead of writing :

ST_AsTWKBAgg(geom,id)

you write:

ST_AsTWKB(array_agg[geom), array_agg[id])

http://postgis.net/docs/manual-dev/ST_AsTWKB.html

So, we are relying on standard aggregation functions on PostgreSQL rather than building our own.

In the old ST_AsTWKBAgg, there was some ugly part of the implementation to get the values valid for the whole aggregate like precision and boolean values for size and bounding box through the process. The approach now is cleaner because the parts that shall aggregate do so with array_agg and the rest is just an ordinary function.

Credits for this shall go to Paul Ramsey.

Also note that the specification have had some major changes too. Oe of the biggest benefits is that you now can nest collections as deep as you like in a twkb-geoemtry. And you can control the precission independent for xy, z and m dimensions.

https://github.com/TWKB/Specification/blob/master/twkb.md

comment:2 by pramsey, 9 years ago

Resolution: invalid
Status: newclosed

I'm going to close this one off. You can still aggregate twkb, as Nick notes, the process is just changed. Added an example at r13540

Note: See TracTickets for help on using tickets.