Shrink Lines — GP Tool

2095
23
03-20-2023 10:24 AM
Status: Open
Labels (1)
Bud
by
Honored Contributor

It would be helpful if there were an OOTB geoprocessing tool for shrinking lines at each end. By a measure or a percentage.

Bud_0-1679333021202.png

It would also be good if the tool could stretch out lines too -- using the angle of the last segment at each end. Or make that separate GP tool.

Thanks.

Related: Batch shrink lines at each end

23 Comments
Bud
by

@SeanLim 

Just a heads up:
There seems to be a quirk where the Use Percentage parameter is mandatory -- even though leaving it unchecked is a valid scenario.

Bud_0-1679555461725.png

But I can work around it by enabling that parameter, then disabling it.

Bud
by

Hi @SeanLim, I haven't been able to get the percentage option working. The lines in the output feature class don't get shrunk -- they're just copies of the original lines.

But if I use the measurement option, then that works well.

Here's a video:

Thoughts? Thanks!


Edit:
Never mind. I see now that the percentage needs to be a decimal like 0.3. Not 30 percent.
Using .3 works as expected:

Bud_0-1679577084974.png

 

SeanLim

Hi @Bud, thanks for the great feedback. I've reworked the tool according to your feedback, here are some new things:

  • The tool will now skip lines that have <Null> lengths. It won't throw any more errors for <Null>s.
  • The Method parameter replaced the Use Percentage parameter so that you can choose between Percentage and Length. It defaults to Percentage.
  • Some rearranging of the parameters and some safeguards were added to prevent errors.

For more information on how each parameter works, you can hover your cursor over the parameters to read the tooltips. Let me know if you have any questions/feedback.

Updated tool: https://arcg.is/9H8S8

 

Bud
by

@SeanLim The new version looks good! Thanks.

Regarding the Percentage/Length parameters: Out of curiosity, if the parameters are optional, then why is the default value of 0 necessary?
And have you considered making those parameters mandatory? I don't have a strong opinion either way, just curious what the thought is behind those parameters.

SeanLim

@BudI put the default value as 0 so that the user is less likely to run the tool without an input causing an error.

The parameters are Optional since they can't both be Required (since picking one over the other in Method hides the other one and the user wouldn't be able to fill out the other hidden parameter--which would cause an error).

Edit: if there's anything you would like me to add that would make the tool more convenient for your use, please let me know.

Bud
by

@SeanLim 

Regarding the Percentage parameter:
I know you have a tooltip explaining that parameter. But I wonder if a more descriptive name would help avoid confusion. Instead of labeling that parameter as "Percentage", what if you called it "Percentage (as decimal)", or something like that?

Related: Correct term for percentage in decimal form


Also, I wonder if this blurb in the Percentage tooltip could be clarified:

This value will determine the percentage to shrink the line. Values range from 0.0 to 1.0. The percentage will be applied to the entire length of the line, then the length will be halved and removed from each end of the line.

Maybe some thing like this?

This value will determine the percentage to shrink the line. Values range from 0.0 to 1.0. The percentage will be applied to the entire length of the line — half at each end of the line.

DanLee
by Esri Regular Contributor

Hi Bud,

I have suggested to Sean to label that parameter with "Percentage (%)" and accept values between 0 and 100 instead of decimal number. You are right that 0 as a default doesn't make sense; so we will change it to 1 percent as the default. @SeanLim  will give you a updated version soon.

We also would like to know if this tool solves your problem. Hope you can comment on that too. Thanks.

SeanLim

@Bud 

I have updated the following to the tool:

  • Percentage now takes numbers from 0.0 - 100.0 (Double).
  • If the tool is ran with an empty Percentage/Length input, a warning will be added after the tool is ran.
  • A negative Length value will throw an error.
  • Length and Percentage default to 10
Bud
by

Hi @SeanLim and @DanLee,

I tested the tool and it is working well.

Bud_0-1680125176928.png

The tool has solved my problem. Thanks!

SeanLim

@Bud 

That's great news, thanks for the really helpful feedback!