<!--
{
  "availability" : [
    "MapKit JS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/MapRect",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "cl/mapkit.MapRect"
  },
  "title" : "MapRect"
}
-->

# MapRect

A rectangular region, in map units, of a two-dimensional map projection.

```
class MapRect implements MapRectData
```

## Overview

Use a `mapkit.MapRect` to represent a rectangular region within a map projection. Map units are a value from `0` to `1` that represent an interpolated location within the height or width of the full map projection.

## Topics

### Creating a map rectangle

[`new MapRect(x, y, width, height)`](/documentation/MapKitJS/MapRect/MapRectConstructor)

Creates an object that represents a rectangular region of the map projection.

[`MapRectData`](/documentation/MapKitJS/MapRectData)

A plain object representation of a rectangular region, in map units, of a two-dimensional map projection.

### Defining a map rectangle

[`origin`](/documentation/MapKitJS/MapRect/origin)

The origin point of a rectangle.

[`size`](/documentation/MapKitJS/MapRect/size)

The width and height of a rectangle, starting from the origin point.

### Obtaining rectangle metrics

[`maxX()`](/documentation/MapKitJS/MapRect/maxX)

Returns the maximum x-axis value of a rectangle.

[`maxY()`](/documentation/MapKitJS/MapRect/maxY)

Returns the maximum y-axis value of a rectangle.

[`midX()`](/documentation/MapKitJS/MapRect/midX)

Returns the midpoint along the x-axis of a rectangle.

[`midY()`](/documentation/MapKitJS/MapRect/midY)

Returns the midpoint along the y-axis of a rectangle.

[`minX()`](/documentation/MapKitJS/MapRect/minX)

Returns the minimum x-axis value of a rectangle.

[`minY()`](/documentation/MapKitJS/MapRect/minY)

Returns the minimum y-axis value of a rectangle.

### Working with map rectangles

[`copy()`](/documentation/MapKitJS/MapRect/copy)

Returns a copy of a map rectangle.

[`equals(anotherRect)`](/documentation/MapKitJS/MapRect/equals)

Compares whether two map rectangles are equal.

[`scale(scaleFactor, scaleCenter)`](/documentation/MapKitJS/MapRect/scale)

Returns a scaled map rectangle for a map location.

[`toCoordinateRegion()`](/documentation/MapKitJS/MapRect/toCoordinateRegion)

Returns the region that corresponds to a map rectangle.

## Relationships

### Conforms To

[`MapRectData`](/documentation/MapKitJS/MapRectData)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)