首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

ArcGIS Server 导出map图片(SOAP)

2012-12-28 
ArcGIS Server 导出地图图片(SOAP)package com.esri.arcgis.sampleimport com.esri.arcgisws.EsriImageFo

ArcGIS Server 导出地图图片(SOAP)

package com.esri.arcgis.sample;import com.esri.arcgisws.EsriImageFormat;import com.esri.arcgisws.EsriImageReturnType;import com.esri.arcgisws.ImageDescription;import com.esri.arcgisws.ImageDisplay;import com.esri.arcgisws.ImageType;import com.esri.arcgisws.MapDescription;import com.esri.arcgisws.MapImage;import com.esri.arcgisws.MapServerBindingStub;import com.esri.arcgisws.MapServerInfo;public class ExportMap {public static void main(String[] args) {  // TODO Auto-generated method stub//地图服务的地址  String endpoint = "http://localhost:8399/arcgis/services/HWBaseMap/MapServer";                MapServerBindingStub mapserver;        try {           mapserver= new MapServerBindingStub(endpoint);                     MapServerInfo mapinfo = mapserver.getServerInfo(mapserver.getDefaultMapName());           MapDescription mapdesc = mapinfo.getDefaultMapDescription();                    //设置地图显示范围//           com.esri.arcgisws.MapArea ma=mapdesc.getMapArea();//           EnvelopeN envelopeN=(EnvelopeN) ma.getExtent();//           envelopeN.setXMin(800000.0);//           envelopeN.setXMax(1000000.0);//           envelopeN.setYMin(4000000.0);//           envelopeN.setYMax(4400000.0);//           ma.setExtent(envelopeN);                          //           MapLayerInfo[]layerInfos=mapinfo.getMapLayerInfos();//           MapLayerInfo[] newLayerInfos=new MapLayerInfo[layerInfos.length];//           for(int ii=0;ii<layerInfos.length;ii++){//                  newLayerInfos[ii]=layerInfos[ii];//           }//           LayerDescription[] newLayerDescriptions = new LayerDescription[newLayerInfos.length];//           LayerDescription[] layerDescriptions=mapinfo.getDefaultMapDescription().getLayerDescriptions();         //           for(int i=0;i<newLayerInfos.length;i++){//              newLayerDescriptions[i]=AGSUtil.getLayerDescription(newLayerInfos[i].getLayerID(),layerDescriptions);//              //    if(newLayerInfos[i].getName().equalsIgnoreCase("country")){//              //     newLayerDescriptions.setDefinitionExpression(sqlStr);//              //    }//          }//          mapinfo.getDefaultMapDescription().setLayerDescriptions(newLayerDescriptions);                //设置输出图片格式          ImageType imgtype = new ImageType();          imgtype.setImageFormat(EsriImageFormat.esriImageGIF);          imgtype.setImageReturnType(EsriImageReturnType.esriImageReturnURL);           ImageDisplay imgdisp = new ImageDisplay();          imgdisp.setImageHeight(600);          imgdisp.setImageWidth(800);          imgdisp.setImageDPI(96);           ImageDescription imgdesc = new ImageDescription();          imgdesc.setImageDisplay(imgdisp);          imgdesc.setImageType(imgtype);           System.out.println("imgdesc.getImageType(): "+imgdesc.getImageType().getImageFormat().getValue());          System.out.println("mapdesc.getName: "+mapdesc.getName());          System.out.println("mapserverName: "+mapserver.getDefaultMapName());          MapImage mapimg = mapserver.exportMapImage(mapdesc, imgdesc);          System.out.println("mapimg.getMapScale(): "+mapimg.getMapScale());          System.out.println("mapimg.getImageURL(): "+mapimg.getImageURL());              //   System.out.println(((EnvelopeN)mapinfo.getExtent()).getXMax());          //   System.out.println(((EnvelopeN)mapinfo.getExtent()).getXMin());          //   System.out.println(((EnvelopeN)mapinfo.getExtent()).getYMax());          //   System.out.println(((EnvelopeN)mapinfo.getExtent()).getYMin());        }catch (Exception e) {           e.printStackTrace();           System.out.println("FFFFF");        }   }}
1 楼 shenguoyang 2011-06-21   很好的文章,最近也遇到这方面的问题。楼主的附件下载不了。可以的话给我发个E-MAIL:6448822@qq.com  先谢谢了。

热点排行