[GRASS-user] Extracting centroids as a raster (and are these centroids really at the center?)

Marcello Gorini gorini at gmail.com
Tue Jan 3 09:15:25 EST 2012


Dear all,

I need to extract the center of raster areas as another raster. 

Since my script is totaly raster-based (and I am not used to using vectors),
I tried to find some kind of r.thin that would generate the centroids,
instead of trying to "force" the area into lines.

I believe there is no such module (please correct me if I'm wrong), so I had
to use vectors. 

I then did:
- r.to.vect input=raster_areas output=vectorized_areas feature=area
- v.to.points in=vectorized_areas out=vector_centroids type=centroid
- v.to.rast input=vector_centroids output=raster_centroids use=val

I was succesfull, but I have to questions:
1- Is there a better way to accomplish this? 
2 - How are these centroids calculated? I ask this because they don't seem
to be the actual visual centroid, as the attached image hopefully clarifies
to you. The image shows three example areas with the centroids both as an
"x" and as a raster in pink.

I thank you all very much for any help and wish you a great new year with a
lot of intelectual challenges.

Best,
Marcello.

http://osgeo-org.1803224.n2.nabble.com/file/n7146840/areas.png 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Extracting-centroids-as-a-raster-and-are-these-centroids-really-at-the-center-tp7146840p7146840.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list