Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use PostgreSQL with POSTGIS extension.

I have a set of points in the_geom column from a table myshema.myobjects I would want create a select statement to get the centroid of this cluster, so from a select statement like this :

select the_geom from myshema.myobjects

Then I search the correct syntax of a statement that could look like that :

SELECT ST_AsText(ST_Centroid( (SELECT the_geom FROM myshema.myobjects) ));
share|improve this question
up vote 10 down vote accepted

you have to use the union function like this

SELECT att1, st_centroid(st_union(geom)) as geom
FROM schema.table
GROUP BY att1;

so you can obtain centroid of point that have same attribute.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.