測量服務-面積:
面坐標:
輸入POLYGON((118.4427314 29.8645294,119.4427314 29.8645294, 118.4427314 30.8645294, 118.4427314 29.8645294))
範例程式碼(詳細請點右鍵觀看原始碼):
<script type="text/javascript" src="http://ccts.sinica.edu.tw/api/CCTS_API.js"> <script>
var MeasureArea = function () {
if (document.getElementById("pWkt").value != "") {
var aa = "";
document.getElementById("view").innerHTML = "";
var pQuery = new wgs84PolygonMeasure();
pQuery.identify(
{ polygonwkt: document.getElementById("pWkt").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("面坐標、測量方式請勿空白");
document.getElementById("view").innerHTML = "";
}
}
</script>