# Mean coordinate issue with multipart polygons

I've been using Mean Coordinates in QGIS to find weighted mean centers based on different attributes for the counties in a singular state of the US. However I have come across a problem in which the calculation is affected by the number of polygons within a shape.

For example in the attached image I have been trying to simply find the geographical mean center of the state of Maine (no weights). The center should be further north but because the islands towards the south act as attraction factors the star, which is the result, finds its way towards the south.

Is there anyway to fix/work-around this issue? Do I just have to delete all islands?

• Have you considered computing county centroids and use those in your weighted average computation? Commented Jul 27, 2015 at 21:39
• That is eventually what I had to end up doing. The results make more sense now and save time from removing all the Island parts. Thanks! Commented Jul 28, 2015 at 13:38

Looking at that image, my question would be - are you sure it's the islands? It could be the coastline.

Fixes:

• Islands - if you think it's the islands, then just exclude them. I'd suggest simply calculating the areas of the features and removing any that are island sized. There appears to be a clear size difference in your features so you won't end up with false positives at least.

• Coastline - This is another large component of the problem I suspect. Your coastline is super detailed, whereas your other boundaries being man-made are not. Assuming you don't want this level of detail, I'd suggest running the data through a generaliser. This will reduce the number of points in too-detailed areas and hopefully improve your result. Simplify Geometries might be the way to go in the QGIS toolbox, or v.generalize using doublas as the algorithm.

• How would coastline effect a mean coordinate calculation? I would prefer not to simplify the shapes for other calculations I have to do from this. Commented Jul 27, 2015 at 18:05
• Most likely because each island has a centre point that's included in the calculations so the average of all those islands pulls the centre away from the 'geographical' centre of the state Commented Jul 27, 2015 at 18:11
• I can not delete the islands easily because each island is part of the feature which is the entire county. Is there a way to select parts of a feature by size? Commented Jul 27, 2015 at 18:28
• @AhmadKhan - coastline may affect it because as I said, it's probably super detailed compared to the inland bits. Take a look at your data while you have editing mode turned on. You'll probably see lots more vertices on the coastline than there are on the rest of the data. That may be influencing the calculation. Commented Jul 28, 2015 at 7:27
• Thanks for your help. In the end I just took out the centroids of each county and worked with those. Commented Jul 28, 2015 at 13:39

Rather than deleting the islands you could run the Singlepart to Multiparts tool (Vector > Geometry Tools) on your state layer using the counties as the unique ID field.

The output will then be a record for each county, if you then re-run the Mean coordinate it should then be more central as there are far fewer counties than islands.

For reference The ESRI help describes a multipart feature as:

Multipart features are composed of more than one physical part that only references one set of attributes. For example, the individual islands that make up Hawaii are often represented as a multipart polygon feature. You can create, edit, and work with multipart features using editing tools as well as geoprocessing tools.

• This does not seem to work however. When I choose the county name as unique ID field it says that "At least two features must have same attribute value. Please choose another field" Commented Jul 27, 2015 at 18:02
• Ahh, that suggests that the islands are already multipart features. Does your attribute table have more records than counties, if not then this is probably the case. Commented Jul 27, 2015 at 18:09
• I have added a picture of my attribute table to the main post. Each each has multiple parts already, Yes. But the calculation is steering it with a bias towards individual parts. As another reply mentions that maybe each Island has a center. Commented Jul 27, 2015 at 18:25