<html>
<body>
Would the following r.mapcalc command generate a map of the x-coordinates
for the cells in a raster map?<br><br>
x_coordinates=x()<br><br>
If so, do the same for the y_coordinates and then calculate the center of
mass &quot;by hand&quot; with the help of the r.stats module (because it
doesn't appear that r.mapcalc has a sum() function).<br><br>
Tedious, but I thought I would throw it out there.<br><br>
Martin<br><br>
<br><br>
<br>
At 02:29 PM 6/3/2005, you wrote:<br>
<blockquote type=cite class=cite cite="">Chuck,<br><br>
Does this assume you only have one raster map cell shape? What if there
are multiples, which is what I think Jason has? I think, then, you would
get a single center of mass for the cluster of separate cells.<br><br>
Tom<br><br>
<br>
Charles Ehlschlaeger wrote:<br>
<blockquote type=cite class=cite cite="">I don't have GRASS working on my
computer to check this out, however, here is a procedure to calculating
the center of a shape:<br><br>
Assume you have a raster map &quot;shape&quot; where the value of 0 is at
all places w/out the shape and a positive value where the shape is
located at.<br><br>
1) Find the total volume of the shape w/:<br><br>
1a) r.mapcalc command function:<br>
one = &quot;1&quot;<br><br>
1b) r.volume d=shape clump=one<br><br>
(There should be a better way of doing this.)<br><br>
2) Calculate volumeOnAxis of shape in North-South dimension with the
r.mapcalc command:<br><br>
NSvolumeOn = shape * y()<br><br>
3) Calculate massOnAxis of shape in East-West dimension with the
r.mapcalc command:<br><br>
EWvolumeOn = shape * x()<br><br>
4) Find the total volume of NSvolumeOn with:<br><br>
r.volume d= NSvolumeOn clump=one<br><br>
5) Find the total volume of EWvolumeOn with:<br><br>
r.volume d= NSvolumeOn clump=one<br><br>
6) The coordinates of the center will be <br>
east = total volume of EWvolumeOn / volume of shape<br>
north = total volume of NSvolumeOn / volume of shape<br><br>
A little csh and awk programming could replicate Idrisi's center
program.<br><br>
&lt;INSERT DISCLAIMERS ABOUT USING AT OWN RISK...&gt;<br><br>
sincerely, chuck<br><br>
Markus Neteler wrote:<br>
<blockquote type=cite class=cite cite=""><br>
<pre>On Thu, Jun 02, 2005 at 03:42:36PM -0400, Jason Horn wrote:
&nbsp;
</pre><font face="Courier New, Courier"></font>
<blockquote type=cite class=cite cite=""><br>
<pre>Does anyone know of a way to calculate the center of a shape in
a&nbsp; 
raster file based on shape and pixel values?&nbsp; For example, imagine
a&nbsp; 
NEXRAD RADAR image showing a storm cloud.&nbsp; Could GRASS be used
to&nbsp; 
calculate the center of the cloud?&nbsp; I'm not having any luck finding
a&nbsp; 
grass raster function to do this.
&nbsp;&nbsp;&nbsp;
</pre><font face="Courier New, Courier"></font></blockquote><br>
<pre>
I did a quick google search for
&nbsp;nexrad storm cell identification 
or
&nbsp;nexrad&nbsp; SCIT
which a couple of hits. Some programming might
be needed. I don't know if these algorithms are freely
available.

Markus

&nbsp;
</pre><font face="Courier New, Courier"></font></blockquote><br><br>
<br>
<pre>-- 
Chuck Ehlschlaeger, Associate Professor &amp; GIS Center Director
Department&nbsp; of&nbsp; Geography,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Western&nbsp; Illinois&nbsp; University
306C Tillman Hall,&nbsp; 1 University Circle,&nbsp; Macomb,&nbsp;
IL&nbsp;&nbsp; 61455
<a href="mailto:cre111@wiu.edu">cre111@wiu.edu</a>,&nbsp;&nbsp;&nbsp;
phone: 309-298-1841,&nbsp;&nbsp;&nbsp;&nbsp; fax:
309-298-3003</pre><font face="Courier New, Courier"></font></blockquote>
<br><br>
<pre>-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:<x-tab>&nbsp;&nbsp;</x-tab><a href="mailto:thomas.adams@noaa.gov">
thomas.adams@noaa.gov</a>

VOICE:<x-tab>&nbsp;&nbsp;</x-tab>937-383-0528
FAX:<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>937-383-0033</pre>
<font face="Courier New, Courier"></font></blockquote></body>
</html>