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'd like to calculate the maximum distance between polyline features. I have a base polyline with many other polylines either touching or near the base polyline as shown in the picture. The distance I would like to calculate is from the base feature (red) to the other features (blue). Because I'm looking for maximum distance, it would be the perpendicular distance from the "peaks" of the blue polylines to the red polyline.

Calculate Max Distance

I'm using FME for this process and I can't seem to find anything that calculates maximum distances. I thought about chopping the blue lines to points using the "Chopper" transformer and calculating the distance to the base feature and then grouping by some ID and finding the maximum within that grouping. Then, possibly, put that value back into an attribute of the unchopped line. However, I'm not really sure how to do all that.

Am I on the right track? Can anyone advise of another method? Or how I can implement my method?

Thanks.

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

I agree that the NeighborFinder is the transformer to use. In your diagram I would make the Base feature the BASE in the NeighborFinder. Features A and B I would split up with the Chopper as described.

The key is to enter a name for a Tested Candidates List. This will list all of the points with their distance from the base. From there you can use a ListRangeExtractor to find the max (and min) distance.

It is very simple and would look like this:

enter image description here

The complication is that there are multiple features to test, but you need a base for each of them.

One solution would be to create a custom transformer with a loop, so you loop through each 'feature' for the same base. Alternatively - simpler but less efficient - use a Cloner transformer to create a base for each feature. You need to make sure there is an ID number for each base/feature pair and use that as a group by in the NeighborFinder.

Does that make sense? If the data volumes are not large I would go with the Cloner method as being easier to implement.

share|improve this answer
    
this seems like the way to go for me. Unfortunately, I wont be back in the office to try it until Monday. My only issue with the NeighborFinder is that I need to put in a maximum search distance. That assumes I will know roughly how far the candidates are from the base. If I put in a number too small, I will miss out on those values. I could put in a very large number, but wouldn't that affect efficiency? –  Fezter Aug 21 '12 at 0:23
    
I've attempted this method without success. I will not know how many candidate features I will have at the beginning of the process (they are generated in another part of the workspace). So, I'm not sure how to set the number of clones in the Cloner tool. Any thoughts? –  Fezter Aug 27 '12 at 5:23
add comment

Assuming that we are speaking linestring here. Explode Feature X to points and calculate closest point for point on base feature.

Count (add id) Chopper A -> NeighborFinder -> Sort (group by id and sort by _distance ) now you can create orginal linestring or split "line" after counter and use FeatureMerge after you figure highest value.

Trick is to use NeighborFinder

share|improve this answer
add comment

NeighborFinder transformer

enter image description here

"The NeighborFinder has a special "candidates only" mode for when the incoming data is all in one group, rather than two groups (base/candidate).

This mode is activated by simply making a connection to the CANDIDATE port only, and ignoring the BASE port. Then all CANDIDATEs will be compared with all other CANDIDATEs, but will not be compared to themselves."

enter image description here

Source and more information:

http://fmepedia.safe.com/articles/Samples_and_Demos/Passing-attributes-between-features-in-close-proximity

Transformer Documentation

http://fmepedia.safe.com/articles/Documentation_del/FME-Transformers

share|improve this answer
add comment

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.