How to program to implement the ArcGIS pro feature "Layer Effects"

430
3
Jump to solution
10-23-2022 06:12 PM
EricJing
New Contributor III

Hi, 

I want to know how to program to implment a feature same as "Layer Effects" in ArcGIS pro as the picture shown below?

I probably need the Extention effect in my product. 

Can anyone help please?

Thanks. 

EricJing_0-1666573113401.png

 

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

There are currently no public API types for working with Symbol Layer Effects (they're on the future roadmap), but it looks like you have ArcGIS Pro therefore in the short-medium term you can...

  • Add one or more feature layers to a Map in ArcGIS Pro
  • Setup the layer symbology with symbol layer effects
  • Use the Create Mobile Map Package geoprocessing tool to create a .mmpk
  • Unzip the mmpk
  • Browse to the P20 folder and locate the .geodatabase file
  • Open the .geodatabase file in a Sqlite browser and open the GDB_ServiceItems table
  • Locate the row for the layer symbology you want to replicate and JSON copy the content of the AdvancedDrawingInfo column
  • Trim the first and last parts of the JSON:
    • e.g. `{"drawingInfo":{"renderer":` 
    • e.g. `,"scaleSymbols":true,"transparency":0,"labelingInfo":null}}`
  • This leaves you with just the Renderer JSON which you can use with Renderer.FromJson().

 

Code example:

string drawingInfoJson = "{ \"type\":\"simple\",\"symbol\":{ \"type\":\"CIMSymbolReference\",\"symbol\":{ \"type\":\"CIMPointSymbol\",\"haloSize\":1,\"scaleX\":1,\"angleAlignment\":\"Display\",\"symbolLayers\":[{ \"type\":\"CIMVectorMarker\",\"effects\":[{ \"type\":\"CIMGeometricEffectCircularSector\",\"endAngle\":45,\"radius\":30}],\"enable\":true,\"anchorPoint\":{ \"x\":0,\"y\":0,\"z\":-0.5},\"anchorPointUnits\":\"Relative\",\"dominantSizeAxis3D\":\"Z\",\"size\":30,\"billboardMode3D\":\"FaceNearPlane\",\"markerPlacement\":{ \"type\":\"CIMMarkerPlacementInsidePolygon\",\"gridType\":\"Fixed\",\"seed\":13,\"stepX\":15,\"stepY\":15,\"clipping\":\"ClipAtBoundary\",\"stdDeviationX\":7.5,\"stdDeviationY\":7.5},\"frame\":{ \"xmin\":-2.0,\"ymin\":-2.0,\"xmax\":2.0,\"ymax\":2.0},\"markerGraphics\":[{ \"type\":\"CIMMarkerGraphic\",\"geometry\":{ \"rings\":[[[0.0,2.0],[0.35,1.97],[0.68,1.88],[1.0,1.73],[1.29,1.53],[1.53,1.29],[1.73,1.0],[1.88,0.68],[1.97,0.35],[2.0,0.0],[1.97,-0.35],[1.88,-0.68],[1.73,-1.0],[1.53,-1.29],[1.29,-1.53],[1.0,-1.73],[0.68,-1.88],[0.35,-1.97],[0.0,-2.0],[-0.35,-1.97],[-0.68,-1.88],[-1.0,-1.73],[-1.29,-1.53],[-1.53,-1.29],[-1.73,-1.0],[-1.88,-0.68],[-1.97,-0.35],[-2.0,-0.0],[-1.97,0.35],[-1.88,0.68],[-1.73,1.0],[-1.53,1.29],[-1.29,1.53],[-1.0,1.73],[-0.68,1.88],[-0.35,1.97],[0.0,2.0]]]},\"symbol\":{ \"type\":\"CIMPolygonSymbol\",\"symbolLayers\":[{ \"type\":\"CIMSolidStroke\",\"enable\":true,\"capStyle\":\"Round\",\"joinStyle\":\"Round\",\"lineStyle3D\":\"Strip\",\"miterLimit\":10,\"width\":0,\"color\":[0,0,0,0]},{ \"type\":\"CIMSolidFill\",\"enable\":true,\"color\":[138,73,50,255]}]} }],\"scaleSymbolsProportionally\":true,\"respectFrame\":true}]} } }";
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.Renderer = Renderer.FromJson(drawingInfoJson);
Graphic graphic = new Graphic(new MapPoint(0, 0, 0, SpatialReferences.Wgs84));
graphicsOverlay.Graphics.Add(graphic);
mapView.GraphicsOverlays.Add(graphicsOverlay);

 

You could go further too... and create a C# class for the JSON then export that to JSON and use in conjunction with the Renderer.FromJson method.

View solution in original post

3 Replies
MichaelBranscomb
Esri Frequent Contributor

Are you trying to implement a custom effect beyond the out-of-the-box symbol layer effects?

Use symbol effects—ArcGIS Pro | Documentation

 

0 Kudos
EricJing
New Contributor III

Thanks for reply..

I want to do it with arcgisruntime.net wpf. 

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

There are currently no public API types for working with Symbol Layer Effects (they're on the future roadmap), but it looks like you have ArcGIS Pro therefore in the short-medium term you can...

  • Add one or more feature layers to a Map in ArcGIS Pro
  • Setup the layer symbology with symbol layer effects
  • Use the Create Mobile Map Package geoprocessing tool to create a .mmpk
  • Unzip the mmpk
  • Browse to the P20 folder and locate the .geodatabase file
  • Open the .geodatabase file in a Sqlite browser and open the GDB_ServiceItems table
  • Locate the row for the layer symbology you want to replicate and JSON copy the content of the AdvancedDrawingInfo column
  • Trim the first and last parts of the JSON:
    • e.g. `{"drawingInfo":{"renderer":` 
    • e.g. `,"scaleSymbols":true,"transparency":0,"labelingInfo":null}}`
  • This leaves you with just the Renderer JSON which you can use with Renderer.FromJson().

 

Code example:

string drawingInfoJson = "{ \"type\":\"simple\",\"symbol\":{ \"type\":\"CIMSymbolReference\",\"symbol\":{ \"type\":\"CIMPointSymbol\",\"haloSize\":1,\"scaleX\":1,\"angleAlignment\":\"Display\",\"symbolLayers\":[{ \"type\":\"CIMVectorMarker\",\"effects\":[{ \"type\":\"CIMGeometricEffectCircularSector\",\"endAngle\":45,\"radius\":30}],\"enable\":true,\"anchorPoint\":{ \"x\":0,\"y\":0,\"z\":-0.5},\"anchorPointUnits\":\"Relative\",\"dominantSizeAxis3D\":\"Z\",\"size\":30,\"billboardMode3D\":\"FaceNearPlane\",\"markerPlacement\":{ \"type\":\"CIMMarkerPlacementInsidePolygon\",\"gridType\":\"Fixed\",\"seed\":13,\"stepX\":15,\"stepY\":15,\"clipping\":\"ClipAtBoundary\",\"stdDeviationX\":7.5,\"stdDeviationY\":7.5},\"frame\":{ \"xmin\":-2.0,\"ymin\":-2.0,\"xmax\":2.0,\"ymax\":2.0},\"markerGraphics\":[{ \"type\":\"CIMMarkerGraphic\",\"geometry\":{ \"rings\":[[[0.0,2.0],[0.35,1.97],[0.68,1.88],[1.0,1.73],[1.29,1.53],[1.53,1.29],[1.73,1.0],[1.88,0.68],[1.97,0.35],[2.0,0.0],[1.97,-0.35],[1.88,-0.68],[1.73,-1.0],[1.53,-1.29],[1.29,-1.53],[1.0,-1.73],[0.68,-1.88],[0.35,-1.97],[0.0,-2.0],[-0.35,-1.97],[-0.68,-1.88],[-1.0,-1.73],[-1.29,-1.53],[-1.53,-1.29],[-1.73,-1.0],[-1.88,-0.68],[-1.97,-0.35],[-2.0,-0.0],[-1.97,0.35],[-1.88,0.68],[-1.73,1.0],[-1.53,1.29],[-1.29,1.53],[-1.0,1.73],[-0.68,1.88],[-0.35,1.97],[0.0,2.0]]]},\"symbol\":{ \"type\":\"CIMPolygonSymbol\",\"symbolLayers\":[{ \"type\":\"CIMSolidStroke\",\"enable\":true,\"capStyle\":\"Round\",\"joinStyle\":\"Round\",\"lineStyle3D\":\"Strip\",\"miterLimit\":10,\"width\":0,\"color\":[0,0,0,0]},{ \"type\":\"CIMSolidFill\",\"enable\":true,\"color\":[138,73,50,255]}]} }],\"scaleSymbolsProportionally\":true,\"respectFrame\":true}]} } }";
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.Renderer = Renderer.FromJson(drawingInfoJson);
Graphic graphic = new Graphic(new MapPoint(0, 0, 0, SpatialReferences.Wgs84));
graphicsOverlay.Graphics.Add(graphic);
mapView.GraphicsOverlays.Add(graphicsOverlay);

 

You could go further too... and create a C# class for the JSON then export that to JSON and use in conjunction with the Renderer.FromJson method.