[postgis-users] Calculating Attributes

Stephen Woodbridge woodbri at swoodbridge.com
Fri Apr 3 10:27:57 PDT 2009


Aurora Geomatics wrote:
> Hello PostGIS users,
> 
> I have just installed William Kyng's PostgeSQ/PostGIS packages for Mac 
> OS X.5
> 
> I have been playing with pgAdmin and QGIS with importing shapefiles into 
> PostGIS.  Works dandy.
> 
> Now I am wondering how to solve Attribute Calculations.
> 
> Years of using ArcGIS and GRASS it is pretty straightforward on those 
> apps, and am stumped with PostGIS Attribute calculations..
> 
> For example, using a polygon feature;
> 
> Creating a new column, say AREA and filling with a calculation that is 
> Hectares.

alter table mytable add column area float;
update mytable set area=st_area2d(the_geom)*factor2convert2hectares;

There are some potential issues related to what projection you are in, 
but I will let others expound on those.

-Steve



More information about the postgis-users mailing list