# MercatorProjector

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-livecharts/geo/struct-mercatorprojector/

**struct** · [`ferroui-livecharts`](/docs/0.5.0/api/ferroui-livecharts/) · v0.5.0

```rust
struct MercatorProjector
```

Projects longitude and latitude with the Mercator projection. Lands outside the bounds are
extrapolated past the map area, which the chart clips.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L13)

## Members

- [`DEFAULT_MIN_LATITUDE`](#assoc_const-default_min_latitude)
- [`DEFAULT_MAX_LATITUDE`](#assoc_const-default_max_latitude)
- [`DEFAULT_MIN_LONGITUDE`](#assoc_const-default_min_longitude)
- [`DEFAULT_MAX_LONGITUDE`](#assoc_const-default_max_longitude)
- [`new`](#function-new)
- [`preferred_ratio`](#function-preferred_ratio)
- [`map_width`](#function-map_width)
- [`map_height`](#function-map_height)
- [`x_offset`](#function-x_offset)
- [`y_offset`](#function-y_offset)
- [`to_map`](#function-to_map)
- [`to_coordinates`](#function-to_coordinates)

<a id="assoc_const-default_min_latitude"></a>

### DEFAULT_MIN_LATITUDE

```rust
const DEFAULT_MIN_LATITUDE: f64
```

-65 degrees crops the empty band below the populated continents.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L26)

<a id="assoc_const-default_max_latitude"></a>

### DEFAULT_MAX_LATITUDE

```rust
const DEFAULT_MAX_LATITUDE: f64
```

85 degrees, the usual Mercator limit, keeps Greenland whole.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L28)

<a id="assoc_const-default_min_longitude"></a>

### DEFAULT_MIN_LONGITUDE

```rust
const DEFAULT_MIN_LONGITUDE: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L29)

<a id="assoc_const-default_max_longitude"></a>

### DEFAULT_MAX_LONGITUDE

```rust
const DEFAULT_MAX_LONGITUDE: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L30)

<a id="function-new"></a>

### new

```rust
fn new(map_width: f64, map_height: f64, offset_x: f64, offset_y: f64, bounds: GeographicBounds) -> Self
```

A projector of the map area of the given size at the given offset, framed on `bounds`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L39)

<a id="function-preferred_ratio"></a>

### preferred_ratio

```rust
fn preferred_ratio(bounds: GeographicBounds) -> [f64; 2]
```

The conformal aspect ratio, width to height, of the framed bounds (`GetPreferredRatio`):
about 1.355 for the default crop, 1 for the symmetric 85 degrees.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L73)

<a id="function-map_width"></a>

### map_width

```rust
fn map_width(self: &Self) -> f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L79)

<a id="function-map_height"></a>

### map_height

```rust
fn map_height(self: &Self) -> f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L82)

<a id="function-x_offset"></a>

### x_offset

```rust
fn x_offset(self: &Self) -> f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L85)

<a id="function-y_offset"></a>

### y_offset

```rust
fn y_offset(self: &Self) -> f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L88)

<a id="function-to_map"></a>

### to_map

```rust
fn to_map(self: &Self, longitude: f64, latitude: f64) -> Point
```

The minimum longitude spans to the left edge and the maximum to the right; the Mercator
images of the latitude bounds span the height. A latitude at a pole takes the last finite
latitude, so that the poles of a map (Antarctica) stay finite.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L95)

<a id="function-to_coordinates"></a>

### to_coordinates

```rust
fn to_coordinates(self: &Self, screen: Point) -> Option<(f64, f64)>
```

The closed-form inverse: the linear longitude, then the inverse Gudermannian of the
Mercator value, `2 atan(e^n) - pi/2`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.LiveCharts/geo/mercator_projector.rs#L107)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
