views:

298

answers:

4

hi

my problem is i want to show my registered site user on to google map but dont know how to locate the user, means i dont know the latitude and longitude of every user . I am a newbie in google map so plz help

Thanks a ton

+3  A: 

What location data do you have for your users? Cities, states, countries?

You might want to have a look at Google's Geocoding APIs.

Coomer
Thanks coomer im interested in cities
vipinsahu
+1  A: 

There is no way to reliably locate a user using their IP address. However if you are developing for a mobile device it may be possible to acquire their GPS coordinates. Or you could require them to enter an address and place a point on the map from that address with geocoding.

jjclarkson
Thanks jjclarkson but i am interested in locating the cities in the map
vipinsahu
+2  A: 

there are two possible ways of doing this.

  1. Ask the user to search a google map and place themselves on it. Look here for an idea on how to do this http://www.designing4u.de/2008/08/google-maps-jquery-and-xml-saving-markers-with-user-input/
  2. Use an IP to Location database to find out the location based on their IP. Look here for how to do this http://www.ip2nation.com/ip2nation
Josh
Thanks JOsh for such an awesome answer
vipinsahu
No problem - glad I could help. :)
Josh
+1  A: 

If you are collecting the address of each registered user, you can get the latitude and longitude on the server-side through the Google Maps HTTP Geocoding Service.

You would use the following HTTP request:

http://maps.google.com/maps/geo?q=Oxford+Street,+London&output=csv&sensor=false

Simply change the q parameter with your user's address.

Daniel Vassallo