The `pydantic_extra_types.coordinate` module provides the [`Latitude`](/guides/pydantic-extra-types-pydantic-extra-types-coordinate#latitude), [`Longitude`](/guides/pydantic-extra-types-pydantic-extra-types-coordinate#longitude), and [`Coordinate`](/guides/pydantic-extra-types-pydantic-extra-types-coordinate#coordinate) data types.

## Latitude

**Bases:** [`float`](https://docs.python.org/3/builtins/functions.html#float)

Latitude value should be between -90 and 90, inclusive.

Supports both float and Decimal types.

```py
from decimal import Decimal
from pydantic import BaseModel
from pydantic_extra_types.coordinate import Latitude

class Location(BaseModel):
    latitude: Latitude

# Using float
location1 = Location(latitude=41.40338)
# Using Decimal
location2 = Location(latitude=Decimal('41.40338'))
```

## Longitude

**Bases:** [`float`](https://docs.python.org/3/builtins/functions.html#float)

Longitude value should be between -180 and 180, inclusive.

Supports both float and Decimal types.

```py
from decimal import Decimal
from pydantic import BaseModel

from pydantic_extra_types.coordinate import Longitude

class Location(BaseModel):
    longitude: Longitude

# Using float
location1 = Location(longitude=2.17403)
# Using Decimal
location2 = Location(longitude=Decimal('2.17403'))
```

## Coordinate

**Bases:** `Representation`

Coordinate parses Latitude and Longitude.

You can use the `Coordinate` data type for storing coordinates. Coordinates can be defined using one of the following formats:

1. Tuple: `(Latitude, Longitude)`. For example: `(41.40338, 2.17403)` or `(Decimal('41.40338'), Decimal('2.17403'))`.
2. `Coordinate` instance: `Coordinate(latitude=Latitude, longitude=Longitude)`.

```py
from decimal import Decimal
from pydantic import BaseModel

from pydantic_extra_types.coordinate import Coordinate

class Location(BaseModel):
    coordinate: Coordinate

# Using float values
location1 = Location(coordinate=(41.40338, 2.17403))
# > coordinate=Coordinate(latitude=41.40338, longitude=2.17403)

# Using Decimal values
location2 = Location(coordinate=(Decimal('41.40338'), Decimal('2.17403')))
# > coordinate=Coordinate(latitude=41.40338, longitude=2.17403)
```

## Related pages

- [API Documentation](./api-documentation-index.md)
- [Concepts](./concepts-index.md)
- [Dev Tools](./dev-tools-index.md)
- [Error Messages](./error-messages-index.md)
- [Examples](./examples-index.md)
- [Integrations](./integrations-index.md)
- [Internals](./internals-index.md)
- [Production Tools](./production-tools-index.md)
- [Pydantic](./pydantic-index.md)
- [Pydantic Core](./pydantic-core-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
