逆地理解析问题

2 views
Skip to first unread message

Arlen xiao

unread,
Mar 5, 2010, 9:13:29 PM3/5/10
to Google-Map...@googlegroups.com
Hi All

   我想请问一下在google maps api中我如何在while循环中得到解析的地址。

--
Arlen

msn:arle...@live.cn
skype ID:arlenxiao
E-mail:arle...@gmail.com
Tel:+86-0755-82840647 Ext 616
Mobile phone:+86-13417456139
Fax:+86-0755-82840648

Rosen Jiang

unread,
Mar 5, 2010, 9:20:29 PM3/5/10
to google-map...@googlegroups.com
每次解析回调之后再走新的解析再回调。

--
您收到此信息是由于您订阅了 Google 论坛“谷歌地图 API 中文论坛”论坛。
要在此论坛发帖,请发电子邮件到 Google-Map...@googlegroups.com
要退订此论坛,请发邮件至 Google-Maps-API-...@googlegroups.com
更多选项,请通过 http://groups.google.com/group/Google-Maps-API-China?hl=zh-CN 访问该论坛
什么是Google地图API? 请通过 http://code.google.com/intl/zh-CN/apis/maps/index.html 免费将 Google 地图嵌入自己的网页中

Arlen xiao

unread,
Mar 5, 2010, 10:45:46 PM3/5/10
to google-map...@googlegroups.com
帮我看看这个应该怎么做

 <script type="text/javascript">

var address = new Array();
var kl=0;
var geoc=new google.maps.Geocoder();
  function LatLng()
  {
    address = new Array();
    
    
    var tab = document.getElementById('<%= GridView1.ClientID %>');

    var i=tab.rows.length-1;
    var j=0;
    while(i>2)
    {
        var lat=tab.rows[i].cells[24].innerText;
        var lng=tab.rows[i].cells[25].innerText;
//        function (j,address)
//        {
//            window.setTimeout(function(lat,lng)
//            {
                IntiAddress(lat,lng);
//            },  j* 300)
//        }
        i--;
        j++;
    }
  }
  
  function IntiAddress(lat,lng)
  {
    var latlng=new google.maps.LatLng(lat,lng);
        if(geoc)
        {
            geoc.geocode(
            {'latLng':latlng},
            function(results,status)
            {
            if(status==google.maps.GeocoderStatus.OK)
            { 
                var lbl=document.getElementById("<%= lbltest.ClientID %>");
                    
                address[kl]=results[0].formatted_address;
                if(address[kl]=='undefined')
                {
                    address[kl]=results[1].formatted_address;
                }
                lbl.innerText= address[kl];
                kl++;
            }
            }
            );
Reply all
Reply to author
Forward
0 new messages