我的github
posts - 3243,  comments - 42,  views - 158万
复制代码
private byte[] getLayerCountByType(System.Collections.Specialized.NameValueCollection boundVariables,
            ESRI.ArcGIS.SOESupport.JsonObject operationInput,
            string outputFormat,
            string requestProperties,
            out string responseProperties) 
        {
            IMapImage mapImage = null;

            bool? shouldAdd = null;
            operationInput.TryGetAsBoolean("addlayer", out shouldAdd);

            if (shouldAdd.HasValue)
            {
                if ((bool)shouldAdd)
                {
                    if (((IMapServerInfo4)mapServerInfo).SupportsDynamicLayers)
                    {
                        IRgbColor color = new RgbColor(){ Blue = 255};

                        ISimpleLineSymbol outline = new SimpleLineSymbol(){ 
                            Color = color, 
                            Width = 1, 
                            Style = esriSimpleLineStyle.esriSLSSolid
                        };

                        ISimpleFillSymbol sfs = new SimpleFillSymbol(){ 
                            Color = color, 
                            Outline = outline, 
                            Style = esriSimpleFillStyle.esriSFSSolid
                        };
                        
                        ISimpleRenderer sr = new SimpleRenderer(){ Symbol = (ISymbol)sfs };

                        IFeatureLayerDrawingDescription featureLayerDrawingDesc = new FeatureLayerDrawingDescription(){
                            FeatureRenderer = (IFeatureRenderer)sr
                        };

                        IMapServerSourceDescription mapServerSourceDesc = new TableDataSourceDescriptionClass();
                        ((IDataSourceDescription)mapServerSourceDesc).WorkspaceID = "MyFGDB";
                        ((ITableDataSourceDescription)mapServerSourceDesc).TableName = "B";

                        IDynamicLayerDescription dynamicLayerDesc = new LayerDescriptionClass(){
                            ID = 3,
                            Visible = true,
                            DrawingDescription = (ILayerDrawingDescription)featureLayerDrawingDesc,
                            Source = mapServerSourceDesc
                        };

                        mapDesc.HonorLayerReordering = true;
                        mapDesc.LayerDescriptions.Insert(0, (ILayerDescription)dynamicLayerDesc);

                        mapImage = exportMap();
                    }    
                }
                else
                {
                    mapImage = exportMap();
                }
            }
            responseProperties = null; 
  
            JSONObject json = new JSONObject();
            json.AddString("URL", mapImage.URL);
            return Encoding.UTF8.GetBytes(json.ToJSONString(null));
        }
复制代码
复制代码
private IMapImage exportMap()
        {
            //export the map using the current map description
            IImageType imageType = new ImageType()
            {
                Format = esriImageFormat.esriImagePNG32,
                ReturnType = esriImageReturnType.esriImageReturnURL
            };

            ImageDisplay id = new ImageDisplay()
            {
                Height = 400,
                Width = 400,
                DeviceResolution = 150
            };

            //sample has this from ImageDisplay also
            IImageDescription idesc = new ImageDescriptionClass();
            idesc.Display = id;
            idesc.Type = imageType;

            return ((IMapServer4)ms).ExportMapImage((IMapDescription)mapDesc, idesc);
        }
复制代码

How to draw a dynamic layer to a map server如何在map server中添加一个动态图层呢?

This is a C# sample shows how to draw a dynamic layer in a .NET SOE. It shows how to create and use the JSONObject CoClass and IJSONObject interface.

这是一个C#例子,向你展示如何在一个.NET SOE中绘制一个动态图层。它展示了如何创建并且使用JSONObject CoClass和IJSONObject接口。

[Documentation on LayerDescription CoClass] (http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001200000rzt000000)

关于LayerDescription CoCloass请参照

Features

  • Uses IDynamicLayerDescription使用IDynamicLayerDescription
  • Uses JSONObject CoClass使用JSONObject CoClass
  • Uses IMapServerDataAccess使用IMapServerDataAccess
  • Uses IMapServerInfo使用IMapServerInfo

参考:https://github.com/NagarjunaManupati/ESRI/blob/5e14e116b093d1231ee11fa2fc0bf9882aed8ad8/arcobjects-net/add-dynamic-layer-to-map-server/NetSimpleRESTSOE.cs

 

file:///C:/Users/RATE_YU/Documents/Visual%20Studio%202010/Projects/ServerSimpleRESTSOE/ReadMe.htm

 

 不要过程,只要结果

参考:https://www.cnblogs.com/giser-whu/p/3707061.html (ArcEngine下动态数据的实现显示——GIS经常需要以高频率显示信息并能够清晰的传递地理信息。包括:以动画的方式移动物体,更新位置方位,大小,状态以及属性信息等,这些信息需要迅速更新。)

要用IE浏览器部署。。否则会出现token验证问题,不知道为什么。

 

posted on   XiaoNiuFeiTian  阅读(70)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2020-12-27 WGS84转gcj02
2020-12-27 ArcGIS Server跨域
2019-12-27 yolov3 train.py
2018-12-27 CVPR,ICCV和ECCV,计算机视觉三大顶级盛会
< 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

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