$GeoLocationCity
给出 $GeoLocation 当前设置的城市实体.
范例
打开所有单元 关闭所有单元基本范例 (1)
应用 (2)
属性和关系 (3)
$GeoLocationCity 给出距离当前的 $GeoLocation 最近的城市:
$GeoLocation$GeoLocationCity$GeoLocationCountry 给出距离当前的 $GeoLocation 最近的国家:
$GeoLocationCountry$GeoLocationCity 执行一个 GeoNearest 调用找到离当前位置最近的城市:
GeoNearest["City", GeoPosition[{50, 60}]]临时阻挡 $GeoLocation 值以模拟你位于那个位置:
Block[{$GeoLocation = GeoPosition[{50, 60}]},
$GeoLocationCity
]$GeoLocationCity 是自动设置的,即使 $GeoLocation 位于海上:
$GeoLocation = GeoPosition[{0, 0}]$GeoLocationCityGeoGraphics[{GeoMarker[], Arrow@GeoPath[{$GeoLocation, $GeoLocationCity}]}, GeoRange -> Quantity[300, "Miles"]]重置当前的 $GeoLocation:
$GeoLocation = FindGeoLocation[]可能存在的问题 (1)
$GeoLocationCity 的设置不能独立于 $GeoLocation:
$GeoLocationCity = Entity["City", {"NewYork", "NewYork", "UnitedStates"}]相反,请将 $GeoLocation 设置为包含在该城市中的位置:
$GeoLocation = GeoPosition[Entity["City", {"NewYork", "NewYork", "UnitedStates"}]]然后,$GeoLocationCity 将被自动设置:
$GeoLocationCity恢复你当前的 $GeoLocation:
$GeoLocation = FindGeoLocation[]技术笔记
相关链接
文本
Wolfram Research (2014),$GeoLocationCity,Wolfram 语言函数,https://reference.wolfram.com/language/ref/$GeoLocationCity.html.
CMS
Wolfram 语言. 2014. "$GeoLocationCity." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/$GeoLocationCity.html.
APA
Wolfram 语言. (2014). $GeoLocationCity. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/$GeoLocationCity.html 年
BibTeX
@misc{reference.wolfram_2026_$geolocationcity, author="Wolfram Research", title="{$GeoLocationCity}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/$GeoLocationCity.html}", note=[Accessed: 24-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_$geolocationcity, organization={Wolfram Research}, title={$GeoLocationCity}, year={2014}, url={https://reference.wolfram.com/language/ref/$GeoLocationCity.html}, note=[Accessed: 24-August-2026]}