I have a table on PostgreSQL 9.2 ("POSTGIS="2.0.1 r9979" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML="2.8.0""). This is it:

CREATE TABLE nearest_point (
  id_nearest_point serial NOT NULL,
  id_iri_radartec integer,
  id_tramo integer,
  geom geometry(GeometryZ,4326),
  CONSTRAINT pk_nearest_point PRIMARY KEY (id_nearest_point)

SELECT nearest_point

I need a geometry that represents the point set union of the Geometries. Easy.

SELECT id_tramo
   ,ST_Multi(ST_Union(np.geom)) AS geom
  FROM nearest_point AS np
GROUP BY id_tramo;

But I get this:

Zoom out - 01

"ST_Union GROUP BY" points in pink.

And the other points?

Zoom out - 02

The arrow indicates where are the points of the table nearest_point. Where is my error?

  • Have you tried ST_Collect instead of ST_Union? – raphael Dec 27 '14 at 3:14

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.