Esempio n. 1
0
        public static LngLat Unproject(MercatorMeters meters)
        {
            double longitude = meters.x * 180.0 / EarthHalfCircumferenceMeters;
            double latitude  = (Math.Atan(Math.Exp(meters.y / EarthRadiusMeters)) - 0.25 * Math.PI) * 360.0 / Math.PI;

            return(new LngLat(longitude, latitude));
        }
Esempio n. 2
0
        public TileAddress ToTileAddress(int zoom)
        {
            double metersPerTile = Geo.EarthCircumferenceMeters / (1 << zoom);

            MercatorMeters meters = ToMercatorMeters();

            int tileX = (int)((meters.x + Geo.EarthHalfCircumferenceMeters) / metersPerTile);
            int tileY = (int)((Geo.EarthHalfCircumferenceMeters - meters.y) / metersPerTile);

            return(new TileAddress(tileX, tileY, zoom));
        }