[GRASS-user] Re: grass-user Digest, Vol 46, Issue 11

Richard Chirgwin rchirgwin at ozemail.com.au
Fri Feb 5 02:13:32 EST 2010


>
> Message: 6
> Date: Thu,  4 Feb 2010 22:54:58 +0100
> From: "Matteo Toro" <ciccpaol at libero.it>
> Subject: [GRASS-user] 3d vector file
> To: "grass-user" <grass-user at lists.osgeo.org>
> Message-ID: <KXC7JM$57548290A24594F3149AE9AD2A9AA743 at libero.it>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi,
>
> starting from a 2d vector and using the v.extrude command i got a 3d vector, with the following settings:
>
> zshift=0,  hcolumn=a_level (the column where the topographic heights are written),  type=line
>
> the output 3d vector is regularly created and checking it with v.info i get at the very first line: B(OTTOM)=10 T(OP)=150  and also  "map is  3d: yes ". Everything seems right!
>
> Starting nviz anyway, my file is not 3d rendered...i would like to know if the file is really 3d and the problem is only about nviz, or if the file is just 2d...
>
> I would like to know it, not because of the 3d rendering graphics, but mostly because i need to create a script that works on the third dimension of the vector file to get the height differences.
>   
I don't know about the rendering, but regarding height a couple of 
possibilities occur.

But first: are you looking for height differences within the map, or 
compared to a second map?

If you're comparing attributes, you don't actually need to create a 3D 
map - you just need an attribute column that contains height. You can 
then use various vector modules.

Example (without knowing your exact problem): I have a map that contains 
spot heights, and I want each spot to contain (a) its own height and (b) 
the height of the nearest other spot. Map name in the example is Height. 
The spot elevation is contained in the column Elevation.

1. v.db.addcol Height columns="Near_Cat int,Near_Elevation double"
(This adds a column for the category and elevation of the nearest point)

2. g.copy vect=Height,Temp_Height
(This creates a second map you can use for v.distance)

3. v.distance -a from=Height from_type=point to=Temp_Height 
to_type=point upload=cat column=to_cat table=Height_Matrix
(Using the -a flag measures from all points, to all points, and stores 
the results in a table called Height_Matrix)

4. echo "update Height, Height_Matrix set Near_Cat=to_cat, where 
cat=from_cat" | db.execute
(This grabs the to_cat to use in the next query. Yes! There probably IS 
a neater way to do this but I have had weird faults from v.distance 
using the -a flag)

5. echo "update Height, Temp_Height set Near_Elevation=Elevation where 
Height.Near_cat=Temp_Height.cat" | db.execute
(Get the elevation of the nearest point back into the original map).

More information about your specific needs would be useful!

Cheers,
Richard Chirgwin


> thanks a lot!!!
>
> PS: any idea about a script that returns the height differences???   :-) 
>
> Matteo


More information about the grass-user mailing list