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");
}
}


}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值