GeoNearest

GeoNearest[enttype,loc]
returns the geographic entity of type enttype closest to the geo location loc.

GeoNearest[{reg1,reg2,,regn},loc]
returns the nearest of the .

GeoNearest[{reg1val1, reg2val2,,regnvaln},loc]
returns the corresponding to the nearest .

GeoNearest[{reg1,reg2,,regn}{val1,val2,,valn},loc]
returns the same result.

GeoNearest[{reg1,reg2,,regn}Automatic,loc]
takes the to be successive integers i.

GeoNearest[spec,loc,n]
returns n nearest values.

GeoNearest[spec,loc,{n,r}]
returns up to n matches within a radius r of loc.

Details and OptionsDetails and Options

  • In GeoNearest[enttype,loc], enttype can be specified as an Entity object, such as Entity["Country"], or as a string, such as .
  • 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
    "Airport"airports
    "Bridge"bridges
    "Building"buildings
    "City"city
    "Country"country, territory, etc.
    "Mountain"mountains
    "Ocean"oceans
    "USCounty"US counties
    "USState"US states
    "Volcano"volcanoes
    "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
    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 .
  • 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.
  • 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

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Find your current or nearest country:

In[1]:=
Click for copyable input
Out[1]=

The country closest to the center of the Atlantic Ocean:

In[2]:=
Click for copyable input
Out[2]=

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

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2014
(10.0)