你能告诉我什么类型的开尔文高度?
像peninsula = streetqueenstown = city
9300 =邮政编码
New Nealand = country
开尔文高度=?
因为我使用了邻居,地方性等等,但没有任何东西从地址获得开尔文的高度,尽管其他一切都像国家,地方/城市,邮政编码等等。
这是主要代码。
jQuery(document).ready(function ($) {
"use strict";
var autocomplete,autocomplete2;
var options = {
types: ['(cities)'],
componentRestrictions: {country: 'uk'}
};
var componentForm = {
establishment:'long_name',
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'long_name',
administrative_area_level_2: 'long_name',
country: 'long_name',
postal_code: 'short_name',
postal_code_prefix:'short_name',
neighborhood: 'long_name'
};
if ( google_map_submit_vars.enable_auto ==='yes' ){
autocomplete = new google.maps.places.Autocomplete(
/** @type {HTMLInputElement} */(document.getElementById('property_address')),
{ types: ['geocode'],
"partial_match" : true
}
);
// When the user selects an address from the dropdown,
// populate the address fields in the form.
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace();
fillInAddress(place);
});
autocomplete2 = new google.maps.places.Autocomplete(
/** @type {HTMLInputElement} */(document.getElementById('property_city_submit')),
{ types: ['(cities)'] }
);
google.maps.event.addListener(autocomplete2, 'place_changed', function() {
var place = autocomplete2.getPlace();
fillInAddress(place);
});
}
function fillInAddress(place) {
for (var i = 0; i < place.address_components.length; i++) {
var addressType = place.address_components[i].types[0];
var temp='';
var val = place.address_components[i][componentForm[addressType]];
if(addressType=== 'street_number' || addressType=== 'route'){
// document.getElementById('property_address').value = document.getElementById('property_address').value +', '+ val;
}else if(addressType=== 'neighborhood'){
$('#property_area').val(val);
}else if(addressType=== 'postal_code_prefix'){
temp = $('#property_zip').val();
$('#property_zip').val(val+" "+temp)
}else if(addressType=== 'postal_code'){
temp = $('#property_zip').val();
$('#property_zip').val(val+" "+temp)
}else if(addressType=== 'administrative_area_level_2'){
$('#property_region_submit').val(val);
}else if(addressType=== 'administrative_area_level_1'){
$('#property_region_submit').val(val);
}else if(addressType=== 'locality'){
$('#property_city_submit').val(val);
}else if(addressType=== 'country'){
alert('c');
$('#property_country').val(val);
}else{
}
}
}
autocomplete2 = new google.maps.places.Autocomplete(
/** @type {HTMLInputElement} */(document.getElementById('property_city_submit')),
{ types: ['(cities)'] }
);
// When the user selects an address from the dropdown,
// populate the address fields in the form.
google.maps.event.addListener(autocomplete2, 'place_changed', function() {
var place = autocomplete2.getPlace();
fillInAddress(place);
});
jQuery('#google_capture2').click(function(event){
event.preventDefault();
codeAddress_child();
});
function codeAddress_child() {
var address = document.getElementById('property_address').value;
//var e = document.getElementById("property_city_submit");
//var city = e.options[e.selectedIndex].text;
var city=jQuery("#property_city_submit").val();
var full_addr= address+','+city;
if( document.getElementById('property_region_submit') ){
var rgn = document.getElementById('property_region_submit').value;
if(rgn){
var full_addr=full_addr +','+rgn;
}
}
if( document.getElementById('property_country') ){
var country = document.getElementById('property_country').value;
if(country){
var full_addr=full_addr +','+country;
}
}
geocoder.geocode( { 'address': full_addr}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
var infowindow = new google.maps.InfoWindow({
content: 'Latitude: ' + results[0].geometry.location.lat() + '<br>Longitude: ' + results[0].geometry.location.lng()
});
infowindow.open(map,marker);
document.getElementById("property_latitude").value=results[0].geometry.location.lat();
document.getElementById("property_longitude").value=results[0].geometry.location.lng();
} else {
alert(google_map_submit_vars.geo_fails + status);
}
});
}
/////////////////////////////////////// search code
});