Select to view content in your preferred language

ClippingMode

2489
9
Jump to solution
02-27-2020 09:17 AM
JamalWest2
Regular Contributor

I am attempting to set a custom definition on a map. I want to use a single feature as the clipping shape. The single feature is its own layer. I am trying to use the definition.CustomClippingShapeURI to set the shape and then setTheDefinition. As you can see below I am using a string for the URI. I got this string after using console to capture the URI using the layer before. "In other words this is how the URI is returned if I define it as a path. This doesn't work though. 

If I set ClippingMode to ClippingMode.MapExtent that works as it should.

  

var jw3 = mapFrameMap.GetDefinition()
jw3.ClippingMode = ClippingMode.CustomShape;
var lyrOfInterest = mapFrameMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
jw3.CustomClippingShapeURI = "Assessor Map/JWtest";
mapFrameMap.SetDefinition(jw3);

I have also tried.

var lyrOfInterest = mapFrameMap.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault();
var jw3 = mapFrameMap.GetDefinition();
CIMClippingPath path1 = new CIMClippingPath();
path1.Path = lyrOfInterest.URI.ToString() ;
jw3.ClippingMode = ClippingMode.CustomShape;
jw3.CustomClippingShapeURI = path1;
MessageBox.Show(jw3.CustomClippingShapeURI.ToString());
mapFrameMap.SetDefinition(jw3);

This does not work either. Does anybody know how to properly use the CustomShapeURI mode??

Wolfgang Kaiser Uma Harano Charles Macleod - Do any of you have suggestions for using CustomClippingshapeURI for ClippingMode on the map?

0 Kudos
1 Solution
9 Replies
JamalWest2
Regular Contributor

I did some further investigating on this. I created a layout with a clip shape defined and then in my code set it to show the uri of the shape which is the same layer I was trying to set by code and this is what it returned as the URI.

CIMPATH=ClipShape/421927d3f9312efaf054b5aa08f76003.dat

i'm not sure how it created that URI.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Jamal, yes, I investigated this and setting clipping on the map is not currently possible via the API. I have passed on the requirement to the mapping team. It will be targeted for release at 2.6

0 Kudos
JamalWest2
Regular Contributor

Charles,

Thanks for the reply!! I'm wondering, are you saying that using clip as an EditOperation also does not work. I have also tried using that to just clip features i want using my bounding box and it hasn't work. 

var oid = feature.GetObjectID();
// var Polygon = PolygonCreated before;
var cl1 = new EditOperation();
cl1.Name = "ClipFunction";
cl1.Clip(lyr, oid, poly, ClipMode.DiscardArea);
cl1.Execute();
0 Kudos
JamalWest2
Regular Contributor

Charles Macleod‌ I was wondering if there was a bug or report number for this issue. Also I found that this doesn't work with arcpy either. How can I go about creating a bug or ticket for that?

0 Kudos
CharlesMacleod
Esri Regular Contributor

I think we have two separate things going on here and please confirm:

1) You originally were asking can you specify a clipping polygon for the map via the API, is that right? The answer is no. You cannot and this will be added for 2.6

2) You are using EditOperation.Clip to "manually" clip features and you have encountered a bug, is that right? So no, my statement regarding 1) , map clipping, is not related. To submit a bug please contact tech support. This post may help: How to report a bug in ArcGIS Pro

Note: just looking at your code above, I believe the result you are looking for requires ClipMode.PreserveArea not DiscardArea.

0 Kudos
JamalWest2
Regular Contributor

Charles,

Yes those 2 questions were relating to separate things. What I've found now is that the issue we find in the API that you detailed in section 1 where you can not specify a clipping polygon for the map is also a problem in arcpy. Also in reference to your note, neither PreserveArea nor DiscardArea work. At this point I have just decided to just move forward.

0 Kudos
JamalWest2
Regular Contributor

@CharlesMacleod has this functionality been enabled?

0 Kudos
JamalWest2
Regular Contributor

Is this also applicable in python/arcpy? I haven't been able to find anything detailing it.

0 Kudos