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 have table with column name,Latitude and Longitude.I want to update this with polygon name and its centroid latitude longitude.I know there is a function in postgis st_centroid(geometry). But I want to enter x value and Y value in a separate column.How can I do this? Please help me

Regards, Sreesha

share|improve this question
You want to write x and y of the centroid into new columns/attributes? – underdark Sep 24 '12 at 6:45
Yes, I have latitude and longitude columns.But St_centroid returns lat long value in a single column – Sreesha Sep 24 '12 at 6:52


UPDATE polygon_layer SET longitude=ST_X(ST_Centroid(geom)), Latitude=ST_Y(ST_Centroid(geom));
share|improve this answer
thanks.Its working – Sreesha Sep 24 '12 at 9:23
@Sreesha: Remember to mark his answer as accepted. – CaptDragon Sep 24 '12 at 13:37

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.