Skip to content

Instantly share code, notes, and snippets.

View iamralch's full-sized avatar

Svetlin Ralchev iamralch

View GitHub Profile
@iamralch
iamralch / select-centroid-polygon-as-latlong
Created August 15, 2024 09:45 — forked from matt-baker/select-centroid-polygon-as-latlong
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;