Table of Contents

Class MapSpan

Represents a rectangular region on the map, defined by a center coordinate and a span in degrees.

public sealed class MapSpan
Inheritance
MapSpan
Inherited Members

Constructors

MapSpan(MapCoordinate, double, double)

Initializes a new instance of the MapSpan class with the specified center and span in degrees.

public MapSpan(MapCoordinate center, double latitudeDegrees, double longitudeDegrees)

Parameters

center MapCoordinate

The center coordinate of the span.

latitudeDegrees double

The latitude span in degrees.

longitudeDegrees double

The longitude span in degrees.

Properties

Center

Gets the center coordinate of this span.

public MapCoordinate Center { get; }

Property Value

MapCoordinate

LatitudeDegrees

Gets the latitude span in degrees.

public double LatitudeDegrees { get; }

Property Value

double

LongitudeDegrees

Gets the longitude span in degrees.

public double LongitudeDegrees { get; }

Property Value

double

Radius

Gets the approximate radius of the span.

public Distance Radius { get; }

Property Value

Distance

Methods

ClampLatitude(double, double)

Creates a new MapSpan with latitude clamped to the specified bounds.

public MapSpan ClampLatitude(double north, double south)

Parameters

north double
south double

Returns

MapSpan

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

FromCenterAndRadius(MapCoordinate, Distance)

Creates a new MapSpan from a center coordinate and radius.

public static MapSpan FromCenterAndRadius(MapCoordinate center, Distance radius)

Parameters

center MapCoordinate
radius Distance

Returns

MapSpan

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToZoomLevel()

Converts this span to a MapLibre slippy-map zoom level using the Spherical Mercator relationship zoom = log2(360 / degrees), taking the tighter of the two axes and clamping to the 0–24 range MapLibre supports.

public double ToZoomLevel()

Returns

double

A zoom level suitable for passing to camera methods (JumpTo/EaseTo/FlyTo).

WithZoom(double)

Creates a new MapSpan with the specified zoom factor applied.

public MapSpan WithZoom(double zoomFactor)

Parameters

zoomFactor double

The zoom factor. Values greater than 1 zoom in, values less than 1 zoom out.

Returns

MapSpan

Operators

operator ==(MapSpan?, MapSpan?)

Determines whether two MapSpan instances are equal.

public static bool operator ==(MapSpan? left, MapSpan? right)

Parameters

left MapSpan
right MapSpan

Returns

bool

operator !=(MapSpan?, MapSpan?)

Determines whether two MapSpan instances are not equal.

public static bool operator !=(MapSpan? left, MapSpan? right)

Parameters

left MapSpan
right MapSpan

Returns

bool