# Center of gravity for points

4 replies to this topic

### #1 frax Posted 28 October 2009 - 03:31 AM

frax

Hall of Fame

• 2,420 posts
• Gender:Male
• Location:Stockholm, Sweden
• Interests:music, hiking, friends, nature, photography, traveling. and maps!
• Sweden

Hi, I am investigating a little analysis, and what tools to use for that. I have a dataset with points (alternatively a grid/raster with 1/0 values) and I want to calculate the center of gravity for these, possibly with weights as well (optional).

Maybe one can even do that using some math in python/vba even?

I just checked ArcScripts, but I didn't find anything too valuable there...
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/

### #2 frax Posted 28 October 2009 - 03:38 AM

frax

Hall of Fame

• 2,420 posts
• Gender:Male
• Location:Stockholm, Sweden
• Interests:music, hiking, friends, nature, photography, traveling. and maps!
• Sweden

Or is it as simple as just calculating the average x/y coords for the whole set? (with weights, if one desire that)
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/

### #3 Hans van der Maarel Posted 28 October 2009 - 04:26 AM

Hans van der Maarel

CartoTalk Editor-in-Chief

• 4,166 posts
• Gender:Male
• Location:The Netherlands
• Interests:Cartography, GIS, history, popular science, music.
• Netherlands

Or is it as simple as just calculating the average x/y coords for the whole set? (with weights, if one desire that)

I think that would do the trick, yes.
Hans van der Maarel - Cartotalk Editor
Red Geographics

### #4 Tim Stallmann Posted 28 October 2009 - 07:34 AM

Tim Stallmann

Contributor

• Validated Member
• 18 posts
• Location:Durham, NC, USA
• United States

For a small area this will work, but otherwise I think there are some problems with just taking an average of the x/y values since depending on where the reference point of your coordinate system is you'll often end up choosing the midpoint of the longer great circle between two points rather than the shorter one. One fix is to calculate x/y/z values on the sphere, then average those points in 3D. You'll get a point somewhere inside the globe, but if you then trace a line from the center of the globe out through that point it will intersect at the centroid of the set.

Somebody has a write-up on this here: http://www.notionpar...ce-of-a-sphere/

-Tim

Or is it as simple as just calculating the average x/y coords for the whole set? (with weights, if one desire that)

I think that would do the trick, yes.

### #5 frax Posted 28 October 2009 - 04:20 PM

frax

Hall of Fame

• 2,420 posts
• Gender:Male
• Location:Stockholm, Sweden
• Interests:music, hiking, friends, nature, photography, traveling. and maps!
• Sweden

Hi, thanks for the tips. Tim - is not a super small area, it is a region (Baltic Sea region), but I think I can choose a projection carefully and approximate with the planar x/y average. This is not for scientific stuff anyways.
Hugo Ahlenius
Nordpil - custom maps and GIS
http://nordpil.com/