[GRASS-user] import satellite data in Grass

Moritz Lennert mlennert at club.worldonline.be
Wed Jun 25 10:33:05 EDT 2008

On 25/06/08 15:15, Martina Schaefer wrote:
> Hi Moritz,
> what you propose sounds good for me ... but it didn't work :-(
>>> What I want to do is the following:
>>> I have satellite photos from a glacier and we want to get an idea of 
>>> the distribution of the crevasses over this glacier.
>>> In a first step we want to assign every 100x100m grid cell of this 
>>> glacier a value reflecting if there are very little, some, a lot of 
>>> crevasses. As we don't know for the moment how to do this 
>>> automatically (perhaps it would be possible to use the color in a 
>>> next step), the idea was to define this value by "eyeballing". Any 
>>> ideas how to do this a better way are welcome, too, but I think it's 
>>> not easy.
>>> Now the questions is "only" how to handle the grid and my values in 
>>> Grass ...
>> You could use v.mkgrid to create a vector grid,
> I created such a grid. This grid does not appear in the list ¨Select 
> item" when I do "add a raster layer" in the GIS Manager. I hope this is 
> normal?

Yes, see hint just above ;-)

> As Rows and Columns I put the rows an columns of my x-y gridding, I hope 
> this is correct?

What do you mean by "my x-y gridding".

As you want to have grid cells of a given size, you will have to 
calculate your number of grids.

You have two options for creating your grid:

1) using position=region
	- Set your region extents to multiples of your grid resolution
(i.e. 100m in your case) - the origin of your grid will be the lower 
left corner defined by your region
	- Calculate your numbers of columns and rows using the region extension 
info (g.region -p), i.e. rows=North-South/Resolution, 

2) using position=coor (idependent of region settings)
	- Choose a point at the South-West corner just outside of your
image as starting point. Depending on your needs you might want to round 
these coordinates to your resolution.
	- Use r.info on your image to identify its extents
	- Calculate your numbers of columns and rows using the image extents, 
i.e. rows=North-South/Resolution, cols=East-West/Resolution

>> add a column for number of crevasses with v.db.addcol,
> in v.db.addcol my new grid appears in the list of items for "vector map 
> for which to edit attribut table), I put layer=1 and name=D
> then I get
> "DBMI-DBF driver error:
> SQL parser error in statement:
> Error in db_execute_immediate()
> Error while executing: "ALTER TABLE density ADD COLUMN D
> "
> ERROR: Cannot continue (problem adding column)."
> Has anybody an idea what this could mean?

Yes, you need to indicate the type of column as well, so the columns 
parameter should be 'D int' if D is supposed to hold the number of 
crevasses which I believe would be integers.

The general idea of my proposal was to create a _vector_ grid with the 
relevant column in its attribute table and then use the digitization 
tool v.digit to display this grid on top of your image and edit the 
attribute values after visually identifying the number of crevasses in 
your grid cell. You would then end up with a vector grid map with the 
crevasse count in each cell. If necessary, you can transform this into 
raster with v.to.rast.

Another option to replace v.digit would be to use the command line and 
"old-style" monitors to display your two layers and then use d.what.vect 
-e to edit the attributes. Something like this (in a terminal - after 
having added your count column to the vector grid's attribute table):

d.mon x0
d.rast YourImage
d.vect YourGrid type=area fcol=none
d.what.vect -e map=YourGrid (-> click on the map to see a form pop up)


More information about the grass-user mailing list