returns the geographic entity of type enttype closest to the geo location loc.


returns the nearest of the regi.


returns the vali corresponding to the nearest regi.


returns the same result.


takes the vali to be successive integers i.


returns n nearest values.


returns up to n matches within a radius r of loc.

Details and Options

  • In GeoNearest[enttype,loc], enttype can be specified as an Entity object, such as Entity["Country"], or as a string, such as "City".
  • Valid forms of enttype include:
  • "AdministrativeDivision"administrative division of any level
    "AdministrativeDivision1"first-level administrative division
    "AdministrativeDivision2"second-level administrative division
    "AdministrativeDivision3"third-level administrative division
    "Country"country, territory, etc.
    "USCounty"US counties
    "USState"US states
    "ZIPCode"US ZIP codes
    Except[ent,enttype]entities other than ent of type enttype
    GeoVariant[enttype,variant]entities using variant regions
    EntityClass["type","class"]individual members of class
    type1|type2|any of the typei
    Allany possible type
  • Geographic regions and the locations can be specified as a GeoPosition or related point-like location object, an Entity or EntityClass object, or a GeoGraphics primitive.
  • A radius should be given as a Quantity object or the number 0.
  • GeoNearest[spec,loc,{All,r}] returns all results within radius r of loc.
  • GeoNearest always returns a list. If there are multiple nearest matches, GeoNearest[spec,loc] will return all of them.
  • GeoNearest[spec,loc,{n,r}] may return an empty list if there are no matches within the specified radius.
  • The following options can be given:
  • DistanceFunction"Boundary"how to compute distances for extended regions
    TimeConstraint30how many seconds to allow for computation
  • The following possible settings can be given for DistanceFunction:
  • "Boundary"minimum distance between any points in regions
    "Center"distance between centers of regions
    "SignedBoundary"distance to boundary, negative for interior points


open allclose all

Basic Examples  (3)

Find your current or nearest country:

The country closest to the center of the Atlantic Ocean:

The five counties nearest to Chicago, Illinois, United States:

All volcanoes within a radius of 1000 miles from London:

Scope  (13)

Entity Types  (6)

The three countries closest to Australia:

Give countries whose closest point to Germany is closer than 100 kilometers:

Find entities that cover a particular point:

Return famous buildings within one of those extended regions:

The mountain or volcano closest to your location:

The US state other than California closest to San Francisco:

The country whose center is closest to Paris:

With the default variant "PrincipalArea", Paris is at zero distance from France:

Groups of Entities and Regions  (7)

The border of the continental United States to which the city of Saint Louis, Missouri, is closest:

Return the value corresponding to the border entity closest to Denver, Colorado:

An equivalent syntax:

The closest of several points to your current location:

The position in a list of the point closest to Chicago:

Using explicit labels:

Give the European country closest to Tel Aviv, Israel:

Determine whether Germany is closest to a member of OPEC, the Baltics, or the British Commonwealth:

Determine to which of the following city pairs Greece is closest:

Options  (1)

DistanceFunction  (1)

By default, distances are measured from the boundaries of extended regions:

With DistanceFunction->"Center", distance from the center of the entity is used:

Applications  (1)

Find the countries that fall at least in part within a given latitude/longitude region:

Plot them, together with the latitude/longitude region:

Properties & Relations  (2)

GeoIdentify is a specialized form of GeoNearest:

GeoNearest includes all entities, if any, at zero distance from an extended region:

GeoEntities only includes entities that overlap the region:

Neat Examples  (1)

Construct a function to find the shortest route from a given position to the nearest foreign country:

Compute the shortest path out of the country in which you are:

Make a map showing the shortest path:

Wolfram Research (2014), GeoNearest, Wolfram Language function,


Wolfram Research (2014), GeoNearest, Wolfram Language function,


@misc{reference.wolfram_2020_geonearest, author="Wolfram Research", title="{GeoNearest}", year="2014", howpublished="\url{}", note=[Accessed: 18-January-2021 ]}


@online{reference.wolfram_2020_geonearest, organization={Wolfram Research}, title={GeoNearest}, year={2014}, url={}, note=[Accessed: 18-January-2021 ]}


Wolfram Language. 2014. "GeoNearest." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2014). GeoNearest. Wolfram Language & System Documentation Center. Retrieved from