Class MapSpan
- Namespace
- MapLibreNative.Maui.Geometry
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
centerMapCoordinateThe center coordinate of the span.
latitudeDegreesdoubleThe latitude span in degrees.
longitudeDegreesdoubleThe longitude span in degrees.
Properties
Center
Gets the center coordinate of this span.
public MapCoordinate Center { get; }
Property Value
LatitudeDegrees
Gets the latitude span in degrees.
public double LatitudeDegrees { get; }
Property Value
LongitudeDegrees
Gets the longitude span in degrees.
public double LongitudeDegrees { get; }
Property Value
Radius
Gets the approximate radius of the span.
public Distance Radius { get; }
Property Value
Methods
ClampLatitude(double, double)
Creates a new MapSpan with latitude clamped to the specified bounds.
public MapSpan ClampLatitude(double north, double south)
Parameters
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
FromCenterAndRadius(MapCoordinate, Distance)
Creates a new MapSpan from a center coordinate and radius.
public static MapSpan FromCenterAndRadius(MapCoordinate center, Distance radius)
Parameters
centerMapCoordinateradiusDistance
Returns
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
zoomFactordoubleThe zoom factor. Values greater than 1 zoom in, values less than 1 zoom out.
Returns
Operators
operator ==(MapSpan?, MapSpan?)
Determines whether two MapSpan instances are equal.
public static bool operator ==(MapSpan? left, MapSpan? right)
Parameters
Returns
operator !=(MapSpan?, MapSpan?)
Determines whether two MapSpan instances are not equal.
public static bool operator !=(MapSpan? left, MapSpan? right)