Solved

Snipper does not work properly

  • 12 September 2016
  • 14 replies
  • 39 views

Badge

I want to snip the first and the last meter of a line (which is 10 meters). I therefore take a Snipper, set at "Distance (Value)" with Starting Location = 1 and Ending Location = -1. The Snipper only cuts off the first meter as a remnant, but leaves the last meter untouched. Am I doing something wrong here, or is the Snipper not working as it should?

PS: FME 2016.1

icon

Best answer by mark2atsafe 12 September 2016, 18:16

View original

14 replies

Userlevel 4

The end location is measured from the start of the line, so if you want to trim off the end you need to specify something like

@Length()-1

See also: https://knowledge.safe.com/questions/33381/shorten-line-by-fixed-distance-1.html

Badge

That might work indeed. I was however following the information I found in the help:

"Any negative value may be used to specify an ending position corresponding to the original line's final vertex."

I'm interpreting this as: -1 is counting 1 meter back from the ending point. Is this wrong than?

Userlevel 4

The end location is measured from the start of the line, so if you want to trim off the end you need to specify something like

@Length()-1

See also: https://knowledge.safe.com/questions/33381/shorten-line-by-fixed-distance-1.html

Actually, I just re-read the documentation and I found this:

 

Any negative value may be used to specify an ending position corresponding to the original line's final vertex.

 

But I cannot get it to work in either FME 2014, 2015 or 2016...

 

 

Userlevel 4

That might work indeed. I was however following the information I found in the help:

"Any negative value may be used to specify an ending position corresponding to the original line's final vertex."

I'm interpreting this as: -1 is counting 1 meter back from the ending point. Is this wrong than?

Yeah, I just saw that (see my other comment). I'm guessing it's either a bug in the Snipper or in the documentation.

 

 

Userlevel 2
Badge +17

That might work indeed. I was however following the information I found in the help:

"Any negative value may be used to specify an ending position corresponding to the original line's final vertex."

I'm interpreting this as: -1 is counting 1 meter back from the ending point. Is this wrong than?

"Any negative value may be used to specify an ending position corresponding to the original line's final vertex."

 

I think that this description means just "any negative value can be used to specify the position of the final vertex in the original line".In FME 2014 and earlier, the help says "The placeholder value "-1" may be used to specify an ending position corresponding to the original line's final vertex". However, any other negative value (e.g. -0.5, -2, -5) was also able to be used as the placeholder for the ending position actually. I guess that the documentation has been updated to fit to the actual behavior in FME 2015+.
Badge +22

That might work indeed. I was however following the information I found in the help:

"Any negative value may be used to specify an ending position corresponding to the original line's final vertex."

I'm interpreting this as: -1 is counting 1 meter back from the ending point. Is this wrong than?

My interpretation of "Any negative value may be used to specify an ending position corresponding to the original line's final vertex." is that no matter what negative value you put in Distance Mode, it will will keep the final vertex of the line.

 

 

Only if you are in Vertex mode do negative values count backwards from the end.

 

 

Userlevel 4
Badge +25

At first I thought the documentation was wrong - and badly worded since it should be "relative" not "corresponding". But now I agree with Takashi and realize that "corresponding" is the correct word.

Any negative number means "the final vertex". It's not like other transformers where -1 means 1 less than the last vertex.

So it's working correctly, but I will ask the docs team to update the help because it is difficult to understand what it means, and I think it would be very difficult if English is not your first language!

Badge +22

At first I thought the documentation was wrong - and badly worded since it should be "relative" not "corresponding". But now I agree with Takashi and realize that "corresponding" is the correct word.

Any negative number means "the final vertex". It's not like other transformers where -1 means 1 less than the last vertex.

So it's working correctly, but I will ask the docs team to update the help because it is difficult to understand what it means, and I think it would be very difficult if English is not your first language!

Minor nitpick, in other transformers -1 is the last, -2 is 1 less than the last

 

 

Userlevel 4
Badge +25

At first I thought the documentation was wrong - and badly worded since it should be "relative" not "corresponding". But now I agree with Takashi and realize that "corresponding" is the correct word.

Any negative number means "the final vertex". It's not like other transformers where -1 means 1 less than the last vertex.

So it's working correctly, but I will ask the docs team to update the help because it is difficult to understand what it means, and I think it would be very difficult if English is not your first language!

PR#72186.

 

I pasted that line of the help into a text readability tool and it came up with a grade level of 15, so it's no surprise that none of us could understand it. Hopefully we'll simplify that sentence.

 

 

Badge

At first I thought the documentation was wrong - and badly worded since it should be "relative" not "corresponding". But now I agree with Takashi and realize that "corresponding" is the correct word.

Any negative number means "the final vertex". It's not like other transformers where -1 means 1 less than the last vertex.

So it's working correctly, but I will ask the docs team to update the help because it is difficult to understand what it means, and I think it would be very difficult if English is not your first language!

Thanks for this explanation and the update :) I was not the only one here at GIM that was a bit confused by the interpretation, so I suppose changing the sentence a bit will also help other people understand it better.

 

 

Badge +7

@Mark2AtSafe @david_r et al...

I'm trying to produce a point dataset that is the mid-point of a line like this:

https://knowledge.safe.com/questions/4489/create-midpoint-of-every-line-feature.html

In FME 2017.0.1.1 (64-bit) I'm using Distance (Percentage).

I tried using Start and End Locations of 50 (i.e. trim the line by 50% from each end - therefore it shouldn't matter whether it's 50% from the start or -50% from the end) and hoping a point feature would result. But it doesn't give me that.

I've checked my source data in ArcGIS Desktop, and one line has the red vertex (the last one added - see ESRI link below) in the middle of the line. ArcGIS's Edit Sketch properties show the line has 5 parts so I think this is the deaggregation that is affecting the Snipper output (I get 5 output features for the original line). I'm sure there's an FME transformer to resolve this but I'm still looking for it(GeometryValidator doesn't seem to help).

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/creating-new-features/changing-the-edit-sketch-vertex-and-segment-symbols.htm

However, another single part line with 3 vertexes including the red vertex at the end and one vertex approximately half way along gets reduced in length by what looks like 50%, but not equally from each end. The output line appears to match the section of the original line from the red vertex at the end to the vertex in the middle.

If a 50% and -50% snip won't generate a point, my workaround would be to snip 49.9% and -49.9% then do CenterPointReplacer or similar on the tiny line that results. But I can't get this to work either. My single part line with 3 vertexes ends up the same in the output as a 50/50 snip.

Also, the documentation makes no mention of the Remnants port - please could an explanation of this be added.

Userlevel 5
Badge +25

@Mark2AtSafe @david_r et al...

I'm trying to produce a point dataset that is the mid-point of a line like this:

https://knowledge.safe.com/questions/4489/create-midpoint-of-every-line-feature.html

In FME 2017.0.1.1 (64-bit) I'm using Distance (Percentage).

I tried using Start and End Locations of 50 (i.e. trim the line by 50% from each end - therefore it shouldn't matter whether it's 50% from the start or -50% from the end) and hoping a point feature would result. But it doesn't give me that.

I've checked my source data in ArcGIS Desktop, and one line has the red vertex (the last one added - see ESRI link below) in the middle of the line. ArcGIS's Edit Sketch properties show the line has 5 parts so I think this is the deaggregation that is affecting the Snipper output (I get 5 output features for the original line). I'm sure there's an FME transformer to resolve this but I'm still looking for it(GeometryValidator doesn't seem to help).

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/creating-new-features/changing-the-edit-sketch-vertex-and-segment-symbols.htm

However, another single part line with 3 vertexes including the red vertex at the end and one vertex approximately half way along gets reduced in length by what looks like 50%, but not equally from each end. The output line appears to match the section of the original line from the red vertex at the end to the vertex in the middle.

If a 50% and -50% snip won't generate a point, my workaround would be to snip 49.9% and -49.9% then do CenterPointReplacer or similar on the tiny line that results. But I can't get this to work either. My single part line with 3 vertexes ends up the same in the output as a 50/50 snip.

Also, the documentation makes no mention of the Remnants port - please could an explanation of this be added.

Any chance you could share your data here? It sounds like there might be an issue there. You mention deaggregation happening, if there's a common attribute you can use that in the Aggregator or the LineCombiner to rebuild the lines.

 

 

Badge +7

@Mark2AtSafe @david_r et al...

I'm trying to produce a point dataset that is the mid-point of a line like this:

https://knowledge.safe.com/questions/4489/create-midpoint-of-every-line-feature.html

In FME 2017.0.1.1 (64-bit) I'm using Distance (Percentage).

I tried using Start and End Locations of 50 (i.e. trim the line by 50% from each end - therefore it shouldn't matter whether it's 50% from the start or -50% from the end) and hoping a point feature would result. But it doesn't give me that.

I've checked my source data in ArcGIS Desktop, and one line has the red vertex (the last one added - see ESRI link below) in the middle of the line. ArcGIS's Edit Sketch properties show the line has 5 parts so I think this is the deaggregation that is affecting the Snipper output (I get 5 output features for the original line). I'm sure there's an FME transformer to resolve this but I'm still looking for it(GeometryValidator doesn't seem to help).

http://desktop.arcgis.com/en/arcmap/10.3/manage-data/creating-new-features/changing-the-edit-sketch-vertex-and-segment-symbols.htm

However, another single part line with 3 vertexes including the red vertex at the end and one vertex approximately half way along gets reduced in length by what looks like 50%, but not equally from each end. The output line appears to match the section of the original line from the red vertex at the end to the vertex in the middle.

If a 50% and -50% snip won't generate a point, my workaround would be to snip 49.9% and -49.9% then do CenterPointReplacer or similar on the tiny line that results. But I can't get this to work either. My single part line with 3 vertexes ends up the same in the output as a 50/50 snip.

Also, the documentation makes no mention of the Remnants port - please could an explanation of this be added.

Thanks @redgeographics

 

Independently of your comment, I remembered that my input data had been pre-processed so I checked back and it had been through the Aggregator in a previous Workspace. I think this is where the multi-part feature came from. I'm going to look at replacing the Aggregator with LineCombiner in that previous Workspace. I ran a subset of features through the previous process using the LineCombiner instead and this works better with the Snipper.

 

However, there's still a problem with specifying negative values for the ending location, at least when using Distance (Percentage) as the Snipping Mode. I've attached an image showing the difference between specifying 49.9 and -49.9 as the Start and End Locations vs 49.9 and 50.1.

 

 

Badge +3

amazing thread..

Reply