Glynn Clements wrote:
temiz wrote:

I want to get min and max coord values from  of catagorized raster
map.

something like:  r.stats -agn hey6 > gives minx maxx miny maxy
is it possible  ?
do you mean you want the coordinates of the bounding boxes surrounding
each category?

loop over each CAT (`r.describe`), create a MASK or new map based on
that cat, then 'g.region -p zoom='.
thank you and other friends

I wrote a script to calculate the coordinates of bounding box of each category using "g.region -p zoom="

I am wondering if  "r.stats -agn"  is second alternative ?

My raster map is something like some islands.
if I get coord value of each category , I can calculate most north- south and, most west- east, and then determine the coords of minimum bounding box?

This is more efficient, particularly for many categories, but it
requires a bit more work. The attached script takes the output from
"r.stats -gn" and computes the bounding boxes for each category, e.g.:

        r.stats -gn fields | ./bbox.awk | sort -n

------------------------------------------------------------------------

#!/usr/bin/awk -f
{
        if ($3 in n)
        {
                if (n[$3] < $2) n[$3] = $2
                if (s[$3] > $2) s[$3] = $2
                if (e[$3] < $1) e[$3] = $1
                if (w[$3] > $1) w[$3] = $1
        }
        else
        {
                n[$3] = s[$3] = $2
                e[$3] = w[$3] = $1
        }
}

END {
        for (i in e)
                print i,n[i],s[i],e[i],w[i]
}
Thank you again

I preferred r.stats, because its output more is manageable than g.region's in terms of querying.
The awk script solved the issue practically.
I was thinking to port the data to postgresql to find min, max coord values for each category.

By the way just an idea:

can "g.region zoom=" work with respect to cat value of a map in grass's future releases ?

regards


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

_______________________________________________
grassuser mailing list
[email protected]
http://grass.itc.it/mailman/listinfo/grassuser

Reply via email to