[GRASS-user] creating vector grids (especially associated with projections)

Patrice Dumas pertusus at free.fr
Wed Feb 16 06:05:09 EST 2011


I have meteorological data that are on diverse grids, in general associated
with a specific projection.  For example, a lambert conic projection has
a 'natural' grid associated, just like the lon-lat grid is a natural grid
for lon-lat pprojection.  Then I would like to intersect a vector 
corresponding with this grid with some features on a map.  For lon-lat grid
(and, unless I am missing something it works also fine for a Lambert Equal
Area location), the grass grid may be used for that, by setting the right
region information.  Here is the code I use to create my grid, simply 
by computing a raster grid with a different integer for each point and 
using r.to.vect:

cols_nr=`g.region -g |grep '^cols=' |sed 's/^cols=//'`
r.mapcalc "grid_map=col() + ((row()-1) * $cols_nr)"
r.to.vect input=grid_map out=grid_map_v feature=area
v.db.addcol grid_map_v columns="lon Double Precision, lat Double Precision"
v.to.db map=grid_map_v option=coor column=lon,lat
v.db.addcol grid_map_v columns="area Double Precision"
v.to.db map=grid_map_v option=area column=area units=meters

But for other grids, like a non regular lon lat grid (more precise in the 
middle) or for a lambert conformal 'natural' grid (which are the examples
I have) or any other grid that could arise, is there a simple way to do
a vector corresponding with that grid?

If not, are there some code somewhere that helps doing geometric vectors,
like grids (but one could also imagine doing circles and so on) and is readily
converted in grass vector format or directly leads to grass vector format?
Something like a high level API to do vector geometries, and not something
where you have to enter every coordinate and curve informations?

Also are you aware of people interested in such developments, are there
library of vector code/features/scripting or similar in the open source 
GIS community?


More information about the grass-user mailing list