Skip to main content
Solved

IterativeSnipper - combine polylines and segment a continuous feature by a certain distance


sofia
Contributor
Forum|alt.badge.img+5
  • Contributor

I have a layer with several polylines that represents a hiking trail in southern Sweden. I need to segment this trail into equal lengths in one direction along the line, either starting from the north or the south. At one point the trail splits in two and one feature ends in the middle of another, otherwise all features are joined on the start and ending vertices of each other. The sum of lengths of the lines is 85 266.31 m.

The layer uses projected geographic coordinate system: SWEREF TM 13 30, which I believe is LatLong @david_r

I am trying to use the IterativeSnipper to cut the trail into 4000 m segments. First I tried to aggregate the polylines, since I want the lines to go in one direction, or to have one starting and one ending point. The translation failed because of invalid geometry that time. And I couldn't get the LineCombiner to work either @egomm.

And when I use only the IterativeSnipper with the below parameters, I get a result of 27 polylines with most of the features (18) having a length of 3900 to 4000 m, but the rest have much shorter lengths.

 

IterativeSnipper parameters:

  • Snipping mode: Shorten to length
  • Value: 4000

 

 

I can't seem to find any documentation on many parameters of snipper translators.

 

Thankful for any tips that you might have to achieve goal described!

/Sofia

Best answer by gio

@sofiamvalentin

 

 

First make the topology correct.

By using Snapper in end mode and then use LineCombiner (which is a LineJoiner and not a LineBuilder, for the latter combines on the order of the points)

Then a Intersector (if needed use a tolerance).

Use the IterativeSnipper.

 

Do not aggregate the objects.

 

 

View original
Did this help you find an answer to your question?

13 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 19, 2019

When you tried the LineCombiner what parameters did you use? Could you see that any lines were combined, i.e. there were less features coming out the LineCombiner than going in? I think the key thing for splitting into equal segments is to start off with one line.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • March 19, 2019

The IterativeSnipper restarts at each feature, so it needs to be one continuous feature. Aggregating will produce a multi-part feature, which will not help in this instance.

You can use the LineCombiner (what wasn't working?), which will end at the split and have separate features for each fork, but otherwise would be the simplest solution.

If the line combiner truly doesn't work, in may be possible to use the NetworkCostCalculator to add Measures to your original lines as a distance from source (start of your trail) and the snipper in Mode Measure (Value), but it will take some work to make that iterative, and join your the individual features into the 4K segments.


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 20, 2019

@jdh and @egomm

 

When I use the LineCombiner I use the default settings, se below, and the output of the translator is 5 features. The original is 10 features, so it has combined half of them.

 

 

Below is what the original features look like, but after the LineCombiner the fork looks the same way still. The only difference is that there are only a total of 5 lines in the output. In the fork this means that the highlighted line (OBJECTID:2) had become a much longer feature going north and the line with OBJECTID:3 has become longer going south.

 

 


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 20, 2019
ebygomm wrote:

When you tried the LineCombiner what parameters did you use? Could you see that any lines were combined, i.e. there were less features coming out the LineCombiner than going in? I think the key thing for splitting into equal segments is to start off with one line.

I agree, this must be why the snipping becomes random. Se more details in the new answer I posted.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 20, 2019
sofia wrote:

@jdh and @egomm

 

When I use the LineCombiner I use the default settings, se below, and the output of the translator is 5 features. The original is 10 features, so it has combined half of them.

 

 

Below is what the original features look like, but after the LineCombiner the fork looks the same way still. The only difference is that there are only a total of 5 lines in the output. In the fork this means that the highlighted line (OBJECTID:2) had become a much longer feature going north and the line with OBJECTID:3 has become longer going south.

 

 

If you remove OBJECTID 4 before the LineCombiner do you get a single line?


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 20, 2019

LineCombiner I only get to output at least 5 features from ten instead of 1.

When I try using LineBuilder I get one line output which is great! But the result is kind of crazy:

 


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 20, 2019
sofia wrote:

@jdh and @egomm

 

When I use the LineCombiner I use the default settings, se below, and the output of the translator is 5 features. The original is 10 features, so it has combined half of them.

 

 

Below is what the original features look like, but after the LineCombiner the fork looks the same way still. The only difference is that there are only a total of 5 lines in the output. In the fork this means that the highlighted line (OBJECTID:2) had become a much longer feature going north and the line with OBJECTID:3 has become longer going south.

 

 

@egomm If I remove the "loop" OBJECTID:4 then the LineCombiner gives me three lines as an output with the default parameters...

 

 


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 20, 2019

Kullaleden_uppdelning.fmw

In this workspace I have first manually reworked the line so that I have three separate lines.

  • One in which the trail ignores the fork in the road/the loop and is one line the whole way
  • One in which I have broken up the line that the fork connects to, so that there is online using that path the whole way
  • One line that represents the fork/loop

 

After dividing these lines up with an AttributeFilter, so that I can pick and choose the one I want to test, I put one (of the two complete lines) into the the IterativeSnipper

 

But the translation fails:

IterativeSnipper_Snipper_3_<Rejected>(TeeFactory): IterativeSnipper_Snipper_3_<Rejected>: Termination Message: 'IterativeSnipper_Snipper_3 output a <Rejected> feature. To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

IterativeSnipper_Snipper_3_<Rejected>: Termination Message: 'IterativeSnipper_Snipper_3 output a <Rejected> feature. To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

 

 

More details:

The below feature caused the translation to be terminated

Storing feature(s) to FME feature store file `G:\\Verksamhet\\Drift och underhåll\\4 Avdelningsstöd\\GIS-ingenjör\\Skötseldatabas\\Projekt\\Kullaleden - certifieringskartor\\Kullaleden_uppdelning_log.ffs'

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `FEATURE_TYPE'

Attribute(encoded: windows-1252): `Beskr_' has value `Kullaleden (SV om Sofiero)'

Attribute(string) : `Id' has value `1'

Attribute(64 bit real) : `Iterative_Snipper_length' has value `85231.1330886951'

Attribute(encoded: UTF-8) : `Iterative_Snipper_maxLength' has value `4000'

Attribute(string) : `Kullale_ID' has value `0'

Attribute(string) : `SHAPE_GEOMETRY' has value `shape_polyline'

Attribute(string) : `fme_feature_type' has value `Kullaleden_bearbetad_utan_loop'

Attribute(string) : `fme_geometry' has value `fme_aggregate'

Attribute(string) : `fme_rejection_code' has value `INVALID_GEOMETRY_TYPE'

Attribute(entangled: string) : `fme_type' has value `fme_line'

entangled to [SHAPE_GEOMETRY]

Attribute(32 bit integer) : `multi_reader_full_id' has value `0'

Attribute(32 bit integer) : `multi_reader_id' has value `0'

Attribute(string) : `multi_reader_keyword' has value `ESRISHAPE_1'

Attribute(string) : `multi_reader_type' has value `ESRISHAPE'

Coordinate System: `_SWEREF-99-13-30_0'

Geometry Type: IFMEMultiCurve

Number of Curves: 3


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 20, 2019
sofia wrote:

Kullaleden_uppdelning.fmw

In this workspace I have first manually reworked the line so that I have three separate lines.

  • One in which the trail ignores the fork in the road/the loop and is one line the whole way
  • One in which I have broken up the line that the fork connects to, so that there is online using that path the whole way
  • One line that represents the fork/loop

 

After dividing these lines up with an AttributeFilter, so that I can pick and choose the one I want to test, I put one (of the two complete lines) into the the IterativeSnipper

 

But the translation fails:

IterativeSnipper_Snipper_3_<Rejected>(TeeFactory): IterativeSnipper_Snipper_3_<Rejected>: Termination Message: 'IterativeSnipper_Snipper_3 output a <Rejected> feature. To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

IterativeSnipper_Snipper_3_<Rejected>: Termination Message: 'IterativeSnipper_Snipper_3 output a <Rejected> feature. To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

 

 

More details:

The below feature caused the translation to be terminated

Storing feature(s) to FME feature store file `G:\\Verksamhet\\Drift och underhåll\\4 Avdelningsstöd\\GIS-ingenjör\\Skötseldatabas\\Projekt\\Kullaleden - certifieringskartor\\Kullaleden_uppdelning_log.ffs'

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Feature Type: `FEATURE_TYPE'

Attribute(encoded: windows-1252): `Beskr_' has value `Kullaleden (SV om Sofiero)'

Attribute(string) : `Id' has value `1'

Attribute(64 bit real) : `Iterative_Snipper_length' has value `85231.1330886951'

Attribute(encoded: UTF-8) : `Iterative_Snipper_maxLength' has value `4000'

Attribute(string) : `Kullale_ID' has value `0'

Attribute(string) : `SHAPE_GEOMETRY' has value `shape_polyline'

Attribute(string) : `fme_feature_type' has value `Kullaleden_bearbetad_utan_loop'

Attribute(string) : `fme_geometry' has value `fme_aggregate'

Attribute(string) : `fme_rejection_code' has value `INVALID_GEOMETRY_TYPE'

Attribute(entangled: string) : `fme_type' has value `fme_line'

entangled to [SHAPE_GEOMETRY]

Attribute(32 bit integer) : `multi_reader_full_id' has value `0'

Attribute(32 bit integer) : `multi_reader_id' has value `0'

Attribute(string) : `multi_reader_keyword' has value `ESRISHAPE_1'

Attribute(string) : `multi_reader_type' has value `ESRISHAPE'

Coordinate System: `_SWEREF-99-13-30_0'

Geometry Type: IFMEMultiCurve

Number of Curves: 3

So the error log indicates that your geometry is still an aggregate. Even though you've separated things off into what you think are single lines, i think it's still worth using the LineCombiner beforehand with Aggregate handling set to Deaggregate


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • Best Answer
  • March 20, 2019

@sofiamvalentin

 

 

First make the topology correct.

By using Snapper in end mode and then use LineCombiner (which is a LineJoiner and not a LineBuilder, for the latter combines on the order of the points)

Then a Intersector (if needed use a tolerance).

Use the IterativeSnipper.

 

Do not aggregate the objects.

 

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • March 21, 2019

Non-single line cannot be split with equi-distance anyway. I think you have only these choices.

  • Ignore the 'double-track' (orange and blue), split only remnant two lines (the purple lines) separately.
  • Remove one track (the orange one) from the 'double-track', connect remnant three lines to form a single long line (purple - blue - purple), then split it.

Which is your desired one? If the both above don't match your requirement, please explain your requirement specifically.


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 21, 2019
takashi wrote:

Non-single line cannot be split with equi-distance anyway. I think you have only these choices.

  • Ignore the 'double-track' (orange and blue), split only remnant two lines (the purple lines) separately.
  • Remove one track (the orange one) from the 'double-track', connect remnant three lines to form a single long line (purple - blue - purple), then split it.

Which is your desired one? If the both above don't match your requirement, please explain your requirement specifically.

Yes, that is already done. What you see in the image is one blue line that goes the whole way, and one red line that goes the whole way but with the yellow detour. There is no purple line, that's just where the blue and red ones overlap. I want to create the segmentation along the blue or the red line.


sofia
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 21, 2019
gio wrote:

@sofiamvalentin

 

 

First make the topology correct.

By using Snapper in end mode and then use LineCombiner (which is a LineJoiner and not a LineBuilder, for the latter combines on the order of the points)

Then a Intersector (if needed use a tolerance).

Use the IterativeSnipper.

 

Do not aggregate the objects.

 

 

This works! With the Snapper set to End Point Snapping and with a snapping distance of 10, and then the LineJoiner, the topologi problem seems to be solved (I can't understand why there was a problem to begin with, but oh well!)

 

At the end the translation runs through to give me 22 segments: 20 lines of 3999-4000 m lengths and one segment of 1230.9 m

 

 

 

Thanks to all the suggestions and help!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings