We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,809 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

circumstances of a area in google map

Hi Frendz,
I have a latitude and longitude points of particular place namely X. Now I want to check the given latitude and longitude point of a place namely Y is within a circumstance of a particular radius from that point X. How to check that? i'm using google map.

2
Contributors
3
Replies
4 Hours
Discussion Span
2 Years Ago
Last Updated
4
Views
Question
Answered
Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0

1. count distance between x and y point.
2. check wheather it is less than radious (y is inside)
it is greater than radious (y is outside)

vibhaJ
Posting Shark
958 posts since Apr 2010
Reputation Points: 161
Solved Threads: 190
Skill Endorsements: 3

1. count distance between x and y point.
2. check wheather it is less than radious (y is inside)
it is greater than radious (y is outside)

Thanks for your reply. I'll try and inform about the result

Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0

Yes.. Its soved using the following code

$lat1=mysql_result($rs_area,0,"lat");
			$lon1=mysql_result($rs_area,0,"lng");
			$distance=mysql_result($rs_area,0,"radius");
		
			$lat2=$row['latitude'];
			$lon2=$row['longitude'];
			$R = 6371; // Radius of the earth in km
			$dLat = deg2rad($lat2-$lat1);  // Javascript functions in radians
			$dLon = deg2rad($lon2-$lon1); 
			$a = sin($dLat/2) * sin($dLat/2) +
					cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * 
					sin($dLon/2) * sin($dLon/2); 
			$c = 2 * atan2(sqrt($a), sqrt(1-$a)); 
			$d = $R * $c; // Distance in km
Karthik_pranas
Posting Pro
571 posts since Feb 2011
Reputation Points: 96
Solved Threads: 101
Skill Endorsements: 0
Question Answered as of 2 Years Ago by vibhaJ

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1008 seconds using 2.7MB