GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How to Use Geonames API(reverse geocode)  XML
Forum Index -> General
Author Message
nagasir



Joined: 29/11/2012 10:11:22
Messages: 1
Offline

hi there.. Help me use Geonames API,
iam newbie, i run the script with HTML5 Geolocation, i already got latitude and longitude, how to convert that two into city name here is my code
Code:
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<title>Geolocation</title>
 	<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
 	<meta charset="utf-8"/>
 	
 	<script type="text/javascript">
 	
 	var options = 
 	{
 		enableHighAccuracy: true,
 		maximumAge:1000,
 		timeout: 45000
 	};
 	if (window.navigator.geolocation)
 		{
 			navigator.geolocation.getCurrentPosition(succesCallback, errorCallback, options);
 		} else 
 		{
 			alert('The browser is not supported');
 		}
 
 	function succesCallback(position)
 	{
 		var output = '';
 		output += "Found YOU.\n\n";
 		output += 'Latitude: ' + position.coords.latitude + "\n";
 		output += 'Longitude: ' + position.coords.longitude + "\n";
 		output += 'Accuracy: ' + position.coords.accuracy + " meters\n";
 		alert(output);
 
 	}
 
 	function errorCallback(error)
 	{
 		switch (error.code)
 		{
 		case error.PERMISSION_DENIED:
 			alert('You didn't grant us PERMISSION);
 			break;
 		case error.POSITION_UNAVAILABLE:
 			alert('Where the hell are you');
 			break;
 		case error.TIMEOUT:
 			alert('Time is over');
 			break;
 		}
 	};
 
 	</script>
 </head>
 <body>
 <h1>Reverse Geolocation</h1>
 
 
 </body>
 </html>
 


where i put geonames api
how to alert the user's city, just like lat and long
simply iam super newbie, i hope someone could help me
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team