해안선에 도달하는 가장 빠른 방법
미국 본토의 각 주도에서 미국의 국경 지점까지의 최단 경로를 구합니다.
수도의 목록을 가져옵니다.
In[1]:=
![Click for copyable input](assets.ko/the-fastest-way-to-the-coast/In_88.png)
capitals =
EntityValue[
EntityClass["AdministrativeDivision", "ContinentalUSStates"],
"CapitalCity"]
Out[1]=
![](assets.ko/the-fastest-way-to-the-coast/O_71.png)
미국의 다각형을 구합니다.
In[2]:=
![Click for copyable input](assets.ko/the-fastest-way-to-the-coast/In_89.png)
us = EntityValue[Entity["Country", "UnitedStates"], "Polygon"]
Out[2]=
![](assets.ko/the-fastest-way-to-the-coast/O_72.png)
각각의 수도로부터 다각형에서 가장 가까운 점을 계산합니다.
In[3]:=
![Click for copyable input](assets.ko/the-fastest-way-to-the-coast/In_90.png)
borderpoints = Flatten[Nearest[First[us], GeoPosition[capitals]]]
Out[3]=
![](assets.ko/the-fastest-way-to-the-coast/O_73.png)
모든 측지 경로를 그립니다.
In[4]:=
![Click for copyable input](assets.ko/the-fastest-way-to-the-coast/In_91.png)
GeoGraphics[{us, Point[capitals], Red, Arrowheads[0.015],
Arrow /@ GeoPath /@ Thread[{capitals, borderpoints}]}]
Out[4]=
![](assets.ko/the-fastest-way-to-the-coast/O_74.png)