[GRASS-user] r.to.vect to selected locations only

Hamish hamish_b at yahoo.com
Mon Jun 23 05:24:19 EDT 2008


Maning wrote:
> Here's the process I plan to do for my image classification
> 
> 1. Create an unsupervised classification from TCAP images to get
> clusters of pure pixel values.
> 2. Convert to vector.
> 3. Create a random location of vector points.
> 4. From the converted vector layer, select random polygons
> (approximately 60 polys for each class).
> 5. Label training polygons for the desired classification classes
> 6. Run smap classification
> 
> I will be running this method for a series of LANDSAT
> images (one tile at a time).
> 
> My problem is by converting the whole image from raster to vector
> areas, the v.to.rast module reports "Killed" and could not complete
> the conversion.
> This maybe due to the whole image being large.

Yes, that's an out of memory error. The operating system kills the offending processes so that the rest of the computer can keep running.


>  |   Data Type:    CELL                                    
>  |   Rows:         7518                                    
>  |   Columns:      8504                                    

probably for sanity's sake you may want to stay under about 4000x4000.
It is not a hard limit, the only thing that should limit you for bigger sizes is computer resources and your time.


> What I need is to, limit raster to vector conversion to the
> desired randomly selected locations only. So that r.to.vect could
> complete the conversion.
> 
> Any ideas?


I've needed a similar thing a number of times, and so I've just added a new add-on script which may be helpful.

"g.region.point - g.region.point is a shell script which resets the computational region to a square box around a given coordinate. It is intended for use within GRASS scripts to speed up processing by focusing expensive raster calculations onto a small area of interest."

  http://grass.osgeo.org/wiki/GRASS_AddOns#General_add-ons
  http://trac.osgeo.org/grass/browser/grass-addons/general/g.region.point

also perhaps helpful is the v.random.cover add-on script.



Hamish


ps- If anyone who knows about the clustering modules would like to update the wiki page describing what's available, please go for it. I've no idea.
  http://grass.osgeo.org/wiki/Image_processing#Clustering



      



More information about the grass-user mailing list