¾È±Ô °øºÎ¹æ

Javascript & JQuery & CSS > Google Maps API + GPS °Å¸® ±¸Çϱâ (javascript)

µî·ÏÀÏ : 2017-07-14 17:13 Á¶È¸¼ö : 53,106

±¸±Û¸µµµ ½Ç·ÂÀÌ´Ù...

Áö±¸ À§¿¡¼­ ¾î´À ÇÑ Á¡°ú ¶Ç ´Ù¸¥ Á¡ÀÇ °Å¸®¸¦ ±¸ÇÏ´Â ½Ä.

µµ´ëü ¾î¶² Áö´Ï¾î½ºµéÀÌ ÀÌ·± °ø½ÄÀ» ¸¸µé¾î ³½°Å¾ß ¤Ì ¤Ì
 
	var dDistance = 0;
	var dLat1InRad = lat1 * (Math.PI / 180.0);
	var dlng1InRad = lng1 * (Math.PI / 180.0);
	var dLat2InRad = lat2 * (Math.PI / 180.0);
	var dlng2InRad = lng2 * (Math.PI / 180.0);

	var dlng = dlng2InRad - dlng1InRad;
	var dLat = dLat2InRad - dLat1InRad;

	var a = Math.pow(Math.sin(dLat / 2.0), 2.0) + Math.cos(dLat1InRad) * Math.cos(dLat2InRad) * Math.pow(Math.sin(dlng / 2.0), 2.0);
	var c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));

	var kEarthRadiusKms = 6376.5;
	dDistance = kEarthRadiusKms * c;
	
	alert("°Å¸® :" + dDistance);

[ °Å¸®±¸Çϱâ Å×½ºÆ® ÆäÀÌÁö ¸µÅ© ]
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.