gives a pseudorandom geo position uniformly distributed on the surface of the Earth.
RandomGeoPosition[{{latmin,lonmin},{latmax,lonmax}}]
gives a pseudorandom geo position uniformly distributed in the given geo bounding box.
gives a pseudorandom geo position uniformly distributed in the geo region g.
RandomGeoPosition[g,n]
gives a list of n pseudorandom geo positions uniformly distributed in the geo region g.
RandomGeoPosition[g,{n1,n2,…}]
gives an n1× n2×… pseudorandom geo position array.
RandomGeoPosition
gives a pseudorandom geo position uniformly distributed on the surface of the Earth.
RandomGeoPosition[{{latmin,lonmin},{latmax,lonmax}}]
gives a pseudorandom geo position uniformly distributed in the given geo bounding box.
gives a pseudorandom geo position uniformly distributed in the geo region g.
RandomGeoPosition[g,n]
gives a list of n pseudorandom geo positions uniformly distributed in the geo region g.
RandomGeoPosition[g,{n1,n2,…}]
gives an n1× n2×… pseudorandom geo position array.
Details and Options
- The geo region g in RandomPosition[g,…] can be given as a geo primitive like GeoDisk[…] or GeoBoundsRegion[…] or as an extended geo Entity object.
- Possible options for RandomGeoPosition include:
-
GeoModel Automatic model of the generated geo positions GeoProjection None projection in which locations are uniform - RandomGeoPosition[] is equivalent to RandomGeoPosition["World"] and RandomGeoPosition[{{-90,-180},{90,180}}].
- RandomGeoPosition gives a different sequence of pseudorandom geo positions whenever you run the Wolfram Language. You can start with a particular seed using SeedRandom.
Examples
open all close allBasic Examples (4)
Generate a pseudorandom geo position on the Earth:
RandomGeoPosition[]Restrict the generated geo position to a given bounding box:
RandomGeoPosition[{{0, 90}, {90, 180}}]Generate a pseudorandom point on Mars:
RandomGeoPosition[GeoModel -> Entity["Planet", "Mars"]]Generate a list of pseudorandom geo positions in the US:
pts = RandomGeoPosition[Entity["Country", "UnitedStates"], 1000]GeoGraphics[Point[pts]]Generate geo locations uniformly distributed in the Mercator projection:
pts = RandomGeoPosition["World", 10000, GeoProjection -> "Mercator"]GeoGraphics[Point[pts], GeoProjection -> "Mercator", GeoRange -> "World"]They are not uniformly distributed in an equal-area projection like Mollweide:
GeoGraphics[Point[pts], GeoProjection -> "Mollweide", GeoRange -> "World"]Scope (7)
Generate a random geo position on the Earth:
RandomGeoPosition[]Generate 100 random geo positions uniformly distributed on the Earth:
RandomGeoPosition[100]Generate a random geo position in a given bounding box:
RandomGeoPosition[{{41, -5}, {51, 10}}]Generate random geo positions in France:
p = RandomGeoPosition[Entity["Country", "France"]]ps = RandomGeoPosition[Entity["Country", "France"], 500]GeoGraphics[{GeoMarker[p], Point[ps]}]Generate random geo positions in different geo variants of a country:
ps = RandomGeoPosition[GeoVariant[Entity["Country", "UnitedStates"], "DefaultMapArea"], 1000]GeoGraphics[Point[ps]]ps = RandomGeoPosition[GeoVariant[Entity["Country", "UnitedStates"], "PrincipalArea"], 1000]GeoGraphics[Point[ps]]Generate random geo positions in the interior of a geo primitive:
RandomGeoPosition[GeoDisk[Here, Quantity[100, "Miles"]], 1000]GeoGraphics[{Blue, Point[%], Red, GeoCircle[Here, Quantity[100, "Miles"]]}]Generate a random geo position array:
RandomGeoPosition[Entity["Country", "UnitedStates"], {6, 10, 8}]Options (2)
GeoModel (1)
By default, RandomGeoPosition generates locations on the Earth using the "ITRF00" datum:
RandomGeoPosition[1000]Use the GeoModel option to specify other models of the Earth or other celestial globes:
RandomGeoPosition[1000, GeoModel -> "Moon"]GeoGraphics[{Red, Point[%]}, GeoProjection -> "Orthographic"]GeoProjection (1)
Generate random geo positions uniformly distributed in the Albers projection:
ps = RandomGeoPosition["World", 2000, GeoProjection -> "Albers"]Check that they are homogeneously distributed in that projection:
GeoGraphics[Point[ps], GeoProjection -> "Albers", GeoRange -> "World"]They are not homogeneously distributed in other projections:
GeoGraphics[Point[ps], GeoProjection -> "Lagrange", GeoRange -> "World"]Properties & Relations (5)
Use SeedRandom to get repeatable random values:
RandomGeoPosition[]RandomGeoPosition[]SeedRandom[1234];
RandomGeoPosition[]SeedRandom[1234];
RandomGeoPosition[]Use BlockRandom to block one use of RandomGeoPosition from affecting others:
BlockRandom[RandomGeoPosition[]]RandomGeoPosition[]Take 200 geo locations uniformly distributed in a geo bounding box:
RandomGeoPosition[{{-40, -60}, {40, 60}}, 200]The central feature and spatial median locations are close to the center of that bounding box:
CentralFeature[%]SpatialMedian[%%]Take 2000 geo locations uniformly distributed on the surface of the Earth:
ps = Thread@RandomGeoPosition["World", 2000];Select those geo locations in Africa:
inafrica = Pick[ps, GeoWithinQ[Entity["GeographicRegion", "Africa"], ps]];GeoGraphics[{Point[ps], Red, Point[inafrica]}, GeoRange -> "World"]Compute the relative fraction and compare with the relative area of Africa with respect to the world:
Length[inafrica] / Length[ps]//NGeoArea[Entity["GeographicRegion", "Africa"]] / GeoArea["World"]Geo locations uniformly distributed in an area look uniform in equal-area projections:
ps = RandomGeoPosition["World", 1000]equalarea = GeoProjectionData["EqualArea"]GeoGraphics[Point[ps], GeoProjection -> #]& /@ RandomSample[equalarea, 5]They do not look uniform in other types of geo projections, like conformal projections:
conformal = GeoProjectionData["Conformal"]GeoGraphics[Point[ps], GeoProjection -> #]& /@ RandomSample[conformal, 5]Possible Issues (2)
For some geo projections, the world map is infinite:
GeoProjectionData["InfiniteMap"]Then RandomGeoPosition may return points in regions projected into very large areas, like the South pole for the "Airy" projection:
RandomGeoPosition["World", GeoProjection -> "Airy"]Take 1000 pseudorandom geo positions uniformly distributed over the world in a given projection:
ps = RandomGeoPosition["World", 1000, GeoProjection -> "AmericanPolyconic"]The geo positions look uniform in a GeoGraphics map if the same geo range is chosen:
GeoGraphics[Point[ps], GeoProjection -> "AmericanPolyconic", GeoRange -> "World"]Options[%, {GeoCenter, GeoRange}]They may not look uniform in other geo ranges, including the default choice in GeoGraphics:
GeoGraphics[Point[ps], GeoProjection -> "AmericanPolyconic"]Options[%, {GeoCenter, GeoRange}]Related Guides
History
Text
Wolfram Research (2019), RandomGeoPosition, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomGeoPosition.html.
CMS
Wolfram Language. 2019. "RandomGeoPosition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RandomGeoPosition.html.
APA
Wolfram Language. (2019). RandomGeoPosition. Wolfram Language & System Documentation Center. Retrieved from 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: 13-June-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: 13-June-2026]}