private void UpdateMetersPerPixel() { const float refD = 1000.0f; // one kilometer double earthRadius = WGS84EarthRadius(pos.latitude); int numTiles = (1 << zoom); var pxPos = numTiles * Mercator.CoordToPoint(pos); var refPos = new GlobalPosition(pos.latitude, pos.longitude + Mathf.Rad2Deg * refD / earthRadius); var pxRef = numTiles * Mercator.CoordToPoint(refPos); metersPerPixel = refD / Mathf.Abs(pxPos.x - pxRef.x); }
public Vector2 PixelPosition(GlobalPosition pos) { return((1 << GoogleMapsDriver.main.zoom) * Mercator.CoordToPoint(pos)); }