# Find the Most Interior Point in the United States

Get a list of {latitude, longitude} coordinates along the border of the United States.

 In:= Xpolygon = Entity["Country", "UnitedStates"]["Polygon"]; coordinates = polygon[[1, 1, 1]];

Compute the distances in miles between consecutive points and accumulate them.

 In:= Xdistances = MapThread[GeoDistance, {coordinates, RotateLeft[coordinates]}]; accumulateddistances = Accumulate[QuantityMagnitude[distances]];
 In:= XListPlot[accumulateddistances]
 Out= This is the total estimated length of the boundary in miles.

 In:= Xfirst = First[accumulateddistances]; last = Last[accumulateddistances]
 Out= Construct a parametrization of the boundary.

 In:= Xf = Interpolation[Transpose[{accumulateddistances, coordinates}], InterpolationOrder -> 0]
 Out= Draw 300 geo disks with 650-mile radius along equidistant points of the boundary. The small space left uncovered is the area of the US farther than 650 miles from the boundary.

 In:= XGeoGraphics[{GeoStyling[Opacity[0.03], Purple, EdgeForm[ Directive[Thin, Darker[Purple]]]], (GeoDisk[#1, Quantity[650, "Miles"]] &) /@ f[Range[first, last, last/300]], GeoStyling[EdgeForm[Yellow], Opacity], polygon}, GeoRange -> GeoBounds[polygon], GeoBackground -> None, ImageSize -> Large]
 Out= Using the interactive coordinate tools, select a point inside that region.

 In:= Xpoint = GeoPosition[{39.2, -98.2}];

Find the 30 nearest cities to that point.

 In:= Xcities = GeoNearest["City", point, 30]
 Out= Compute the distances from those cities to the point.

 In:= XGeoDistance[cities, point]
 Out= Compute the distance from those cities to the closest point of the US boundary. The distances are negative numbers because we are inside the boundary. Verify that Barnard is in fact the city furthest away from the boundary.

 In:= XGeoDistance[cities, Polygon@GeoPosition@polygon[[1, 1, 1]], DistanceFunction -> "SignedBoundary"]
 Out= The cities are all in Kansas. Repeat the map, plotting the cities and the state of Kansas as well.

 In:= XGeoGraphics[{GeoStyling[Opacity[0.03], Purple, EdgeForm[ Directive[Thin, Darker[Purple]]]], (GeoDisk[#1, Quantity[650, "Miles"]] &) /@ f[Range[first, last, last/300]], GeoStyling[EdgeForm[Yellow], Opacity], polygon, Polygon[Entity[ "AdministrativeDivision", {"Kansas", "UnitedStates"}]], Blue, PointSize[Small], Point[cities], Red, Point[cities[]]}, GeoRange -> GeoBounds[polygon], GeoBackground -> None, ImageSize -> Large]
 Out= ## Mathematica

Questions? Comments? Contact a Wolfram expert »