1

I have a table x like this:

Columns:

SubjectID int(11)
Timestamp bigint(20) 
fix_geom point

enter image description here

When i try to group my fix_geom column to a MultiPoint (or GeometryCollection) by SubjectID, like:

SELECT SubjectID, ST_AsText(MultiPoint(fix_geom))
FROM x
WHERE SubjectID = 100
GROUP BY SubjectID;

i get a table with a multipoint geometry, but it contains just one single Point instead of the many i'd liked to see there...:

enter image description here

Can anybody tell me what i'm doing wrong?

Cheers and many thanks in advance, Olaf

  • Create a fiddle with your structure and sample data, or post CREATE TABLE + INSERT INTO instead of screenshots at least. And show desured result. – Akina Jan 29 at 13:45
  • 2
    It looks like you want MultiPoint to be an aggregate function, which is isn't. You'll probaly need something like ST_GeomFromText(CONCAT('MultiPoint(', GROUP_CONCAT(...), ')')), where ... gets an X Y string from fix_geom – danblack Jan 30 at 0:49
  • @danblack should have made that an answer. (note PostGIS has spatial aggregates) – Evan Carroll Feb 12 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.