Length of a continental perimeter

Excluding the islands, how can the length of the perimeter of a continent be calculated?

To make the question more concrete, what is the length of perimeter of the African continent, excluding the island of Madagascar?

My initial attempt is as follows:

africaPolygon = Entity["GeographicRegion", "Africa"]["Polygon"];
Perimeter[africaPolygon]


I am aware of the paradox pointed to by @Domen (Thanks). Let's say a ship travels close to the shore or an imaginary path on the land around the continental boundary, then how can the length of the perimeter be calculated?

• You are aware that the coastline length is generally not a well-defined quantity, right? :) Dec 18, 2023 at 9:21
• This might be interesting for you Measuring Fractal Dimensions of Coastlines
– eldo
Dec 18, 2023 at 9:32
• @Domen: From theoretical point of view of mathematician it might not have a well defined length but from practical point of view it surely has a well defined length (of required precision) because you can always chose your smallest unit that you will use to measure something. Dec 18, 2023 at 9:32
• I'd suggest GeoLength[GeoBoundary[Entity["GeographicRegion", "Africa"]["Polygon"]]] .
– jose
Dec 18, 2023 at 9:34
• Thanks @jose. I did try Entity["GeographicRegion", "Africa"]["BoundaryLength"] but this information does not seem to be available.
– Syed
Dec 18, 2023 at 9:47

The polygon for the African continent has 465 lists of geographic regions.

africaPolygon = Entity["GeographicRegion", "Africa"]["Polygon"]


Usually, the first region is the largest, and we can select individual regions. For example, check the first region by drawing it with GeoGraphics.

geoRegion1 = Polygon[GeoPosition[africaPolygon[[1, 1, 1]]]];
GeoGraphics[{EdgeForm[Red], FaceForm[Red], geoRegion1}]


Using GeoBoundary (introduced in version 12.2) the length of the region is:

GeoLength[GeoBoundary[geoRegion1]]

30 048. mi


Compare this value to the length of all 465 regions.

GeoLength[GeoBoundary[africaPolygon]]

43 417.6 mi


Let's repeat the method for Madagascar, and find the coastline is 4,532.34 mi.

geoRegion2 = Polygon[GeoPosition[africaPolygon[[1, 1, 2]]]];
GeoGraphics[{EdgeForm[Red], FaceForm[Red], geoRegion2}]
GeoLength[GeoBoundary[geoRegion2]]