Autocomplete Geocoder v3自动完成酒店

Autocomplete Geocoder v3自动完成酒店,autocomplete,geocode,Autocomplete,Geocode,我们正在运营一个网站(www.taxileader.net/taxi tegel.html),人们可以在那里预订从机场到目的地的出租车 为了预订和计算通常是机场的起始地址(我们的数据库中已经有纬度/经度)与其目的地之间的距离,我们使用google map v3 在“目的地字段”中,我们已经有了一个自动完成功能,可以从客户填写的地址中提取邮政编码,但我们需要他们找到酒店的邮政编码 我们用来获取地址信息的API调用是geocoder v3,这是错误的,还是我们必须输入其他内容才能找到酒店 $("#t

我们正在运营一个网站(www.taxileader.net/taxi tegel.html),人们可以在那里预订从机场到目的地的出租车

为了预订和计算通常是机场的起始地址(我们的数据库中已经有纬度/经度)与其目的地之间的距离,我们使用google map v3

在“目的地字段”中,我们已经有了一个自动完成功能,可以从客户填写的地址中提取邮政编码,但我们需要他们找到酒店的邮政编码

我们用来获取地址信息的API调用是geocoder v3,这是错误的,还是我们必须输入其他内容才能找到酒店

$("#txt_indirizzo").autocomplete({
    //This bit uses the geocoder to fetch address values
    source : function(request, response) {
        geocoder.geocode({
            'address' : request.term,
            'bounds' : bound
        }, function(results, status) {
            response($.map(results, function(item) {
                var zip = '';
                for (var i in item.address_components) {
                    if (item.address_components[i].types[0] == 'postal_code' || item.address_components[i].types[1] == 'postal_code') {
                        zip = item.address_components[i].long_name;
                    }
                }
                if (zip == '') {
                    return;
                } else {
                    return {
                        value : item.formatted_address,
                        latitude : item.geometry.location.lat(),
                        longitude : item.geometry.location.lng(),
                        zip : zip
                    }
                }

            }));
        })
    },
    //This bit is executed upon selection of an address
    select : function(event, ui){
        if (tipoDiTrasf == 2) {
            return;
        }

        chk_txt_indirizzo = true;
        if (ui.item.zip != '') {

            chkPostcode(ui.item.zip, ui.item.latitude, ui.item.longitude, ui.item.value, '#txt_indirizzo');

        } else {
            alert('Questo non è un indirizzo valido');
            setTimeout('$("#txt_indirizzo").val("")', 5);
        }
        tab(1);
    },
    change : function() {
        if (!chk_txt_indirizzo) {
            $("#txt_indirizzo").val('').data("autocomplete").term = "";
            zip_indirizzo = pointLat2 = pointLon2 = setIndirizzo = false;
            putondinNam();

        }
    }
});
至少有没有办法让谷歌地图只自动完成城市地图

我的意思是在“城市领域”,我们只想显示城市,而不是地址


非常感谢

也许,这些地方可以帮助你


我们已经使用地理编码从客户写的地址中提取邮政编码,但在目的地字段中,我们需要使用谷歌自动完成显示酒店列表并从中提取邮政编码,以便进行内部计算。我建议您将其纳入问题中。不仅仅是这句话。你必须研究这个问题。这里的一个问题应该说明你尝试过什么,你到底有什么问题,你已经做了什么来消除它,结果是什么。刚才你的问题看起来很不明确。只是因为你是这里的发起者,它并没有因为模糊而关闭。把标签放在那里。例如,你的语言是什么?有数千个。嗨,谢谢你的回答,我们之前已经使用了你的一个链接,所有其他链接都没有显示任何商业场所,比如酒店。地理编码器只接受地址,我们需要一个API作为GETLOCAL(如果我记得很清楚的话,google maps v2)来获取酒店等商业场所