When reprojecting country-border polygons from longlat:

+proj=longlat +datum=WGS84 +no_defs

to Azimuthal Equidistant:

+proj=aeqd +lat_0=26 +lon_0=126 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs

I occasionally find a polygon that is turned inside out. The settings above show an example of this. The first image shows the polygon for Argentina plotted 'as-is', and the second image shows the same data that has had long lines densified and then re-projected. The scale is adjusted for clarity. The 3rd image shows All Countries, and their polygons would be filled correctly except that the inside-out polygon for Argentina floods them all. How can I determine when a polygon will display 'inside out', and how can I then make it display correctly? I am using DotSpatial to do the re-projection, but other methods produce the same results. A grid has been overlaid for clarity.

enter image description here

enter image description here

enter image description here


Yes, that all makes perfect sense. Therefore, I guess I could check to see if it is going to happen by checking if the antipode is within any polygon, though that might be rather slow. But the question still remains: how can I automatically re-order the points so I can fill the polygon along the edge, or do something else to make my map look good?

Out of interest, I tried the same projection in QGIS with a Natural Earth shapefile of countries, and they have the same issue..

AzEq projection in QGIS

  • Densifying the vertices of the polygons is essential. To fill the out polygon I updated my answer with a little trick. – Gabriel De Luca Nov 8 '19 at 11:10

The projection makes sense to me. If you look at the points that form the polygon, where they are located, there is no way to form a closed polygon that does not surround the map between them.

I would believe that the only way that does not happen is that the antipodal point at the origin of the projection plane is within an ocean, or rather outside any other polygon.

We can think of it as follows: If the antipodal point at the origin of the projection is within a polygon, the shortest distances to some points of that polygon are going to be in totally opposite directions.

UPDATE: To fill the polygon you need to draw a circle, in the equidistant map, with the maximum possible distance, and make the circle and the polygon to be parts of the same feature. That circle represents the antipodal point in a spherical Earth, and you can think it as an artificial infinetismal lagoon in the antipodal country.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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