Esempio n. 1
0
        /// <summary>
        /// Returns a normalized Lat rectangle shape for the bounding box
        /// If you go over the poles, you need to flip the lng value too
        /// </summary>
        private static LatLng NormLat(double lat, double lng)
        {
            if (lat > 90.0)
            {
                lat = 90.0 - (lat - 90.0);
                if (lng < 0)
                {
                    lng = lng + 180;
                }
                else
                {
                    lng = lng - 180;
                }
            }
            else if (lat < -90.0)
            {
                lat = -90.0 - (lat + 90.0);
                if (lng < 0)
                {
                    lng = lng + 180;
                }
                else
                {
                    lng = lng - 180;
                }
            }
            LatLng ll = new FloatLatLng(lat, lng);

            return(ll);
        }
Esempio n. 2
0
        public double GetLLMDistance(double x1, double y1, double x2, double y2)
        {
            LatLng p1 = new FloatLatLng(x1, y1);
            LatLng p2 = new FloatLatLng(x2, y2);

            return(p1.ArcDistance(p2, DistanceUnits.MILES));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns a normalized Lng rectangle shape for the bounding box
        /// </summary>
        private static LatLng NormLng(double lat, double lng)
        {
            if (lng > 180.0)
            {
                lng = -1.0 * (180.0 - (lng - 180.0));
            }
            else if (lng < -180.0)
            {
                lng = (lng + 180.0) + 180.0;
            }
            LatLng ll = new FloatLatLng(lat, lng);

            return(ll);
        }
Esempio n. 4
0
		/// <summary>
		/// Returns a normalized Lat rectangle shape for the bounding box
		/// If you go over the poles, you need to flip the lng value too
		/// </summary>
		private static LatLng NormLat(double lat, double lng)
		{
			if (lat > 90.0)
			{
				lat = 90.0 - (lat - 90.0);
				if (lng < 0)
				{
					lng = lng + 180;
				}
				else
				{
					lng = lng - 180;
				}
			}
			else if (lat < -90.0)
			{
				lat = -90.0 - (lat + 90.0);
				if (lng < 0)
				{
					lng = lng + 180;
				}
				else
				{
					lng = lng - 180;
				}
			}
			LatLng ll = new FloatLatLng(lat, lng);
			return ll;
		}
Esempio n. 5
0
		/// <summary>
		/// Returns a normalized Lng rectangle shape for the bounding box
		/// </summary>
		private static LatLng NormLng(double lat, double lng)
		{
			if (lng > 180.0)
			{
				lng = -1.0 * (180.0 - (lng - 180.0));
			}
			else if (lng < -180.0)
			{
				lng = (lng + 180.0) + 180.0;
			}
			LatLng ll = new FloatLatLng(lat, lng);
			return ll;
		}