Wolfram 언어

Knowledgebase의 확장

유명 건물의 도보 견학 루트 생성

GeoNearest를 사용하여 보스턴 시청 반경 1km 주변 지역에 위치해 있는 유명한 건물을 검색할 수 있습니다.

In[1]:=
Click for copyable input
position = Entity["Building", "BostonCityHall::96t3t"]; radius = Quantity[1, "Kilometers"];
In[2]:=
Click for copyable input
nearMe = GeoNearest["Building", position, {All, radius}]
Out[2]=

임베디드 아이콘 엔티티를 사용하여 지역의 지도에 건물을 플롯합니다.

전체 Wolfram 언어 입력 표시하기
In[3]:=
Click for copyable input
iconItemPairs = With[{icon = EntityValue[Entity["Icon", "Museum"], "Image"][[1]]}, MapThread[{#1, Graphics[{EdgeForm[Black], FaceForm[#2], icon}, "ImageSize" -> 25]} &, {nearMe, RandomColor[Length@nearMe]}] ]; legend = Column[ Row[Reverse@#] & /@ (MapAt[CommonName, #, 1] & /@ iconItemPairs)]; Row[{ GeoGraphics[{EdgeForm[Darker[Orange]], Orange, GeoDisk[position, radius], GeoMarker[position, "Color" -> Red], GeoMarker @@@ iconItemPairs}, ImageSize -> 400], legend }]
Out[3]=

TravelDirections을 사용하여 이러한 엔티티의 도보 견학 루트를 계산합니다.

In[4]:=
Click for copyable input
tourPlaces = Prepend[nearMe, position];
In[5]:=
Click for copyable input
{distance, tourPath} = FindShortestTour[GeoPosition /@ tourPlaces, 1, Length@tourPlaces]
Out[5]=
In[6]:=
Click for copyable input
travelDirectionsForPath = TravelDirections[tourPlaces[[tourPath]], TravelMethod -> "Walking"]
Out[6]=
전체 Wolfram 언어 입력 표시하기
In[7]:=
Click for copyable input
Row[{ GeoGraphics[{ Thickness[0.01], Darker@Red, GeoPath@travelDirectionsForPath, EdgeForm[Darker[Orange]], Orange, GeoDisk[position, radius], GeoMarker[position, "Color" -> Red], GeoMarker @@@ iconItemPairs }, ImageSize -> 400], legend }]
Out[7]=

다음은 경로에 대한 자세한 단계별 안내입니다.

In[8]:=
Click for copyable input
travelDirectionsForPath["ManeuverGrid"]
Out[8]=

관련 예제

de en es fr ja pt-br ru zh