Ответ 1
Здесь приведена ссылка на документацию по соответствующему API Карт Google:
http://code.google.com/apis/ajax/documentation/#ClientLocation
Здесь показан пример того, как его использовать:
/**
* Set the currentState_ and currentCountry_ properties based on the client's
* current location (when available and in the US), or to the defaults.
*/
InTheNews.prototype.setDefaultLocation_ = function() {
this.currentState_ = this.options_.startingState;
if (google.loader.ClientLocation &&
google.loader.ClientLocation.address.country_code == "US" &&
google.loader.ClientLocation.address.region) {
// geo locate was successful and user is in the United States. range
// check the region so that we can safely use it when selecting a
// state level polygon overlay
var state = google.loader.ClientLocation.address.region.toUpperCase();
if (InTheNews.stateNames[state]) {
this.currentState_ = state;
}
}
this.currentCountry_ = "US";
}
И расскажет вам, что вы получите от него:
При заполнении Объект
google.loader.ClientLocation
заполнены следующим Свойства гранулярности уровня:
ClientLocation.latitude
- обеспечивает широту разрешения низкого разрешения, связанную с IP-адресом клиента
ClientLocation.longitude
- обеспечивает долготу долготы с низким разрешением, связанную с IP-адресом клиента
ClientLocation.address.city
- указывает имя города, связанного с IP-адресом клиента
ClientLocation.address.country
- указывает имя страны, связанной с IP-адресом клиентаClientLocation.address.country_code - содержит имя кода страны ISO 3166-1, связанного с IP-адресом клиента
ClientLocation.address.region - указывает имя региона, ассоциированное с IP-адресом клиента