geocoder.getLatLng()方法没有显示谷歌地图上的所有地址?

时间:2010-12-20 20:35:31

标签: asp.net

我在数据库列中有纬度和经度值(超过20),所以我只是抓取这些值并将它们传递给geocoder.getLatLng()方法以将它们显示为标记。但是这个方法不是很快,我把这个方法保存在一个循环中来运行数据库中的所有值,但并不是每次刷新页面时都会显示所有地址它缺少一些地址。这是我的代码,请给我一些建议并告诉你如何设置时间。

        script += " var location = \"\"+ latitude +\", \"+ longitude +\"\";\n";

        script += " geocoder.getLatLng( \n";
        script += " location,function(point) \n";
        script += " {if (point) { \n";
        //script += "       alert(point);\n";
        script += "     var icon = new GIcon(baseIcon);\n";
        script += "     icon.image = \"_gfx/gmap/marker\" + (iconNum) + \".png\";\n";
        script += "     var LocImage = new Image();\n";
        script += "     LocImage.src =\"Modules/ShowImage.aspx?imageid=\"+ ImageID +\"\";\n";
        script += "     var marker = new GMarker(point, icon);\n";
        script += "     map.addOverlay(marker); \n";
        script += "     GEvent.addListener(marker, \"click\", function() {\n";
        script += "         marker.openInfoWindowHtml(\"<div class='facility_map'><a href='\" +detailLink[index]+ \"' class='facility_name'>\" + name + \"</a><br />\" +((ImageID!= \"0\")?\"<img src='\" +LocImage.src + \"' class='markerimg' width='170' height='180' />\":\"\")+ \"<br /><a href=\"+ link[index] +\" target='_blank'>\" + displayAddress + \"</a><br />\" +((PhoneNum != \"\")?\"<b>Phone:</b>\"+PhoneNum+\"\":\"\")+ \"<br />\" + AllAmenities + \"<b>Capacity:</b>\" + Capacities + \"</div>\");\n";
        script += " })\n";
        script += "     return marker;\n";
        script += " }\n";

0 个答案:

没有答案