Ejemplo n.º 1
0
        public static Windows.Foundation.Point LocationToGlobalPixel(BasicGeoposition location, double zoom)
#endif
        {
            double x           = (location.Longitude + 180) / 360;
            double sinLatitude = Math.Sin(SpatialTools.ToRadians(location.Latitude));
            double y           = 0.5 - Math.Log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);

            double mapSize = MapSize(zoom);

            #if WINDOWS_APP || WINDOWS_PHONE_APP
            return(new Windows.Foundation.Point((int)(x * mapSize), (int)(y * mapSize)));
            #elif WPF || WINDOWS_PHONE
            return(new System.Windows.Point((int)(x * mapSize), (int)(y * mapSize)));
            #endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the Ground resolution at a specific degree of latitude in the specified units per pixel.
        /// </summary>
        /// <param name="latitude">Degree of latitude to calculate resolution at</param>
        /// <param name="zoom">Zoom level to calculate resolution at</param>
        /// <param name="unitType">Distance unit type to calculate resolution in</param>
        /// <returns>Ground resolution in distance unit per pixels</returns>
        public static double GroundResolution(double latitude, double zoom, DistanceUnits units)
        {
            double earthRadius = SpatialTools.GetEarthRadius(units);

            return((Math.Cos(SpatialTools.ToRadians(latitude)) * 2 * Math.PI * earthRadius) / MapSize(zoom));
        }