<script language="javascript" type="text/javascript">
var lng='<%=request.getAttribute("longtitude")%>';
var lat='<%=request.getAttribute("latitude")%>';
var num='<%=request.getAttribute("num")%>';
var s;
var?array?=?new?Array(num);
for(s=0;s<num;s++)?{
array[s]=new Array(2);
}
<c:forEach items="${lnglat}" var="item" varStatus="status" >
var x=${status.index};
array[x][0]=${item.lng};
array[x][1]=${item.lat};
</c:forEach>
var map = new AMap.Map('map',{
resizeEnable: true,
zoom:6,
center: [112.562678,37.873499],
pitchEnable:true,
pitch:40
});
/*添加选择故障台站*/
var markers = array;
for(var i=0;i<array.length;i+=1) {
var center1=array[i];
var circleMarker = new AMap.CircleMarker({
center: center1,
radius:10,
strokeColor:'black',
strokeWeight:2,
strokeOpacity:0.5,
fillColor:'rgba(255,255,255,1)',
fillOpacity:0.5,
zIndex:10,
bubble:true,
cursor:'pointer',
clickable: true
});
circleMarker.setMap(map)
}
//获取数据库中最新地震信息的经纬度,绘制震中
var center=[lng,lat];
var text = new AMap.Text({
text:'震中',
textAlign:'center', // 'left' 'right', 'center',
verticalAlign:'middle', //middle 、bottom
draggable:false,
topWhenClick:true,
cursor:'pointer',
angle:0,
zIndex:130,
position: center,
style:{
'background-color':'rgba(0,0,0,0)',
'border':'solid 0px',
'padding':'3px 3px',
'font-size':'16px'
}
});
text.setMap(map);
AMapUI.loadUI(['overlay/SvgMarker'], function(SvgMarker) {
if (!SvgMarker.supportSvg) {
//当前环境并不支持SVG,此时SvgMarker会回退到父类,即SimpleMarker
alert('当前环境不支持SVG');
}
//创建一个五角星状的shape
var shape = new SvgMarker.Shape.FivePointsStar({
height: 20, //高度
fillColor: 'red'
});
//利用该shape构建SvgMarker
new SvgMarker(shape,{
zIndex: 120,
map: map,
position: center,
showPositionPoint:true
});
});
/*添加市界*/
var geojsonURL11 = 'map/JSON/SHIJIE.json';
//该GeoJson仅供本示例使用
var xhr11 = new XMLHttpRequest();
xhr11.onreadystatechange = function() {
if (xhr11.readyState === 4 && xhr11.status === 200) {
var geojson11 = new AMap.GeoJSON({
geoJSON:JSON.parse(xhr11.responseText), //geojsonObject,
'getPolygon': function(geojson11, lnglats) {//还可以自定义getMarker和getPolyline
//var area = AMap.GeometryUtil.ringArea(lnglats[0]);//求面积
return new AMap.Polygon({
map: map,
path: lnglats,
strokeColor: "#C5C1AA",//线颜色
strokeOpacity: 1,//线透明度
strokeWeight: 1,//线粗细
strokeStyle: "dashed",
fillColor: "#f5deb3",//填充颜色
fillOpacity: 0.15//填充透明度
});
}
});
geojson11.setMap(map);
}
};
xhr11.open('GET', geojsonURL11);
xhr11.send();
/*添加57个测震台站*/
var geojsonURL1 = 'map/JSON/57czsta.json';
//该GeoJson仅供本示例使用
var xhr1 = new XMLHttpRequest();
xhr1.onreadystatechange = function() {
if (xhr1.readyState === 4 && xhr1.status === 200) {
var geojson1 = new AMap.GeoJSON({
geoJSON:JSON.parse(xhr1.responseText), //geojsonObject,
'getMarker': function(geojson1, lnglats) {//还可以自定义getMarker和getPolyline
return new AMap.CircleMarker({
center: lnglats, // 圆心位置
radius: 5, //半径
strokeColor: "#3A5FCD", //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线粗细度
fillColor: "#3A5FCD", //填充颜色
fillOpacity: 1 ,//填充透明度
opacity: 0.6
});
}
});
geojson1.setMap(map);
}
};
xhr1.open('GET', geojsonURL1);
xhr1.send();
/*添加震中100km缓冲区*/
var circle = new AMap.Circle({
center: center, // 震中圆心位置
radius: 100000, //半径
strokeColor: "#F33", //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 3, //线粗细度
fillColor: "#ee2200", //填充颜色
fillOpacity: 0.35 //填充透明度
});
circle.setMap(map);
var geojsonURL23 = 'map/JSON/56qzsta.json';//添加56个强震台站
//该GeoJson仅供本示例使用
var xhr23 = new XMLHttpRequest();
xhr23.onreadystatechange = function() {
if (xhr23.readyState === 4 && xhr23.status === 200) {
var geojson23 = new AMap.GeoJSON({
geoJSON:JSON.parse(xhr23.responseText), //geojsonObject,
'getMarker': function(geojson23, lnglats) {//还可以自定义getMarker和getPolyline
return new AMap.CircleMarker({
center: lnglats, // 圆心位置
radius: 4, //半径
strokeColor: "#66CD00", //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线粗细度
fillColor: "#66CD00", //填充颜色
fillOpacity: 1 ,//填充透明度
opacity: 0.6
});
}
});
geojson23.setMap(map);
}
};
xhr23.open('GET', geojsonURL23);
xhr23.send();
</script>