Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Dear All
I want to make a html page with Textbox "Place", "longitude" and "latitude" when we type any place name in place Textbox and submit form call a java script function to get "longitude" and "latitude" .
Posted
Comments
Herman<T>.Instance 12-Aug-11 3:26am    
why have a city typed while you can find this data via his IP address:
http://briancray.com/2009/05/29/find-web-visitors-location-javascript-google-api/
OriginalGriff 12-Aug-11 3:58am    
Because the user might want to find data for a place he is going to, rather than is in?

1 solution

I happen to use worldweatheronline.com to get local weather.

Part of their API includes a city search API -- you give them a city name and they return the best matches for that name. For example you give them "Paris" it will give you back: "Paris, France", "Paris, TX" , etc. along with the latitude and longitude for each.

There are others available if you google for them.

Google has a similar API, but my understanding of their terms of use is you are only supposed to use that API if you are going to use it to display a point on a map -- since that isn't my usage model I went with something else.

There's a good sample webpage here:

http://stevemorse.org/jcal/latlon.php[^]

which I found via google. He lists links to services he uses to get the data, and you can also look at the source code for the page.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900