FLEX获取发布的GIS服务测站站点信息
private function getStcdFour():void
{
queryTask.url = "http://"+IPset.ArcGisIP+"/arcgis/rest/services/zhandian/MapServer/2"+"?s="+new Date().getMilliseconds().toString();
//queryTask.url = "http://"+IPset.ArcGisIP+"/arcgis/rest/services/AnhuiSt/MapServer/0"+"?s="+new Date().getMilliseconds().toString();
query.where = "stcd<>''";//stcd不为空
query.returnGeometry = true;
query.spatialRelationship = "esriSpatialRelIntersects";
//设置要查询的字段
var fields:Array = new Array();
fields.push("STCD");
fields.push("STNM");
fields.push("LGTD");
fields.push("LTTD");
fields.push("RVNM");//洪河分洪道
fields.push("HNNM");//洪河
fields.push("BSNM");//淮河
fields.push("STTP");//ZQ
query.outFields = fields;
//进行查询成功调用onResult方法,错误失败调用onFaut
queryTask.execute(query,new AsyncResponder(StcdResultD,onFault1));
}
//3-河道水位站-查询结果
private function StcdResultD(featureSet:FeatureSet,token:Object=null):void{
featureSet1=featureSet;
var geo:Geometry;
stcd="";
for each(var graphic:Graphic in featureSet.features)
{
geo = graphic.geometry;
switch(geo.type){
case Geometry.MAPPOINT:
stcd+=graphic.attributes.STCD+",";
//graphic.addEventListener(MouseEvent.CLICK,refClickFun);
graphic.addEventListener(MouseEvent.CLICK,showSPAndRainInfo2);
graphic.symbol=picSymbolC;//绿色三角
graphicsLayerD.add(graphic);
break;
}
}
stcd=stcd.substr(0,stcd.length-1);
//myService.yuLiangBaoJing(stcd);//wmf
//Alert.show("stcds:"+stcd);
//graphicsLayer.visible=true;
//设置图标显示时对应的地图层级数
var scale:int=CommonFunction.getScaleLevel(map.scale);
if(scale>=2)
{
map.addLayer(graphicsLayerD);
}
}
private function StcdResultF(featureSet:FeatureSet,token:Object=null):void{
featureSet1=featureSet;
var geo:Geometry;
nameStr="";
var i=0;
for each(var graphic:Graphic in featureSet.features)
{
++i;
geo = graphic.geometry;
switch(geo.type){
case Geometry.MAPPOINT:
var point:MapPoint=geo as MapPoint;
nameStr+=graphic.attributes.name+",";
//graphic.addEventListener(MouseEvent.CLICK,refClickFun);
graphic.addEventListener(MouseEvent.CLICK,showSPAndRainInfo2);
//graphic.symbol=picSymbolE;//
//
graphic.attributes.hsn=graphic.attributes.hsn+(Math.random()*(20-10)+10).toFixed(1).toString()+"%";
graphic.attributes.wsr=graphic.attributes.wsr+(Math.random()*(20-10)+10).toFixed(0).toString()+"天";
graphic.symbol=combSymbol;//组合symbol
//
graphicsLayerE.add(graphic);
//
var obj:Object={
id:i,
stnm:graphic.attributes.name,
lgtd:point.x.toString(),
lttd:point.y.toString(),
hsn:graphic.attributes.hsn,//含水率
wsr:graphic.attributes.wsr,//无雨日
addr:graphic.attributes.name+"所在地址"
};
soilArr.addItem(obj);
//Alert.show("x:"+point.x.toString());
break;
}
nameStr=nameStr.substr(0,nameStr.length-1);
//myService.yuLiangBaoJing(stcd);//wmf
//Alert.show("stcds:"+stcd);
//graphicsLayer.visible=true;
//设置图标显示时对应的地图层级数
var scale:int=CommonFunction.getScaleLevel(map.scale);
if(scale>=2)
{
map.addLayer(graphicsLayerE);
}
}
}