Python – PostGIS Equivalent of Pandas Geometry.area for Square Feet

areageopandaspostgispostgresqlpython

I have a Python script that has a line that takes the geometry and calculates it into a square feet value by multiplying the area by 10.7639 in a geopandas dataframe.

bldg_feat_poly_df['bldg_sqft'] = bldg_feat_poly_df.geometry.area * 10.7639

This works fine. I am now trying to do the same in PostgreSQL using PostGIS. I believe that ST_Area is the correct method to use:

SELECT
ST_Area(geom) * 10.7639 AS bldg_sqft
FROM my_schema.my_table

Looking at the ST_Area documentation , it looks like it automatically calculates the value as square feet. My geometry is already in SRID=102008/North America Albers Equal Area Conic projection. Should I just use ST_Area(geom) AS bldg_sqft ?

Best Answer

st_area is the correct function to use to get a geometry area, expressed in the CRS unit.

102008 unit is meters, so the output will be in square meters, and you would still have to apply the conversion factor

Related Question