[GRASS-user] improved area calculations for raster maps.

Hamish hamish_nospam at yahoo.com
Wed Sep 6 23:31:58 EDT 2006


Hamish:
> > Just saw this on slashgeo.org,
> >
> > http://www.geovista.psu.edu/sites/geocomp99/Gc99/076/gc_076.htm
> >
> > from a superficial look at the rotated squares and map of China I'd
> > say GRASS's v.to.rast & r.in.poly do a better job, but it would be
> > interesting for someone to run some trials and see how we stack up.
[probably the same actually,]

Dylan:
> I saw that too, but had difficulting replicating the tests, as I could
> not figure out how to rotate a raster generated with r.plane. recent
> traffic on this list suggests that tests could be done by r.to.vect
> -> v.transform ... 

I just created a bunch of squares in a matlab* script & made them into
GRASS vectors (see attached; octave works in place of matlab).

See v.to.rast help page for tips on how/why lines, boundaries, and areas
are rasterized in slightly different ways.

Break this output into 9 different files before importing into 9
different vector maps! Then v.to.rast, r.report to get raster area.

e.g. 5 deg rotated:

v.in.ascii in=rot5.txt out=rot5 -n format=standard

# res of "6" units
g.region n=100 s=-100 w=-100 e=100 res=6
v.to.rast in=rot5 out=rot_5deg.6res use=cat

d.rast rot_5deg.6res
d.vect rot5 type=boundary

r.report map=rot_5deg.6res unit=me -qhn

area of box for this res: 9880.62443
 (vs 10000 vector area)

same res, 45deg: 9733.70064


I find the paper's perimeter & resolution stuff a bit confusing to
replicate, and due to perimeter's fractal nature less interesting than
reported area.


Hamish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rotating_sq.m
Type: application/octet-stream
Size: 1229 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20060907/5c3f18b7/rotating_sq.obj
-------------- next part --------------
B 5
 45.4519477672043735 54.1675220419701873
 -54.1675220419701873 45.4519477672043735
 -45.4519477672043735 -54.1675220419701873
 54.1675220419701873 -45.4519477672043735
 45.4519477672043735 54.1675220419701873
C 1 1
 35.220801 3.081421
 1 5

B 5
 40.5579787672638830 57.9227965339569266
 -57.9227965339569266 40.5579787672638830
 -40.5579787672638830 -57.9227965339569266
 57.9227965339569266 -40.5579787672638830
 40.5579787672638830 57.9227965339569266
C 1 1
 34.818212 6.139390
 1 10

B 5
 35.3553390593273846 61.2372435695794479
 -61.2372435695794479 35.3553390593273846
 -35.3553390593273846 -61.2372435695794479
 61.2372435695794479 -35.3553390593273846
 35.3553390593273846 61.2372435695794479
C 1 1
 34.150635 9.150635
 1 15

B 5
 29.8836238730119845 64.0856382055788600
 -64.0856382055788600 29.8836238730119845
 -29.8836238730119845 -64.0856382055788600
 64.0856382055788600 -29.8836238730119845
 29.8836238730119845 64.0856382055788600
C 1 1
 33.223151 12.092238
 1 20

B 5
 24.1844762647975351 66.4463024388674626
 -66.4463024388674626 24.1844762647975351
 -24.1844762647975351 -66.4463024388674626
 66.4463024388674626 -24.1844762647975351
 24.1844762647975351 66.4463024388674626
C 1 1
 32.042819 14.941812
 1 25

B 5
 18.3012701892219312 68.3012701892219383
 -68.3012701892219383 18.3012701892219312
 -18.3012701892219312 -68.3012701892219383
 68.3012701892219383 -18.3012701892219312
 18.3012701892219312 68.3012701892219383
C 1 1
 30.618622 17.677670
 1 30

B 5
 12.2787803968972895 69.6364240320018979
 -69.6364240320018979 12.2787803968972895
 -12.2787803968972895 -69.6364240320018979
 69.6364240320018979 -12.2787803968972895
 12.2787803968972895 69.6364240320018979
C 1 1
 28.961398 20.278989
 1 35

B 5
 6.1628416716219334 70.4416026402758746
 -70.4416026402758746 6.1628416716219334
 -6.1628416716219334 -70.4416026402758746
 70.4416026402758746 -6.1628416716219334
 6.1628416716219334 70.4416026402758746
C 1 1
 27.083761 22.725974
 1 40

B 5
 0.0000000000000043 70.7106781186547551
 -70.7106781186547551 0.0000000000000043
 -0.0000000000000043 -70.7106781186547551
 70.7106781186547551 -0.0000000000000043
 0.0000000000000043 70.7106781186547551
C 1 1
 25.000000 25.000000
 1 45


More information about the grass-user mailing list