BMap百度地图坐标转换(批量坐标)

<script src="http://api.map.baidu.com/api?v=1.3" type="text/javascript"></script>
 <script type="text/javascript" src="
http://dev.baidu.com/wiki/static/map/API/examples/script/changeMore.js"></script></head>

 

1.批量坐标

var varpoints = [

  newBMap.Point(116.3786889372559,39.90762965106183),  

  newBMap.Point(116.38632786853032,39.90795884517671),    

  newBMap.Point(116.39534009082035,39.907432133833574),    

  newBMap.Point(116.40624058825688,39.90789300648029),    

  newBMap.Point(116.41413701159672,39.90795884517671)  

];

2.批量转换

//type: 2表示google转百度;0表示gps转百度

BMap.Convertor.transMore(varpoints ,type,callback);

3.回调函数

function callback(xyResults){
   var xyResult = null;
   for(var index in xyResults){
       xyResult = xyResults[index];
       if(xyResult.error != 0){continue;}
       var point = new BMap.Point(xyResult.x, xyResult.y);

       alert(point);
    }
  }

 

 

 


 


 

你可能感兴趣的:(BMap百度地图坐标转换(批量坐标))