簡易代碼之家
BlogJava
::
首頁
::
聯系
::
聚合
::
管理
157 Posts :: 2 Stories :: 57 Comments :: 0 Trackbacks
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
我參與的團隊
隨筆檔案
2015年6月 (1)
2015年4月 (5)
2015年3月 (2)
2015年1月 (3)
2014年12月 (2)
2014年11月 (3)
2014年10月 (4)
2014年9月 (4)
2014年8月 (5)
2014年7月 (11)
2014年6月 (1)
2014年4月 (1)
2013年11月 (1)
2013年8月 (1)
2013年7月 (4)
2013年6月 (1)
2013年5月 (6)
2013年4月 (3)
2013年3月 (2)
2013年2月 (2)
2013年1月 (1)
2012年10月 (3)
2012年9月 (10)
2012年8月 (3)
2012年7月 (2)
2012年6月 (1)
2012年4月 (4)
2011年4月 (1)
2011年3月 (1)
2011年2月 (2)
2010年12月 (2)
2010年10月 (1)
2010年9月 (1)
2010年8月 (2)
2010年7月 (1)
2010年6月 (5)
2010年5月 (9)
2010年3月 (1)
2010年1月 (2)
2009年11月 (1)
2009年9月 (5)
2009年5月 (4)
2009年4月 (7)
2008年10月 (3)
2008年8月 (1)
2008年7月 (5)
2008年6月 (2)
2008年5月 (1)
2008年4月 (3)
2008年3月 (6)
2008年1月 (3)
2007年12月 (1)
2007年11月 (1)
文章檔案
2012年10月 (1)
2007年11月 (1)
搜索
最新評論
1.?re: TFS新建根目錄文件夾
第三方
--手動閥
2.?re: Java web程序中備份oracle數據庫
要是寫上如何恢復數據庫就更好了
--yanwushu
3.?re: 一個調用百度地圖小實例[未登錄]
, .fj
--k
4.?re: Javascript實現Html頁面指定區域導出WORD
dsf
--d
5.?re: 移除JSCharts水印
fs.bg.2v(fX) 很棒
--zzz
閱讀排行榜
1.?Resource is out of sync with the file system的解決辦法(40116)
2.?巧用Ajax4Jsf的oncomplete事件(7160)
3.?一個調用百度地圖小實例(6642)
4.?集合的常用操作類CollectionUtils(5884)
5.?【百度地圖API】獲取行政區域的邊界(4632)
評論排行榜
1.?Resource is out of sync with the file system的解決辦法(8)
2.?Java中對日期的常用處理(6)
3.?實現文字上標的CSS樣式(4)
4.?Spring Mail中文亂碼問題(4)
5.?移除JSCharts水印(4)
【百度地圖API】獲取行政區域的邊界
<!
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
}
</
style
>
</
head
>
<
body
>
<
div
id
="container"
></
div
>
<
br
/>
輸入省、直轄市或縣名稱:
<
input
type
="text"
id
="districtName"
style
="width:80px"
value
="重慶市"
>
<
input
type
="button"
onclick
="getBoundary()"
value
="獲取輪廓線"
>
<
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
>
轉自:
http://www.cnblogs.com/milkmap/archive/2012/04/11/2442430.html
posted on 2014-09-29 11:34
Jakin.zhou
閱讀(4632)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Copyright @ Jakin.zhou
Powered by:
.Text
and
ASP.NET
Theme by:
.NET Monster
主站蜘蛛池模板:
阿巴嘎旗
|
花垣县
|
屏南县
|
徐闻县
|
台南市
|
泾阳县
|
浙江省
|
满洲里市
|
甘孜县
|
常州市
|
轮台县
|
义马市
|
会理县
|
贡觉县
|
和平区
|
嘉义市
|
西乡县
|
罗平县
|
洱源县
|
兴仁县
|
红原县
|
名山县
|
商城县
|
三门县
|
公安县
|
锡林郭勒盟
|
板桥市
|
炉霍县
|
阿鲁科尔沁旗
|
浑源县
|
宾阳县
|
阳高县
|
随州市
|
康保县
|
韶山市
|
清新县
|
门源
|
临颍县
|
株洲市
|
永顺县
|
洪江市
|