webkul
webkul

Reputation: 2864

Google Map with php mysql

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

Upvotes: 0

Views: 1069

Answers (4)

Daniel Vassallo
Daniel Vassallo

Reputation: 344311

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.

Upvotes: 1

Josh
Josh

Reputation: 6322

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

Upvotes: 3

jjclarkson
jjclarkson

Reputation: 5954

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.

Upvotes: 1

Coomer
Coomer

Reputation: 587

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

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

Upvotes: 4

Related Questions