is a settable global variable that specifies the default geodetic location to use.
$GeoLocation
is a settable global variable that specifies the default geodetic location to use.
Details
- $GeoLocation is a GeoPosition object containing {latitude,longitude} or {latitude,longitude,elevation}.
- By default, $GeoLocation has a delayed value of FindGeoLocation[], which gives the inferred geo location of the user originating the current request.
- $GeoLocationSource gives the source for the inferred geo location. If $GeoLocation is reset, $GeoLocationSource is set to "User".
Examples
open all close allBasic Examples (3)
Find your current geodetic location:
$GeoLocationDraw geographic maps and primitives containing your geo location:
GeoGraphics[Arrow@GeoPath[{$GeoLocation, Entity["City", {"Paris", "IleDeFrance", "France"}]}], GeoBackground -> "ReliefMap"]Compute distances and azimuths from your geo location:
GeoDistance[$GeoLocation, Entity["City", {"Berlin", "Berlin", "Germany"}]]GeoDirection[$GeoLocation, Entity["City", {"Berlin", "Berlin", "Germany"}]]Scope (5)
The default value of $GeoLocation is given by FindGeoLocation:
$GeoLocationFindGeoLocation[]It is computed using the "GeoIP" source:
$GeoLocationSourceSet a new value for your default geo location:
$GeoLocation = GeoPosition[{40., 30.}]$GeoLocation$GeoLocationSourceReset the value to its default:
$GeoLocation = FindGeoLocation[]$GeoLocationSourceSet $GeoLocation using a {lat,lon} pair in degrees:
$GeoLocation = {40., -30.}The value assigned to $GeoLocation is a GeoPosition object:
$GeoLocationReset the value to its default:
$GeoLocation = FindGeoLocation[]Set $GeoLocation using a {lat,lon,height} triple, with geodetic height in meters:
$GeoLocation = {40, -90, 150}The value assigned to $GeoLocation is a GeoPosition object:
$GeoLocationReset the value to its default:
$GeoLocation = FindGeoLocation[]Use Block to temporarily simulate that you are located at a different position:
GeoElevationData[]Block[{$GeoLocation = GeoPosition[{0, 0}]},
GeoElevationData[]
]Outside the Block scoping construct, the variable $GeoLocation still preserves its original value:
GeoElevationData[]Properties & Relations (4)
The values of $GeoLocation and Here coincide:
$GeoLocationHereGeoGraphics with no positional information centers the world map at $GeoLocation:
$GeoLocationGeoGraphics[Frame -> True]Set your default geo location to a different value:
$GeoLocation = GeoPosition[Entity["City", {"Tokyo", "Tokyo", "Japan"}]]GeoGraphics[Frame -> True]Reset $GeoLocation:
$GeoLocation = FindGeoLocation[]Changing $GeoLocation updates $GeoLocationCity and $GeoLocationCountry automatically:
$GeoLocation = GeoPosition[{52, 0}]{$GeoLocationCity, $GeoLocationCountry}Reset to the current location:
$GeoLocation = FindGeoLocation[]{$GeoLocationCity, $GeoLocationCountry}Convert $GeoLocation into other geo position formats. A 3D vector from the center of the Earth:
GeoPositionXYZ[$GeoLocation]A coordinate specification in any cartographic projection:
GeoGridPosition[$GeoLocation, "Bonne"]A 3D vector from some other geo location:
GeoPositionENU[$GeoLocation, Entity["City", {"Chicago", "Illinois", "UnitedStates"}]]Possible Issues (2)
Changing $GeoLocation does not automatically affect $TimeZone, which is independently settable:
{$GeoLocation, $TimeZone}$GeoLocation = GeoPosition[Entity["City", {"London", "GreaterLondon", "UnitedKingdom"}]]$TimeZone still gives your current time zone, and not London's time zone:
{$GeoLocation, $TimeZone}Use LocalTimeZone to find the time zone for a given location—in this case, the new $GeoLocation:
$TimeZone = LocalTimeZone[$GeoLocation, "NumericOffset"]{$GeoLocation, $TimeZone}Reset $GeoLocation and $TimeZone to your local values:
$GeoLocation = FindGeoLocation[]$TimeZone = LocalTimeZone[$GeoLocation, "NumericOffset"]$GeoLocation can store a GeoPosition value with elevation, but not with a date:
$GeoLocation = GeoPosition[{40, -90, 150, Now}]Tech Notes
Text
Wolfram Research (2008), $GeoLocation, Wolfram Language function, https://reference.wolfram.com/language/ref/$GeoLocation.html (updated 2014).
CMS
Wolfram Language. 2008. "$GeoLocation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/$GeoLocation.html.
APA
Wolfram Language. (2008). $GeoLocation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$GeoLocation.html
BibTeX
@misc{reference.wolfram_2026_$geolocation, author="Wolfram Research", title="{$GeoLocation}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/$GeoLocation.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_$geolocation, organization={Wolfram Research}, title={$GeoLocation}, year={2014}, url={https://reference.wolfram.com/language/ref/$GeoLocation.html}, note=[Accessed: 12-June-2026]}