Greetings<div>This is probably a very dumb thing but I&#39;m having a few difficulties doing this. I have an SHAPEFILE with classification polygons. And I need to Convert to raster (e.g. TIF) So I thought of using GRASS (of course)</div>
<div><br></div><div>1- Define region with a Landsat image used to create those Training areas outside GRASS</div><div>2- Run v.in.gor</div><div><div>v.in.ogr -o dsn=C:\Data\GISDataBase\training_data.shp output=train00</div>
<div>Over-riding projection check</div><div>Layer: training_data</div><div>Default driver / database set to:</div><div>driver: dbf</div><div>database: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/</div><div>Importanto feições do mapa 448...</div>
<div>-----------------------------------------------------</div><div>Building topology for vector map &lt;train00&gt;...</div><div>Registering primitives...</div><div>448 primitives registered</div><div>2903 vertices registered</div>
<div>Building areas...</div><div>448 areas built</div><div>448 isles built</div><div>Attaching islands...</div><div>Attaching centroids...</div><div>Number of nodes: 448</div><div>Number of primitives: 448</div><div>Number of points: 0</div>
<div>Number of lines: 0</div><div>Number of boundaries: 448</div><div>Number of centroids: 0</div><div>Number of areas: 448</div><div>Number of isles: 448</div><div>Number of areas without centroid: 448</div><div>-----------------------------------------------------</div>
<div>Cleaning polygons, result is not guaranteed!</div><div>Building topology for vector map &lt;train00&gt;...</div><div>Number of nodes: 448</div><div>Number of primitives: 448</div><div>Number of points: 0</div><div>Number of lines: 0</div>
<div>Number of boundaries: 448</div><div>Number of centroids: 0</div><div>Number of areas: -</div><div>Number of isles: -</div><div>-----------------------------------------------------</div><div>Break polygons:</div><div>
-----------------------------------------------------</div><div>Remove duplicates:</div><div>-----------------------------------------------------</div><div>Break boundaries:</div><div>-----------------------------------------------------</div>
<div>Remove duplicates:</div><div>-----------------------------------------------------</div><div>Clean boundaries at nodes:</div><div>-----------------------------------------------------</div><div>Change dangles to lines:</div>
<div>-----------------------------------------------------</div><div>Remove bridges:</div><div>-----------------------------------------------------</div><div>Building topology for vector map &lt;train00&gt;...</div><div>
Building areas...</div><div>448 areas built</div><div>448 isles built</div><div>Attaching islands...</div><div>Number of nodes: 448</div><div>Number of primitives: 448</div><div>Number of points: 0</div><div>Number of lines: 0</div>
<div>Number of boundaries: 448</div><div>Number of centroids: 0</div><div>Number of areas: 448</div><div>Number of isles: 448</div><div>Number of areas without centroid: 448</div><div>Layer: training_data</div><div>-----------------------------------------------------</div>
<div>-----------------------------------------------------</div><div>Building topology for vector map &lt;train00&gt;...</div><div>Registering primitives...</div><div>896 primitives registered</div><div>3351 vertices registered</div>
<div>Building areas...</div><div>448 areas built</div><div>448 isles built</div><div>Attaching islands...</div><div>Attaching centroids...</div><div>Number of nodes: 896</div><div>Number of primitives: 896</div><div>Number of points: 0</div>
<div>Number of lines: 0</div><div>Number of boundaries: 448</div><div>Number of centroids: 448</div><div>Number of areas: 448</div><div>Number of isles: 448</div><div>-----------------------------------------------------</div>
<div>448 input polygons</div><div>Total area: 6.159110e+006 (448 areas)</div><div>Overlapping area: 0.000000e+000 (0 areas)</div><div>Area without category: 0.000000e+000 (0 areas)</div><div><br></div><div>3- It created a vectorial train00. When I open it at GRASS and overlays it with my landsat images they MATCH...</div>
<div>4- I want to create a RASTER exacly with the same characteristics as my landsat images but using Class Field as Raster values. I mean, the pixels inside polygons with class value 12 will have a vlue of 12.</div><div>
Reading GRASS book I decided to use v.to.rast</div><div><div>v.to.rast input=train00@PERMANENT output=train_raster00 type=area column=Class labelcolumn=cat</div><div>Loading data...</div><div>Pass 1 of 2:</div><div>Reading areas...</div>
<div>Reading features...</div><div>Writing raster map...</div><div>Pass 2 of 2:</div><div>Reading areas...</div><div>Writing raster map...</div><div>Converted areas: 448 of 448</div><div>Converted points/lines: 0 of 0</div>
<div>v.to.rast complete.</div><div><br></div><div>5- Open train_raster00 and it seems to be Ok when comparing with Vectorial</div><div>6- Metadata from is train_raster00</div><div><div> |   Type of Map:  raster               Number of Categories: 0               |</div>
<div> |   Data Type:    CELL                                                       |</div><div> |   Rows:         7109                                                       |</div><div> |   Columns:      7662                                                       |</div>
<div> |   Total Cells:  54469158                                                   |</div><div> |        Projection: x,y                                                     |</div><div> |            N: 23020.21492744    S: -190249.78507256   Res:    30           |</div>
<div> |            E: 177696.83076767    W: -52163.16923233   Res:    30           |</div><div> |   Range of data:    min = 1  max = 17                                      |</div><div>And Metadata from Landsat is:</div><div>
<div>|   Type of Map:  raster               Number of Categories: 0               |</div><div> |   Data Type:    CELL                                                       |</div><div> |   Rows:         7109                                                       |</div>
<div> |   Columns:      7662                                                       |</div><div> |   Total Cells:  54469158                                                   |</div><div> |        Projection: x,y                                                     |</div>
<div> |            N: 23020.21492744    S: -190249.78507256   Res:    30           |</div><div> |            E: 177696.83076767    W: -52163.16923233   Res:    30           |</div><div> |   Range of data:    min = 0  max = 255                                     |</div>
<div><br></div><div>So it maches :)</div><div><br></div><div>7- Now, export this raster.Since I want a Geotiff I used:</div><div>r.out.tiff input=train_raster00@PERMANENT output=trainraster00a</div><div>If I do gdalinfo to the exported file I get:river: GTiff/GeoTIFF</div>
<div>Files: /mnt/GIS/trainraster00a.tif</div><div>Size is 7662, 7109</div><div>Coordinate System is `&#39;</div><div>Image Structure Metadata:</div><div>  INTERLEAVE=PIXEL</div><div>Corner Coordinates:</div><div>Upper Left  (    0.0,    0.0)</div>
<div>Lower Left  (    0.0, 7109.0)</div><div>Upper Right ( 7662.0,    0.0)</div><div>Lower Right ( 7662.0, 7109.0)</div><div>Center      ( 3831.0, 3554.5)</div><div>Band 1 Block=7662x1 Type=Byte, ColorInterp=Red</div><div>
Band 2 Block=7662x1 Type=Byte, ColorInterp=Green</div><div>Band 3 Block=7662x1 Type=Byte, ColorInterp=Blue</div><div><br></div><div>The Size is OK but the Geo information was wipped out</div><div>And Why does it create 3 bands? I only need 1 band with Class values.</div>
<div>Can anyone point me out what am I doing wrong?</div><div><br>Thanks</div><div>Best regards</div><div>Kim~</div><div>Sorry for the long EMAIL but I really need to explain what I am doing</div></div></div></div></div>