3

I am trying to get a centroid for several polygons on a global scale, in a way that it would correctly represent the common centre of all the polygons, taking Earth's curvature into account. The polygons are in the WGS 84 coordinate system.

For testing purposes, I created a test shapefile with two polygons: one that encompasses Greenland, and one that encompasses the area east of Mongolia up to the sea. These areas are quite a bit to the north, and their real common centroid is supposed to be somewhere close to the North Pole. Probably around the Laptev Sea, since Greenland is a bit smaller area-wise (although you couldn't tell that from the default projection QGIS is using to display WGS 84).

If I use the "Polygon centroids" built-in algorithm, the result is somewhere around St. Petersburg. That is way too south-west from where it's supposed to be.

First polygon centroid test

Another test created even more hilarious results. The two areas I selected that time were Alaska and the Kamchatka peninsula. The centroid should be at the very north of the Pacific ocean. But the result of "Polygon centroids" is actually in Nunavut, Canada, which is on the opposite side of where it should be. It's put there because Alaska is bigger than Kamchatka, otherwise it would be put somewhere in the Atlantic ocean.

Second polygon centroid test

One way of getting more correct centroids I could see is by changing the projection system, for instance, to an Azimutal Equidistant one, where the reference is somewhere close to the North Pole. However, if I do change the projection system, the polygons are still in WGS 84, and QGIS still outputs the same incorrect results if I do another pass of "Polygon centroids". And if I set the polygon layer's CRS to the projected system, the old coordinates are retained instead of being recalculated for the new projection.

This is how both test cases look like when projected, and shows clearly how incorrect the results are (the centre of the image is the North Pole):

Both tests, when viewed using a projected CRS

So perhaps there is a way to permanently reproject the polygons to the projected CRS? Or some other way of getting correct polygon centroids?

1
  • You can delete all the text and pictures and leave only last 2 lines of your question. Go 'layer' -> 'save as' and pick needed projection. Nov 23, 2013 at 21:31

1 Answer 1

2

Setting the CRS of the layer is the wrong approach. This demolishes your data, because it changes the projection, but not the coordinates. Your polygons will be placed in the wrong place afterwards.

Save As is the preferred method to change CRS and coordinates, but leave the polygons on the correct place on the Earth.

For the centroids, the aeqd projection is indeed a good choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.