Contents

equals(anotherRegion)

Returns a Boolean value indicating whether two regions are equal.

Declaration

equals(anotherRegion: CoordinateRegion): boolean;

Parameters

  • anotherRegion:

    The region to compare.

Return Value

true if the region that anotherRegion specifies is equal to the calling CoordinateRegion; otherwise, false.

Discussion

The following example shows how to determine whether a given region is equal to the region that’s displaying on the map.

// Create a map.
const map = new mapkit.Map("my-map-element-id");

// Create a region named myRegion.
const coordinate = new mapkit.Coordinate(37.415, -122.048333); // latitude, longitude
const span = new mapkit.CoordinateSpan(.016, .016); // latitude delta, longitude delta
const myRegion = new mapkit.CoordinateRegion(coordinate, span);

// Check whether myRegion is equal to the current map region.
if (myRegion.equals(map.region))
   console.log("These two regions are equal.");

See Also

Comparing, copying, and converting regions