推荐一个博物馆去参观
通过对旅游照片集元数据进行地理分析,推荐该地区内的其他旅游点,比如,一个博物馆.
In[1]:=
files = Map[img \[Function] ExampleData[img, "FilePath"],
ExampleData[{"TestImageSet", "Oxford2011"}]];
geopos = Map[file \[Function] Import[file, "GeoPosition"], files];
计算照片拍摄地点的位置重心.
In[2]:=
geodata =
GeoPosition[{Mean@geopos[[ All, 1, 1]], Mean@geopos[[All, 1, 2]],
Mean@Cases[geopos, GeoPosition[{_, _, h_}] :> h]}]
Out[2]=
找出最近的博物馆.
In[3]:=
entMus = Quiet[First@GeoNearest["Museum", geodata]];
In[4]:=
geoMus = Quiet[FindGeoLocation@entMus];
获取关于这个博物馆的信息并排版显示.
In[5]:=
mus = EntityValue[entMus, EntityProperty["Museum", "Name"]];
type = EntityValue[entMus,
EntityProperty["Museum", "MuseumTypes"]]; about =
WikipediaData[mus, "SummaryPlaintext"];
description = TextGrid[{
{Style["MUSEUM TO VISIT", 15], SpanFromLeft},
{Style["Name:", Bold], mus},
{Style["Types:", Bold],
StringTake[ToString[type], {2, -2}]}, {Style["About:", Bold],
about}
}, ItemSize -> {{4, 30}, Automatic}]
Out[5]=
在博物馆周围的地图上,以提示框的形式可视化该博物馆的信息.
In[6]:=
tooltip =
Tooltip[GeoMarker[geoMus, Entity["Icon", "Museum"]], description];
In[7]:=
GeoGraphics[{Thick, Red, GeoDisk[geodata, Quantity[1000, "Meters"]],
tooltip}, "GeoRange" -> 1500, ImageSize -> Medium]
Out[7]=