0

嗨,我创建了一个混搭,用户可以在其中输入位置。使用 IE7 时,几乎所有位置都可以进行地理编码,但不能使用其他浏览器......你认为这里的问题是什么,或者有什么解决方法?我使用 javascript 地理编码,例如:

 function addToMap(response) {
       var x="Fa, France";
        // Retrieve the object
        if (x.length > 0 && x != "") {
            if (!response || response.Status.code != 200) {
                alert("Please enter a valid location.I cannot geocode it!"); 
            }
            else
            {
                place = response.Placemark[0];

                // Retrieve the latitude and longitude
                point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);

                // Center the map on this point
                map.setCenter(point, 4);}}

...更多代码

4

1 回答 1

1

在最近的 API 版本中,必须使用数字作为 GLatLng() 的参数。在以前的版本中,您通常可以将它们保留为 String 对象,就像您正在做的那样。

尝试使用 parseFloat(place.Point.coordinates[1]), parseFloat(place.Point.coordinates[0])

我不知道为什么 MSIE7 应该有所不同,或者为什么您在 Firebug 中没有收到明确的错误消息。也许有些事情你没有告诉我们。

于 2009-11-02T04:50:50.450 回答