日期:2014-05-16 浏览次数:20802 次
type: "POST",
contentType: 'application/json',
url: "WebMethods.aspx/GetAllSoilUse",
data: "{}",
dataType: 'json', //返回的类型为Json
//画多边形函数
function drawOverlay(SoilUse) {
//定义多边形的坐标点数组
var coordinates = [];
//多边形的坐标点数组从json数据中获取
var zuoBiao = [];
zuoBiao = SoilUse.SoilPosition.split(";");
for (var i = 0; i < zuoBiao.length - 1; i++) {
coordinates.push(new google.maps.LatLng(zuoBiao[i].substr(0, zuoBiao[i].indexOf(",")), zuoBiao[i].substr(zuoBiao[i].indexOf(",") + 1)));
}
//设置多边形参数
var polygon = new google.maps.Polygon({
path: coordinates,
strokeColor: SoilUse.STypeColor,
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: SoilUse.STypeColor,
fillOpacity: 0.35
});
//将多边形显示在地图上
polygon.setMap(map);
//将多边形放入查询结果数组中
SoilUsePolygons.push(polygon);
//定义信息窗口(显示当前点击的多边形土地块的基本信息)
var infowindow = new google.maps.InfoWindow({
content: '<div id="content"><div class="title">土地名称:<strong>' + SoilUse.SoilName + '</strong></div>' +
'<div class="bodyContent"><div>土地类型:' + SoilUse.SoilTypeName + '</div><div>土地面积:' + SoilUse.SoilArea + 'km<sup>2</sup></div><div>发布时间:' + SoilUse.Time + '</div></div></div>'
&