[GRASS-user] Uploading bounding box of vectors to database?

Hamish hamish_b at yahoo.com
Tue Jan 5 16:38:53 EST 2010


Christian Kaiser wrote:
> I would like to do a very simple thing:
> upload the bounding box for each geometry (areas,
> boundaries, lines) to the attribute table.
>
> v.to.db does not seem to provide this functionality. Is
> there an elegant way for doing this?


'v.info -g' will give you the bounding box, easy peasy.



MAP=your_map_name

v.db.addcol $MAP column="north DOUBLE PRECISION, \
  south DOUBLE PRECISION, east DOUBLE PRECISION, west DOUBLE PRECISION"

eval `v.info -g $MAP`

echo "UPDATE $MAP SET north = $north, south = $south, \
  east = $east, west = $west" | db.execute



Hamish



      


More information about the grass-user mailing list