百度地图不用手动描点获取行政区域边界
2013-05-12 20:45
344 查看
百度API示例地址:http://developer.baidu.com/map/jsdemo.htm#c1_10
原文:/article/4782483.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>获取地区轮廓线</title> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"> </script> <style type="text/css"> body{font-size:13px;margin:10px} #container{width:800px;height:500px;border:1px solid gray;margin:auto auto;} #controler {text-align:center;margin-top:30px;} </style> </head> <body> <div id="container"></div> <div id="controler"> 输入省、直辖市或县名称:<input type="text" id="districtName" style="width:80px" value="合肥市"> <input type="button" onclick="getBoundary()" value="获取轮廓线"></div> <script type="text/javascript"> var map = new BMap.Map("container"); map.centerAndZoom(new BMap.Point(116.403765, 39.914850), 5); map.addControl(new BMap.NavigationControl({type: BMAP_NAVIGATION_CONTROL_SMALL})); map.enableScrollWheelZoom(); function getBoundary(){ var bdary = new BMap.Boundary(); var name = document.getElementById("districtName").value; bdary.get(name, function(rs){ //获取行政区域 map.clearOverlays(); //清除地图覆盖物 var count = rs.boundaries.length; //行政区域的点有多少个 for(var i = 0; i < count; i++){ var ply = new BMap.Polygon(rs.boundaries[i], {strokeWeight: 2, strokeColor: "#ff0000"}); //建立多边形覆盖物 map.addOverlay(ply); //添加覆盖物 map.setViewport(ply.getPath()); //调整视野 } }); } </script> </body> </html>
原文:/article/4782483.html
相关文章推荐
- 百度地图不用手动描点获取行政区域边界
- 百度地图不用手动描点获取行政区域边界
- 批量获取百度地图中的县级以上行政区域的边界数据
- 调用百度地图接口获取城市住宅小区边界信息
- 【百度地图API】如何获取行政区域的边界?
- 百度地图获取行政范围边界
- 【百度地图API】如何获取行政区域的边界? (转载)
- 【百度地图API】如何获取行政区域的边界?
- 【百度地图API】获取行政区域的边界
- 如何获取行政区域的边界gps数据
- 【百度地图API】如何获取行政区域的边界? (转载)
- 【百度地图API】如何获取行政区域的边界?
- 【百度地图API】如何获取行政区域的边界?
- 【百度地图API】如何获取行政区域的边界? (转载)
- iOS -- 百度地图画出行政区域的边界
- 【百度地图API】如何获取行政区域的边界?
- 通过百度地图获取边界地址
- 【百度地图API】如何获取行政区域的边界?
- 【百度地图API】如何获取行政区域的边界? (转)
- 百度地图获取行政范围边界