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"];

Thanks for your help in advance.

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?

  • 4
    $\begingroup$ You are aware that the coastline length is generally not a well-defined quantity, right? :) $\endgroup$
    – Domen
    Dec 18, 2023 at 9:21
  • $\begingroup$ This might be interesting for you Measuring Fractal Dimensions of Coastlines $\endgroup$
    – eldo
    Dec 18, 2023 at 9:32
  • 1
    $\begingroup$ @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. $\endgroup$ Dec 18, 2023 at 9:32
  • $\begingroup$ I'd suggest GeoLength[GeoBoundary[Entity["GeographicRegion", "Africa"]["Polygon"]]] . $\endgroup$
    – jose
    Dec 18, 2023 at 9:34
  • $\begingroup$ Thanks @jose. I did try Entity["GeographicRegion", "Africa"]["BoundaryLength"] but this information does not seem to be available. $\endgroup$
    – Syed
    Dec 18, 2023 at 9:47

1 Answer 1


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

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

polygon for Africa GeoGraphicRegion

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}]

geographic region

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

30 048. mi

Compare this value to the length of all 465 regions.

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}]



Your Answer

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

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