[GRASS-user] road extraction using grass

Nathaniel Iwuchukwu ikechinedu at gmail.com
Sun Apr 4 14:33:16 EDT 2010


So far, i have been able to extra road from a satellite imagery but it has
broken lines and it also captured buildings. these are the steps i followed
to arrive at this stage:
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > g.mlist rast
pitt_composite
pitts.blue
pitts.green
pitts.red
pittthin
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > g.region rast=pitts.red
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > d.mon x0
using default visual which is TrueColor
ncolors: 16777216
Graphics driver [x0] started
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > d.rgb red=pitts.red
green=pitts.green blue=pitts.blue
 100%
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > d.where

Buttons:
Left:   where am i
Middle: draw to/from here
Right:  quit this

             EAST:             NORTH:
        569059.375        4464771.875
        569059.375        4464778.125
            569425        4464771.875
        569409.375        4464521.875
            569050         4464531.25
          569062.5        4464778.125
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > g.region -p w=569062 e=569425
s=4464778 n=4464771
ERROR: Invalid region: North must be larger than South
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > g.region -p w=569062 e=569425
s=4464771 n=4464778
projection: 1 (UTM)
zone:       17
datum:      nad83
ellipsoid:  grs80
north:      4464778
south:      4464771
west:       569062
east:       569425
nsres:      0.30434783
ewres:      0.3
rows:       23
cols:       1210
cells:      27830
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > r.composite red=pitts.red
green=pitts.green blue=pitts.blue out=pitts
Creating color table for output raster map...
 100%
Writing raster map <pitts>...
 100%
r.composite complete. Raster map <pitts> created.
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > d.rast pitts
 100%
GRASS 6.4.0RC5 (Pittsburgh):~/Desktop > d.rgb red=pitts.red
green=pitts.green blue=pitts.blue
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast pitts
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > v.digit -n train bgcmd="d.rast pitts"
 100%
Building topology for vector map <train>...
Registering primitives...
5 primitives registered
21 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 9
Number of primitives: 5
Number of points: 0
Number of lines: 0
Number of boundaries: 4
Number of centroids: 1
Number of areas: 0
Number of isles: 0
Number of incorrect boundaries: 4
Number of centroids outside area: 1
Region restored to original extent.
GRASS 6.4.0RC5 (sis):~/Desktop > v.to.rast in=traingis out=traingis use=attr
type=area col=label_id labelcolumn=label
Loading data...
Reading features...
 100%
Writing raster map...
 100%
Converted areas: 0 of 0
Converted points/lines: 0 of 0
v.to.rast complete.
GRASS 6.4.0RC5 (sis):~/Desktop > i.group group=sislabgp subgroup=sislabsub
in=sismap.red,sismap.green,sismap.blue
Adding raster map <sismap.red at PERMANENT> to group
Adding raster map <sismap.green at PERMANENT> to group
Adding raster map <sismap.blue at PERMANENT> to group
Adding raster map <sismap.red at PERMANENT> to subgroup
Adding raster map <sismap.green at PERMANENT> to subgroup
Adding raster map <sismap.blue at PERMANENT> to subgroup
i.group complete.
GRASS 6.4.0RC5 (sis):~/Desktop > i.gensigset trainingmap=trainsis
group=sislabgp subgroup=sislabsub signaturefile=sist.sig
Finding training classes...
 100%
3 classes found
Reading raster maps...
 100%
Clustering class 1 (3903 pixels)...
Number of subclasses is 4
Clustering class 2 (3126 pixels)...
Number of subclasses is 5
Clustering class 3 (2593 pixels)...
Number of subclasses is 4
i.gensigset complete.
GRASS 6.4.0RC5 (sis):~/Desktop > i.smap group=sislabgp subgroup=sislabsub
signaturefile=sist.sig out=test_class
Processing rows 1-128 (of 1833)...
Processing rows 129-256 (of 1833)...
Processing rows 257-384 (of 1833)...
Processing rows 385-512 (of 1833)...
Processing rows 513-640 (of 1833)...
Processing rows 641-768 (of 1833)...
Processing rows 769-896 (of 1833)...
Processing rows 897-1024 (of 1833)...
Processing rows 1025-1152 (of 1833)...
Processing rows 1153-1280 (of 1833)...
Processing rows 1281-1408 (of 1833)...
Processing rows 1409-1536 (of 1833)...
Processing rows 1537-1664 (of 1833)...
Processing rows 1665-1792 (of 1833)...
Processing rows 1793-1833 (of 1833)...
Writing raster map <test_class>...
 100%
i.smap complete.
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast test_class
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.null test_class setnull=18
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast test_class
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.thin
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast test_test
WARNING: Socket is already in use or not accepting connections.
WARNING: Use d.mon to select a monitor
ERROR: No graphics device selected
GRASS 6.4.0RC5 (sis):~/Desktop > d.mon x0
using default visual which is TrueColor
ncolors: 16777216
Graphics driver [x0] started
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast test_test
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.to.vect test_test feature=line
out=roadsExtracting lines...
 100%
 100%
Building topology for vector map <roads>...
Registering primitives...
100484 primitives registered
254643 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 94750
Number of primitives: 100484
Number of points: 0
Number of lines: 100484
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
r.to.vect complete.
GRASS 6.4.0RC5 (sis):~/Desktop > d.vect roads
GRASS 6.4.0RC5 (sis):~/Desktop > r.null test_class setnull=2
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.null test_class setnull=8
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.null test_class setnull=4
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.null test_class setnull=6
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.thin
GRASS 6.4.0RC5 (sis):~/Desktop > d.rast test_test
 100%
GRASS 6.4.0RC5 (sis):~/Desktop > r.to.vect test_test feature=line out=roads
Extracting lines...
 100%
 100%
Building topology for vector map <roads>...
Registering primitives...
19581 primitives registered
54295 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
 100%
Number of nodes: 19302
Number of primitives: 19581
Number of points: 0
Number of lines: 19581
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
r.to.vect complete.
GRASS 6.4.0RC5 (sis):~/Desktop > d.vect roads
How can i get roads maps without gaps or broken lines?

Nathaniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100404/637f948a/attachment.html


More information about the grass-user mailing list