Struct MercatorPoint
A position in normalized Web Mercator space, where the whole world is the unit square: (0,0) is the top-left corner (latitude +85.05, longitude -180) and (1,1) the bottom-right.
public readonly struct MercatorPoint : IEquatable<MercatorPoint>
- Implements
Remarks
Always double, never float. At high zoom a float32 mercator coordinate cannot resolve a screen pixel, which is why world coordinates stay in double and the renderer re-anchors near the view center before handing anything to the GPU. Deliberately unvalidated: intermediate results legitimately leave the unit square when wrapping across the antimeridian.
Constructors
MercatorPoint(double, double)
Creates a mercator position. No range validation.
public MercatorPoint(double x, double y)
Parameters
xdoubleHorizontal position in normalized mercator, normally 0 to 1.
ydoubleVertical position in normalized mercator, normally 0 to 1.
Properties
X
Horizontal position in normalized mercator, 0 at longitude -180, 1 at +180.
public double X { get; }
Property Value
Y
Vertical position in normalized mercator, 0 at the north edge, 1 at the south edge. Increases southward, opposite to latitude.
public double Y { get; }
Property Value
Methods
Equals(MercatorPoint)
Exact component-wise equality. No tolerance.
public bool Equals(MercatorPoint other)
Parameters
otherMercatorPoint
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Returns "merc(x,y)".
public override string ToString()