Select to view content in your preferred language

How to use the symbol layer cut effect?

291
7
Jump to solution
2 weeks ago
DuncanHornby
MVP Notable Contributor

Hi Community,

I want to try and utilise the cartographic effects that ArcPro 3.5 has to symbolise my data without having to alter the underlying geometry.

To set the scene, here is my data. The purple cross section lines are compose of two vertices and they always intersect the black point on the blue line, but note there is no vertex at that location. I show one line selected in edit mode to prove this.

DuncanHornby_0-1762887036332.png

I want to use one of the many cool symbol effects that ArcPro has to create a two colour line, say going from red to blue changing colour at that black point, something like below.

DuncanHornby_1-1762887298192.png

Now one approach, because I know no better, is to actually split the line at the black point and colour up individually, but I don't want to do that, I want my line whole, composed of only two vertices intersecting the black point.

Encoded into each line is the percentage along the line the black point is, its always from left to right.

Having spent hours looking at the help file, which is poorly documented and I even tried the new AI assistant I have been unable to achieve the effect I desire.  I've explored the cut effect and the suppress effect. The suppress effect requires control points but I don't want additional vertices in the lines.

The cut effect seems to alter the appearance as one zooms in/out and its units (pt) I cannot seem to associate with the black points position even though I have turned on symbol property connection.

I thought this would be a relatively simple symbology effect but I have failed completely to achieve it! May be I am barking up the wrong tree with my choice of symbol effect? Or this is an effect that is not supported? May be there is some other crafty way of doing this?

Can anyone help?

Tagging carto guru : @JohnNelsonEsri 

0 Kudos
1 Solution

Accepted Solutions
JesseWickizer
Esri Contributor

Since you're storing the percent along from the start of each line to the point, you can use the Dash effect to produce this effect. For accurate results, ensure your data is in a projected coordinate system appropriate for your map extent.

To start, Allow symbol property connections from the Symbology pane.

JesseWickizer_1-1763590980394.png

 

Next, go to the Primary symbology tab, expand the Dash effect expander, and click the data connection icon next to Dash template.

JesseWickizer_2-1763591221624.png

Paste in this Arcade expression that calculates how long the dash and gap should be based on the percent along field. If your data uses units other than meters, adjust the expressions accordingly.

//Calculate how long in map units the first dash should be (my data is in meters)
var dashMapMeters = $feature.Shape_Length * ($feature.PercentAlong / 100);
var gapMapMeters = $feature.Shape_Length - $feature.Shape_Length * ($feature.PercentAlong / 100);

// 39.3701 inches in 1 meter
var dashMapInches = dashMapMeters * 39.3701;
var gapMapInches = gapMapMeters * 39.3701;

// 72 points in 1 inch
var dashMapPoints = dashMapInches * 72;
var gapMapPoints = gapMapInches * 72;

//The dash pattern uses diplay units points, so convert the map units to display units
var dashPoints = dashMapPoints / $view.scale
var gapPoints = gapMapPoints / $view.scale

//The Dash template is a string of numbers separated by spaces. First number is the first dash, 2nd number is the first gap. 
return dashPoints + " " + gapPoints;

 Set the At line ends property to Custom.

For the different color line on the other side, duplicate the layer in the structure tab and move it below the first dash line.

JesseWickizer_3-1763591278377.png

Then change the color and either remove the dash entirely, or keep it and modify just the last line of the Arcade expression to add a zero-length dash to start the pattern:

return "0 " + dashPoints + " " + gapPoints;

The resulting lines will adjust their lengths to match the map scale as you zoom in and out.

JesseWickizer_0-1763590861010.png

View solution in original post

Tags (1)
7 Replies
RTPL_AU
Honored Contributor

Hi @DuncanHornby 

A very rough method would be to have a polygon that overlaps the part of the lines you want in one colour, and use it as clipping geometry in the map's Clip Layers properties.  

Add the line layer to the map twice.   Exclude all layers except the top line layer from being clipped. 

It will now look as if you have the lines nicely split at the boundary and you don't have to alter your 'important' data, just create a bit of supporting geometry in another dataset.

To make it play nice in a legend you'll have to add a third but not shown instance of the lines with a symbology applied that implies a 2 colour split line.

 

RTPL_AU_0-1762913153709.png

NOTE:
Add something like "USES CLIP LAYERS" to your map name or somewhere that you can see it when you open the map in 5 years. Not realising there is clipping turned on can be VERY confusing.... Allegedly..... 😅

 

DuncanHornby
MVP Notable Contributor

Hi @RTPL_AU ,

Thank you for your innovative approach, certainly ticks the box of crafty!

I feel there must be some symbol effect that would achieve what I'm looking for. The suppress effect sort of does it but relies on you individually setting vertices as control points (ain't going to happen!) and cut sounds exactly what I want but the help file is so poorly documented with no examples I can't get it to work the way I want. So either I'm messing it up or it can't do it, hence me reaching out to the user community. I hope others such as you offer further advice.

0 Kudos
JesseWickizer
Esri Contributor

Since you're storing the percent along from the start of each line to the point, you can use the Dash effect to produce this effect. For accurate results, ensure your data is in a projected coordinate system appropriate for your map extent.

To start, Allow symbol property connections from the Symbology pane.

JesseWickizer_1-1763590980394.png

 

Next, go to the Primary symbology tab, expand the Dash effect expander, and click the data connection icon next to Dash template.

JesseWickizer_2-1763591221624.png

Paste in this Arcade expression that calculates how long the dash and gap should be based on the percent along field. If your data uses units other than meters, adjust the expressions accordingly.

//Calculate how long in map units the first dash should be (my data is in meters)
var dashMapMeters = $feature.Shape_Length * ($feature.PercentAlong / 100);
var gapMapMeters = $feature.Shape_Length - $feature.Shape_Length * ($feature.PercentAlong / 100);

// 39.3701 inches in 1 meter
var dashMapInches = dashMapMeters * 39.3701;
var gapMapInches = gapMapMeters * 39.3701;

// 72 points in 1 inch
var dashMapPoints = dashMapInches * 72;
var gapMapPoints = gapMapInches * 72;

//The dash pattern uses diplay units points, so convert the map units to display units
var dashPoints = dashMapPoints / $view.scale
var gapPoints = gapMapPoints / $view.scale

//The Dash template is a string of numbers separated by spaces. First number is the first dash, 2nd number is the first gap. 
return dashPoints + " " + gapPoints;

 Set the At line ends property to Custom.

For the different color line on the other side, duplicate the layer in the structure tab and move it below the first dash line.

JesseWickizer_3-1763591278377.png

Then change the color and either remove the dash entirely, or keep it and modify just the last line of the Arcade expression to add a zero-length dash to start the pattern:

return "0 " + dashPoints + " " + gapPoints;

The resulting lines will adjust their lengths to match the map scale as you zoom in and out.

JesseWickizer_0-1763590861010.png

Tags (1)
DuncanHornby
MVP Notable Contributor

Thanks Jesse, you have earned yourself a 🍺!  I guessed this was a cartographic problem that could be solved with an effect, I was clearly on the right track but barking up the wrong tree!

So it was the dash effect I needed to tweak. I would not have known it was a conversion from metres > Inches > Points > Display Scale. So I think your solution will be valuable to others.

I should warn other users don't try to edit a geometry whilst this affect is applied, ArcPro blows up, it consumed all the RAM (all 32GB) and brought the PC to a standstill...

Another consequence is that the symbol in the contents pane  takes on a dashed appearance. Not unreasonable as that is the symbol one has created and in my case I don't need to show it so was not a problem. But if you need to add the layer symbol to a legend in a layout you'll need to consider this.

0 Kudos
JesseWickizer
Esri Contributor

@DuncanHornby, I was focused on the dash effect because initially looking at your example it looks like a dash line, but you could also achieve this with the Cut effect like you asked about in your title. 

Note that the Arcade expression is rather verbose so you can modify the unit conversions based on the units of your own data. 

While the actual line effects are overridden by the symbol property connections, the legend patch in the contents pane uses the placeholder values so you can adjust those default values to influence how it appears in the contents pane or legend.

JesseWickizer_0-1763751900322.png

 

DuncanHornby
MVP Notable Contributor

@JesseWickizer You have earned yourself another beer! Should be a good party at yours tonight. 😀 Tinkering around with the default values produced the desired patch, nice! Nothing wrong with verbose code , it makes it understandable in my opinion and that's a good thing.

I have created a simple video of ArcPro blowing up when going into edit mode for a layer with this cartographic effect active. I think it is well worth you getting your developers to watch this as it proper  cripples the PC! Click on it to enlarge.

Watch how memory is instantly consumed to the max when you go into edit mode.Watch how memory is instantly consumed to the max when you go into edit mode.

 

This is a file geodatabase feature class containing exactly 1 line which I select and do nothing more than enter edit vertices mode. I have been able to replicate this on two different  machines.

0 Kudos
RTPL_AU
Honored Contributor

@JesseWickizer  AWSOME!! 🥇🥇      but I think my method is so much easier  🙂