點環域查詢-行政區:
點坐標(必填)(:
(POINT (118.4427314 29.8645294), POINT (119.8872225 32.3060813), POINT (120.7190509 31.1490555))
環域範圍(必填):公尺(上限20000m)
環域範圍彈性值:公尺(上限20000m,若環域範圍內查無資料,則啟動此環域彈性值範圍繼續查詢)
模糊查詢或精確查詢:(0:模糊查詢,1:精確查詢,不填預設1)
回傳筆數的上限:(預設1000, 不填不限)
起時間彈性值:(無負值;如與結束時間彈性值其中一項未輸入,則與另一項相同;如與結束時間兩項皆未填,則彈性值為0。)
迄時間彈性值:(無負值;如與結束時間彈性值其中一項未輸入,則與另一項相同;如與開始時間兩項皆未填,則彈性值為0。)
時間區間:
(區間起或迄其中一欄若填”-“,表示該時間點往前(自古)或往後查(至今);其中一欄不填則自動與另一欄相同)
設定回傳欄位:
(以半形逗號做分隔,ID,NAME,U_CLASS,B_YEAR,E_YEAR,NOTE,SHPNAME,WKT)
排序:(0:朝代)
範例程式碼(詳細請點右鍵觀看原始碼):
<script type="text/javascript" src="http://ccts.sinica.edu.tw/api/CCTS_API.js"> <script>
var getPB_dis = function () {
if(document.getElementById("pWkt").value != "" && document.getElementById("pdistance").value != "")
{
var pQuery = new PointBuffer();
var aa="";
document.getElementById("view").innerHTML = "";
var times = document.getElementById("timeS");
var timee = document.getElementById("timeE");
var Fields1 = document.getElementById("Fields1");
var orderNum = document.getElementById("order");
if(times.value != "" && timee.value == "")
{
timee.value = times.value;
}
else if(times.value == "" && timee.value != "")
{
times.value = timee.value;
}
var drangeS = document.getElementById("drangeS");
var drangeE = document.getElementById("drangeE");
if(drangeS.value != "" && drangeE.value == "")
{
drangeE.value = drangeS.value;
}
else if(drangeS.value == "" && drangeE.value != "")
{
drangeS.value = drangeE.value;
}
var res1 = Fields1.value.split(",");
pQuery.identify({
pointwkt: document.getElementById("pWkt").value,
distance: parseInt(document.getElementById("pdistance").value),
distancerange: parseInt(document.getElementById("pdistancerange").value)
}, null , {
queryNum: parseInt(document.getElementById("qNum").value),
timeOption: ((times.value != "" && timee.value != "") ? [{ startdate: parseInt(times.value), enddate: parseInt(timee.value) }] : null),
startdaterange:parseInt(drangeS),
enddaterange:parseInt(drangeE),
resultLimit: parseInt(document.getElementById("rLimit").value),
mapTypeIds:((res1.length != 0) ? res1 : []),
order: parseInt(orderNum.value)
}
, function (result, status) {
if(result != "")
{
var fName = result[0].fieldName.split(",");
aa += "<table border='1'><tr><td>status</td>"
for(var fn = 0; fn < fName.length; fn++)
{
aa += "<td>" + fName[fn] + "</td>";
}
aa += "</tr>";
for(var i = 0; i < result[0]["fieldAttr"].length; i++)
{
aa += "<tr valign='top'><td>" + status + "</td>";
for(var fa = 0; fa < result[0]["fieldAttr"][i].length; fa++)
{
aa += "<td>" + result[0]["fieldAttr"][i][fa] + "</td>";
}
aa += "</tr>";
}
aa += "</table>";
document.getElementById("view").innerHTML = aa;
}
else
{
document.getElementById("view").innerHTML = status;
}
})
}
else
{
alert("pointwkt、環域範圍請勿空白");
document.getElementById("view").innerHTML = "";
}
}
</script>