扩展DynamicMapServiceLayer加载服务器TIF数据

最近在做有关气象数据的项目、气象云图、雨量图等等。

所以对arcgis api for flex的DynamicMapServiceLayer进行了扩展具体代码如下

package dmPlug
{
 import com.esri.ags.Map;
 import com.esri.ags.SpatialReference;
 import com.esri.ags.geometry.Extent;
 import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
 import com.esri.ags.layers.DynamicMapServiceLayer;
 
 import flash.display.Loader;
 import flash.net.URLRequest;
 import flash.net.URLVariables;
 
 import mx.controls.Alert;
 
 public class WMSMapServiceLayer extends DynamicMapServiceLayer
 {
  internal const service:String=”WMS”;
   internal const request:String=”GetMap”
  internal const scalar:Number=1;
  public var url:String=”[serverUrl]“
  public var format:String=”image/png”;
  public var serviceName:String;
  public var urlWms:String;
  public var wmstVersion:String;
  public var styles:String;
  public var srs:String=”EPSG:4326″;
  public var transparentBG:String;
 
  public function WMSMapServiceLayer()
  {
   super();
   this.setLoaded(true);
   this.url=url;
   
   
  }
  
  
  override protected function loadMapImage(loader:Loader) : void

  {
   var mapExtent:Extent = map.extent;

   if (map.spatialReference)
   
   {
    mapExtent.spatialReference = map.spatialReference;
   }
   
   var spatialReference:SpatialReference = mapExtent.spatialReference;
   var pxHeight:Number =map.height;
   var pxWidth:Number =map.width;
   var _url:String=this.url;
   _url +”SERVICE=”+service;
   _url += “&VERSION=1.1.1”;
   _url += “&REQUEST=”+request;
   _url += “&STYLES=”;
   _url += “&layers=1”;
   _url +=”&timeStamp=2013/11/19 0:37:00″ ;
   _url += “&SRS=”+srs;
   _url += “&FORMAT=image/png”;
   _url += “&WIDTH=”+pxWidth;
   _url += “&HEIGHT=”+pxHeight;
   _url += “&BBOX=”+this.map.extent.xmin+”,”+this.map.extent.ymin+”,”+this.map.extent.xmax+”,”+this.map.extent.ymax; 

   _url += “&transparent=true”
   _url += “&token=”;
   _url += “&st=12434”
   var wmsReq:URLRequest = new URLRequest(_url);
   
   loader.load(wmsReq);
   return;
   
   
   
   
   
   
  }
  
  
  
  
  
 
  

  
 }
}

 

转载自:https://blog.csdn.net/FANHAONAN/article/details/16947405

You may also like...