---
title: on_map
description: Checks if a given location is on the map.
---

## Signature

```py
def on_map(location: Location) -> bool 
```

## Description

Returns `True` if the given `location` is within the valid bounds of the world grid, otherwise returns `False`.  
A location is considered on the map if both its x and y coordinates are greater than or equal to 0, and strictly
less than the world's width and height, respectively.

## Example

```py
# world has height and width set to 3 for this example.
 
# Invalid Location
is_on_map = on_map(create_location(3,3))
print(is_on_map)
# Output: False
 
# Valid Location
is_on_map = on_map(create_location(1, 2))
print(is_on_map)
# Output: True
```

