public PointD GetMercatorCoordinate(PointD LatitudeLongitudePoint) { double mx = LatitudeLongitudePoint.X * OriginShift / 180; double my = Math.Log(Math.Tan((90 + LatitudeLongitudePoint.Y) * Math.PI / 360)) / (Math.PI / 180); my = my * OriginShift / 180; PointD mercatorPoint = new PointD(mx, my); return mercatorPoint; }
public Point GetPixels(PointD MercatorPoint, Int32 Zoom) { double res = Resolution(Zoom); Int32 px = (int)((MercatorPoint.X + OriginShift) / res); Int32 py = (int)((MercatorPoint.Y + OriginShift) / res); Point p = new Point(px, py); return p; }
public Point GetBitmapCoord(PointD mercatorPoint, Int32 zoom) { Double res = Resolution(zoom); Int32 x = Convert.ToInt32((mercatorPoint.X + OriginShift) / res); Int32 y = Convert.ToInt32((mercatorPoint.Y + OriginShift) / res); Point p = new Point(x, y); return p; }
public Point GetTile(PointD mercatorPoint, Int32 zoom) { Point pix = GetPixels(mercatorPoint, zoom); return GetTile(pix); }
public void LatLonToMercatorY() { PointD expected = new PointD(15926263.117, -4643725.484); Assert.AreEqual(expected.Y, Math.Round(mercatorPoint.Y,3)); }
public void init() { globalMercator = new GlobalMercator(); latitudeLongitudePoint = new PointD(143.068055770704, -38.4537515036619); mercatorPoint = new PointD(15926263.117, -4643725.484); }
public void BitmapPointTestY() { Point p = new Point(459, 197); PointD pM = new PointD(15926263.117, -4643725.484); Assert.AreEqual(p.Y, globalMercator.GetBitmapCoord(pM, 1).Y); }
public Point GetTile(PointD mercatorPoint, Int32 zoom) { Point pix = GetPixels(mercatorPoint, zoom); return(GetTile(pix)); }