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