Skip to content

Instantly share code, notes, and snippets.

@antoniolocandro
Created December 5, 2013 15:50
Show Gist options
  • Save antoniolocandro/7807846 to your computer and use it in GitHub Desktop.
Save antoniolocandro/7807846 to your computer and use it in GitHub Desktop.
Calculate area of polygon in GCS WGS 84 in Km2 using POSTGIS ST_Area
-- Calculate Km2 of a polygon stores in GCS WGS84
-- by default ST_Area returns the calculation in meters so the appropriate conversion was applied
-- fir_area_20131205 was the example table used
-- the spatial data was in a geom field so geom::geography was added
SELECT ST_Area(geom::geography)/1000000 as sqKM from fir_area_20131205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment