Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamralch/36551535fae46885d9b54d79488696d0 to your computer and use it in GitHub Desktop.
Save iamralch/36551535fae46885d9b54d79488696d0 to your computer and use it in GitHub Desktop.
Select lat/long centroid from a polygon in PostGIS.
-- SELECT polygon centroid as latitude/longitude in PostGIS
SELECT
st_x(st_transform(ST_Centroid(the_geom),4326)) as lat,
st_y(st_transform(ST_Centroid(the_geom),4326)) as long
FROM table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment