ArcStache.TileUtil.GeographicToTile C# (CSharp) Method

GeographicToTile() public static method

public static GeographicToTile ( double lon, double lat, int zoom ) : IPoint
lon double
lat double
zoom int
return IPoint
        public static IPoint GeographicToTile(double lon, double lat, int zoom)
        {
            // From http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C.23

            IPoint point = new PointClass();
            point.X = (float)((lon + 180.0) / 360.0 * (1 << zoom));
            point.Y = (float)((1.0 - Math.Log(Math.Tan(lat * Math.PI / 180.0) + 1.0 / Math.Cos(lat * Math.PI / 180.0)) / Math.PI) / 2.0 * (1 << zoom));

            return point;
        }