Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have lot of line objects. Some of them are smaller than some criteria.

I would like to join all lines or smaller segments of line which are smaller than 1 meter to bigger lines, keeping the attributes of the bigger line.

Any advice?

I tried to use first Tester to check length of the line objects (if it is smaller than 1 m), and than passed output goes to LineJoiner. But actually nothing happens, and lines which come from output port of LineJoiner do not have attributes as lines before (as they should have it). MAybe I complicate too much, but i thought this will be easy task.

share|improve this question
    
Could you please clarify - do you want the bigger lines to take the attributes of the smaller lines they get joined to? –  GIS-Jonathan May 21 '12 at 10:33
    
Opposite :) I need smaller lines join to bigger (1+5=6). –  Z77 May 21 '12 at 10:38
    
I know you want to merge the lines, but what do you want to happen to the attributes? Do you want to keep the attributes for the bigger line as they originally were or do you want to use the attributes from the smaller lines for new the big line? –  GIS-Jonathan May 21 '12 at 10:43
    
Keep attributes from the bigger line. –  Z77 May 21 '12 at 10:51
add comment

1 Answer 1

up vote 5 down vote accepted

You can use LineJoiner transformer with parameter List Name. But you need to do some additional data processing:

  1. Use LengthCalculator to calculate lengths.
  2. Use Sorter to sort your lines by length (numeric sort, descending).
  3. Use LineJoiner to join lines. The biggest ones first (thanks to step 2). Specify parameter List Name of the LineJoiner - some name for new list attribute.
  4. Use ListIndexer with list index 0 - to get the first joined feature (the biggest one) attributes' from the list.

Here is how it will look: model example

EDIT1:

In order to be able to join only <1m features to bigger ones we need additionally to use:

  1. Tester transformer after LengthCalculator with test: _length < 1
  2. Use SpatialFilter (tests to perform parameter: TOUCHES) after Tester to filter only that features which touch features <1m. Then perform line joining on them together with <1m features. Features that don't touch <1m, direct to output (or further processing).

Model: model2

EDIT2:

If you have <1m line that touches two big ones then they all will be joined together. If such case (<1m feature touches two or more big ones) is possible in your data then you should add some processing of such cases. Take a look at parameters Merge Attributes and Attribute Prefix of transformer SpatialFilter. Using these parameters you should be able to detect such cases and then do some additional filtering.

EDIT3:

Let's solve the case when you have two big lines touching one small (<1m). We need to take only one of the big lines to participate in joining with small one.

In order to be able to perform such filtering we need to mark these two big features with some id from small one they are touching. As stated in EDIT2, it can be done in SpatialFilter transformer using parameters Merge Attributes and Attribute Prefix.

Then use transformer DuplicateRemover to filter such duplicate features (two big) and take only one of them.

Hint: try to use Inspector transformer during creating your model and view intermediate results in any case that is not clear to you. In such way you will better understand how each of the transformers are working. Experiment with your data! :)

share|improve this answer
    
Ok. Thanl you for response. I will try this also. –  Z77 May 21 '12 at 10:53
1  
Ok, this is a more complicated task. I have updated my answer. Idea is to use SpatialFilter and test for feature TOUCH. In such way we can supply to LineJoiner only <1m features and features that they touch. –  Alex Markov May 21 '12 at 12:34
1  
Realized that even more complicated case is possible and added some info. Take a look. –  Alex Markov May 21 '12 at 12:54
1  
Further updated my answer. Take a look. –  Alex Markov May 22 '12 at 13:04
1  
By Sorter we enforce features with more length going first to LineJoiner and then it's attributes will be with index "0" in the list (see parameter List Name) and then we can move them to feature's main attributes (ListIndexer). Otherwise you can have result where small features' attributes will "dominate". You can see no difference in case if big features go first, but I shall not relate on it. –  Alex Markov May 25 '12 at 7:33
show 13 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.