GeoWithinQ

GeoWithinQ[reg,loc]

returns True if the location loc is contained within the region reg, and False otherwise.

GeoWithinQ[reg]

represents an operator form of GeoWithinQ that can be applied to a location.

Details and Options

  • In GeoWithinQ[reg,loc], reg can be specified as either an Entity object or an extended GeoGraphics primitive. The location loc can additionally be specified as a GeoPosition or related point-like location object.
  • GeoWithinQ accepts lists in both arguments, effectively calling Outer on the input lists.
  • With the option setting "FullyContained"->True, GeoWithinQ[reg,loc] will return True only if loc is completely contained in reg.
  • GeoWithinQ[reg][loc] is equivalent to GeoWithinQ[reg,loc].

Examples

open allclose all

Basic Examples  (2)

New York City is in the United States:

But it is not in the state of Florida:

Determine if your current location is Champaign, Illinois:

Scope  (5)

Test whether France is included in the following polygon:

Visualize France and the polygon:

Test whether several airports are inside the city of Chicago:

Test whether a particular location is inside several different regions:

Test several cities for membership in several regions simultaneously:

Each row is the result for all locations with respect to a single region:

Use GeoWithinQ as an operator form:

Options  (1)

"FullyContained"  (1)

The United Kingdom is considered to be inside London, since the two entities overlap:

The option "FullyContained"->True excludes regions that extend outside the entity:

London is always considered to be inside the United Kingdom:

Applications  (1)

Determine which of several points are in a group of central states of the United States:

Properties & Relations  (2)

GeoWithinQ[list1,list2] is essentially equivalent to Outer[GeoWithinQ,list1,list2]:

GeoWithinQ could be implemented using a combination of GeoNearest and MemberQ:

GeoNearest allows radii to be specified:

This point is just off the coast of Malibu, California:

Introduced in 2014
 (10.0)
 |
Updated in 2017
 (11.1)