Wolfram|Alpha readily accepts the following input:
China boundary length
It gladly reports that the boundary length of China is 22772 miles, and a host of other information that I’ll never need.
However - I’m trying to work out the boundary length of Hunan, a region of China. So I type:
Hunan boundary length
And Wolfram|Alpha reports that the standard computation time exceeded.
What I’m looking for is a simple piece of information, and if Alpha already knows the answer, it’ll give it to me. Otherwise it’s probably analysing Google Maps to manually work out the perimeter. So how would I go about working out the boundary length of Hunan?
This would be a great addition to Wolfram|Alpha’s dataset. You may want to consider suggesting it in Wolfram|Alpha’s feedback form at the bottom of the search results page.
If Wolfram|Alpha doesn’t give the solution, you may need to use Mathematica and write out some calculations. This is how I would do that.
(* Get a geographic polygon of Hunan Provence*)
poly = AdministrativeDivisionData[Entity["AdministrativeDivision", {"Hunan", "China"}], "Polygon"]
(*Break the points of the border polygon into pairs*)
Partition[#, 2, 1] &@poly[[1, 1, 1]]
(*Calculate the GeoDistance between the pairs*)
Apply[GeoDistance, #] & /@ Partition[#, 2, 1] &@poly[[1, 1, 1]]]
(*Add then all together with Total*)
Total[
Apply[GeoDistance, #] & /@ Partition[#, 2, 1] &@poly[[1, 1, 1]]
]
The result I get from this is that border is roughly 1909.72 Miles long.