我的github
posts - 3243,  comments - 42,  views - 158万

将Map或Layout中的图象转出有两种方法,一种为通过IActiveView的OutPut函数,另外一种是通过IExport接口来实现。

参考:https://www.cnblogs.com/zhangjun1130/archive/2010/07/01/1768868.html(ArcGIS Engine开发系列:将地图导出为图片的两种方法(ZZ))

 

Image与byte[]之间的转换:https://www.cnblogs.com/wxm0827/p/11167170.html

复制代码
            //Image image = new Bitmap(600, 600);
            //System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
            //tagRECT rect = deviceRect;
            //IEnvelope pEnvelope = pActiveView.Extent;
            //int dpi = pExporter.Resolution;
            //pActiveView.Output(g.GetHdc().ToInt32(), dpi, ref rect, pEnvelope, null);
            ////System.Diagnostics.Debugger.Launch();
            //image.Save("D:\\arcgisserver\\directories\\arcgisoutput\\xxx\\xxx_MapServer\\1.jpg");
            //byte[] bt = null;
            //Bitmap bmp = new Bitmap(image);
            //MemoryStream mostream = new MemoryStream();
            //bmp.Save(mostream, System.Drawing.Imaging.ImageFormat.Bmp);//将图像以指定的格式存入缓存内存流
            //bt = new byte[mostream.Length];
            //mostream.Position = 0;//设置留的初始位置
            //mostream.Read(bt, 0, Convert.ToInt32(bt.Length));
            //string imgbyte = Convert.ToBase64String(bt);//图片流转字符串
JSONObject json2 = new JSONObject();
json2.AddString("URL", imgbyte);
return Encoding.UTF8.GetBytes(json2.ToJSONString(null));
复制代码

舍弃方法二:

复制代码
            //ESRI.ArcGIS.Output.IExport export = null;
            //export = new ExportPNGClass();
            //export.ExportFileName = "D:\\arcgisserver\\directories\\arcgisoutput\\xxx\\xxx_MapServer\\1.png";
            //IEnvelope pEnvelope = pActiveView.Extent;
            ////导出参数           
            //export.Resolution = 96;
            //tagRECT exportRect = new tagRECT();
            //exportRect.left = exportRect.top = 0;
            //exportRect.right = 600;
            //exportRect.bottom = 600;
            //IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
            ////输出范围
            //envelope.PutCoords(exportRect.left, exportRect.top, exportRect.right, exportRect.bottom);
            //export.PixelBounds = envelope;
            ////可用于取消操作
            ////获取handle
            //System.Int32 hDC = export.StartExporting();
            ////开始转出
            //pActiveView.Output(hDC, (System.Int16)export.Resolution, ref exportRect, pEnvelope, null);
复制代码

测试成功:https://blog.csdn.net/kone0611/article/details/70311839/

测试成功;IExporter(牟乃夏-ArcGIS Engine地理信息系统开发教程——基于C#.NET Page220)但是IExporter不能保存为png格式。。

posted on   XiaoNiuFeiTian  阅读(546)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2020-12-30 ArcGIS地理信息系统空间分析实验 数据
2020-12-30 tomcat缓存与数据库缓存的区别
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示