[GRASS-user] Some questions about d.vect and d.rast
Moritz Lennert
mlennert at club.worldonline.be
Fri Apr 29 10:05:04 EDT 2011
On 29/04/11 11:34, Moritz Lennert wrote:
> On 29/04/11 00:37, Hamish wrote:
>> Johannes wrote:
>>> First I've two general questions about d.vect:
>>> 1) Is it possible to use own symbol for the point icons?
>>
>> see
>> http://grass.osgeo.org/wiki/IconSymbols#Authoring_instructions
>>
>>> 2) How can I change the line type (e.g dashed line, etc.)?
>>
>> You can't. (only in ps.map)
>> Maybe it will be possible in grass7?
>
> One possible option (although admittedly somewhat brute force) is to use
> v.to.points, playing with the dmax parameter in v.to.point or with the
> symbol size to differentiate.
>
> You can only use symbols that are the same in all directions (e.g.
> circles) since the orientation of the symbol will not follow the
> orientation of the line.
>
And more as proof-of-concept fun on Friday afternoon than anything
serious (but who knows :-) ), here's a (convoluted) way to actually
getting line patterns (using roadsmajor from NC demo data set) with d.vect:
#Split the lines into smaller segments to get more detailed azimuths
v.split roadsmajor out=temp length=100
#attach unique categories to each new line segment in layer 2, create
table for layer 2 and retrieve whatever info is interesting from the
original roads attribute table (in our case we'll only use MULTILANE)
v.category temp option=add layer=2 out=roads
v.db.addtable roads layer=2
v.db.addcol roads layer=2 col="multilane varchar(1)"
v.to.db roads layer=2 qlayer=1 option=query qcolumn=MULTILANE
columns=multilane
#add columns for azimuth (CC from north) and aziumthccw (CCW from east)
and fill them
v.db.addcol roads col="azimuth double precision" layer=2
v.db.addcol roads col="azimuthccw double precision" layer=2
v.to.db roads option=azimuth colu=azimuth layer=2
echo "update roads_2 set azimuthccw=450-azimuth where azimuth>90" |
db.execute
echo "update roads_2 set azimuthccw=90-azimuth where azimuth<=90" |
db.execute
#transform lines into points
v.to.points roads out=roadspoint dmax=100 llayer=2
#draw excerpt of the roads in a map with two linepatterns depending on
multilane property
GRASS_RENDER_IMMEDIATE=TRUE
GRASS_HEIGHT=960
GRASS_WIDTH=1280
g.region n=233208 s=221687 w=624737 e=642078
d.vect roadspoint icon=linepatterns/line02 rot_column=azimuthccw
where="multilane='n'"
export GRASS_PNG_READ=TRUE
d.vect roadspoint icon=linepatterns/line10 rot_column=azimuthccw
where="multilane='y'"
And here are the symbols used
linepatterns/line02:
VERSION 1.0
BOX -0.5 -0.5 0.5 0.5
STRING
LINE
-0.1 0
0.1 0
END
END
linepatterns/line10:
VERSION 1.0
BOX -0.5 -0.5 0.5 0.5
STRING
LINE
-0.5 0
0.5 0
END
END
The result is shown on the attached map.
Enjoy your weekend !
;-)
Moritz--
Institut de Gestion de l'Environnement et d'Aménagement du Territoire
(IGEAT)
Université Libre de Bruxelles
Bvd du Triomphe, CP 246 (Campus Plaine)
1050 Bruxelles
Belgique
tél. + 32 2 650.56.16 / 50.72 (secr.)
fax + 32 2 650.50.92
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linepatterns.png
Type: image/png
Size: 9085 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20110429/3aeecb40/linepatterns.png
More information about the grass-user
mailing list