创建图层从lyrx文件
Create layer from a lyrx file
var lyrDocFromLyrxFile = new LayerDocument(@"d:\data\cities.lyrx");
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//modifying its renderer symbol to red
var r = ((CIMFeatureLayer)cimLyrDoc.LayerDefinitions[0]).Renderer as CIMSimpleRenderer;
r.Symbol.Symbol.SetColor(new CIMRGBColor() { R = 255 });
//optionally save the updates out as a file
lyrDocFromLyrxFile.Save(@"c:\data\cities_red.lyrx");
//get a json representation of the layer document and you want store away...
var aJSONString = lyrDocFromLyrxFile.AsJson();
//... and load it back when needed
lyrDocFromLyrxFile.Load(aJSONString);
cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//create a layer and add it to a map
var lcp = new LayerCreationParams(cimLyrDoc);
var lyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map, LayerPosition.AutoArrange);
根据样式文件符号化图层
Apply Symbology to a layer from a Layer file
//Note: Run within QueuedTask.Run
//Get the Layer Document from the lyrx file
var lyrDocFromLyrxFile = new LayerDocument(layerFile);
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
//Get the renderer from the layer file
var rendererFromLayerFile = ((CIMFeatureLayer)cimLyrDoc.LayerDefinitions[0]).Renderer as CIMUniqueValueRenderer;
//Apply the renderer to the feature layer
//Note: If working with a raster layer, use the SetColorizer method.
featureLayer?.SetRenderer(rendererFromLayerFile);
ArcGIS Pro lyrx使用
原创gisoracleplus ©著作权
©著作权归作者所有:来自51CTO博客作者gisoracleplus的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
html转markdown(转)
l.com/archives/6787html2text是一个Py
html ico ide -
xml转javabean转
XML 指可扩展标记语言,XML 被设计用来传输和存储数据,常用的场景是数据交换和信息配置。虽然后期随着信息技术的发展在数据交换场景的地位远不如从前,但是作为信息配置工具,特别是配置信息多和配置信息复杂的场景,依然有着比较广泛的应用。 然后闲话不多说,先上一段Java版本的xml和对象相互转
xml转javabean转 xml和bean之间的相互转换 try-with java Java中文件流的关闭问题