给出一个在地球表面均匀分布的伪随机地理位置.
RandomGeoPosition[{{latmin,lonmin},{latmax,lonmax}}]
给出一个在给定地理边界框内均匀分布的伪随机地理位置.
给出一个在地理区域 g 内均匀分布的伪随机地理位置.
RandomGeoPosition[g,n]
给出 n 个在地理区域 g 内均匀分布的伪随机地理位置.
RandomGeoPosition[g,{n1,n2,…}]
给出一个 n1× n2×… 伪随机地理数组.
RandomGeoPosition
给出一个在地球表面均匀分布的伪随机地理位置.
RandomGeoPosition[{{latmin,lonmin},{latmax,lonmax}}]
给出一个在给定地理边界框内均匀分布的伪随机地理位置.
给出一个在地理区域 g 内均匀分布的伪随机地理位置.
RandomGeoPosition[g,n]
给出 n 个在地理区域 g 内均匀分布的伪随机地理位置.
RandomGeoPosition[g,{n1,n2,…}]
给出一个 n1× n2×… 伪随机地理数组.
更多信息和选项
- 可用地理基元(如 GeoDisk[…] 或 GeoBoundsRegion[…])或扩展地理 Entity 对象给出 RandomPosition[g,…] 中的地理区域 g.
- RandomGeoPosition 的可能选项包括:
-
GeoModel Automatic 生成的地理位置的模型 GeoProjection None 位置均匀分布的投影 - RandomGeoPosition[] 等价于 RandomGeoPosition["World"] 和 RandomGeoPosition[{{-90,-180},{90,180}}].
- 每次运行 Wolfram 语言时,RandomGeoPosition 都会给出不同的伪随机地理位置序列. 可通过 SeedRandom 从特定种子开始运行.
范例
打开所有单元 关闭所有单元基本范例 (4)
RandomGeoPosition[]RandomGeoPosition[{{0, 90}, {90, 180}}]RandomGeoPosition[GeoModel -> Entity["Planet", "Mars"]]pts = RandomGeoPosition[Entity["Country", "UnitedStates"], 1000]GeoGraphics[Point[pts]]pts = RandomGeoPosition["World", 10000, GeoProjection -> "Mercator"]GeoGraphics[Point[pts], GeoProjection -> "Mercator", GeoRange -> "World"]它们在等面积投影(如 Mollweide 投影)中则不是均匀分布的:
GeoGraphics[Point[pts], GeoProjection -> "Mollweide", GeoRange -> "World"]范围 (7)
RandomGeoPosition[]RandomGeoPosition[100]RandomGeoPosition[{{41, -5}, {51, 10}}]p = RandomGeoPosition[Entity["Country", "France"]]ps = RandomGeoPosition[Entity["Country", "France"], 500]GeoGraphics[{GeoMarker[p], Point[ps]}]ps = RandomGeoPosition[GeoVariant[Entity["Country", "UnitedStates"], "DefaultMapArea"], 1000]GeoGraphics[Point[ps]]ps = RandomGeoPosition[GeoVariant[Entity["Country", "UnitedStates"], "PrincipalArea"], 1000]GeoGraphics[Point[ps]]RandomGeoPosition[GeoDisk[Here, Quantity[100, "Miles"]], 1000]GeoGraphics[{Blue, Point[%], Red, GeoCircle[Here, Quantity[100, "Miles"]]}]RandomGeoPosition[Entity["Country", "UnitedStates"], {6, 10, 8}]选项 (2)
GeoModel (1)
默认情况下,RandomGeoPosition 使用 "ITRF00" 基准面在地球上生成位置:
RandomGeoPosition[1000]用 GeoModel 选项指定地球的其他模型或其他天体:
RandomGeoPosition[1000, GeoModel -> "Moon"]GeoGraphics[{Red, Point[%]}, GeoProjection -> "Orthographic"]GeoProjection (1)
ps = RandomGeoPosition["World", 2000, GeoProjection -> "Albers"]GeoGraphics[Point[ps], GeoProjection -> "Albers", GeoRange -> "World"]GeoGraphics[Point[ps], GeoProjection -> "Lagrange", GeoRange -> "World"]属性和关系 (5)
用 SeedRandom 获取可重复的随机值:
RandomGeoPosition[]RandomGeoPosition[]SeedRandom[1234];
RandomGeoPosition[]SeedRandom[1234];
RandomGeoPosition[]用 BlockRandom 阻止 RandomGeoPosition 的使用对其他调用的影响:
BlockRandom[RandomGeoPosition[]]RandomGeoPosition[]RandomGeoPosition[{{-40, -60}, {40, 60}}, 200]CentralFeature[%]SpatialMedian[%%]ps = Thread@RandomGeoPosition["World", 2000];inafrica = Pick[ps, GeoWithinQ[Entity["GeographicRegion", "Africa"], ps]];GeoGraphics[{Point[ps], Red, Point[inafrica]}, GeoRange -> "World"]Length[inafrica] / Length[ps]//NGeoArea[Entity["GeographicRegion", "Africa"]] / GeoArea["World"]ps = RandomGeoPosition["World", 1000]equalarea = GeoProjectionData["EqualArea"]GeoGraphics[Point[ps], GeoProjection -> #]& /@ RandomSample[equalarea, 5]conformal = GeoProjectionData["Conformal"]GeoGraphics[Point[ps], GeoProjection -> #]& /@ RandomSample[conformal, 5]可能存在的问题 (2)
GeoProjectionData["InfiniteMap"]那么 RandomGeoPosition 可能会返回投影到非常大区域内的点,如使用 "Airy" 投影的南极点:
RandomGeoPosition["World", GeoProjection -> "Airy"]在给定投影中取 1000 个均匀分布在世界各地的伪随机地理位置:
ps = RandomGeoPosition["World", 1000, GeoProjection -> "AmericanPolyconic"]如果选择相同的地理范围,这些地理位置在 GeoGraphics 地图中看起来是均匀的:
GeoGraphics[Point[ps], GeoProjection -> "AmericanPolyconic", GeoRange -> "World"]Options[%, {GeoCenter, GeoRange}]它们在其他地理范围内可能看起来不均匀,包括 GeoGraphics 中的默认选择:
GeoGraphics[Point[ps], GeoProjection -> "AmericanPolyconic"]Options[%, {GeoCenter, GeoRange}]文本
Wolfram Research (2019),RandomGeoPosition,Wolfram 语言函数,https://reference.wolfram.com/language/ref/RandomGeoPosition.html.
CMS
Wolfram 语言. 2019. "RandomGeoPosition." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/RandomGeoPosition.html.
APA
Wolfram 语言. (2019). RandomGeoPosition. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/RandomGeoPosition.html 年
BibTeX
@misc{reference.wolfram_2026_randomgeoposition, author="Wolfram Research", title="{RandomGeoPosition}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/RandomGeoPosition.html}", note=[Accessed: 03-December-2026]}
BibLaTeX
@online{reference.wolfram_2026_randomgeoposition, organization={Wolfram Research}, title={RandomGeoPosition}, year={2019}, url={https://reference.wolfram.com/language/ref/RandomGeoPosition.html}, note=[Accessed: 03-December-2026]}