span8

span4

span8

span4

- Home /
- *FME Desktop /

Good morning,

I am trying to extend lines till they intersect. I have a gap between three lines (see attached picture). I would like to extend each line using each lines same trajectory until they all intersect. Is there a way to do this programmatically? Instead of specifying a certain distance to extend the lines. So I want to find the next point along the line on the same trajectory.

I have tried using the distance formula, but I get the shortest distance to each point, but that gives me a triangle instead of T intersection.

Any guidance would be greatly appreciated! Thanks!

David

distance.png
(3.8 kB)

Comment

I went to the trouble doing these things awhile ago.

Look forum for ZeroStrokeOfsetter.

Converting algebra to parametric expression..*.the most anoying thing is the continous need to use **@Value(). It consumes most of this post's space.*.LOL.

Here is intersect:

First get start and end of lines to use. I used _t to distiguish between 2 lines.

Ix=

@Evaluate(((@Value(Sx)*@Value(Ey)-@Value(Sy)*@Value(Ex))*(@Value(Sx_t)-@Value(Ex_t))-(@Value(Sx)-@Value(Ex))*(@Value(Sx_t)*@Value(Ey_t)-@Value(Sy_t)*@Value(Ex_t)))/(((@Value(Sx)-@Value(Ex))*(@Value(Sy_t)-@Value(Ey_t))-(@Value(Sy)-@Value(Ey))*(@Value(Sx_t)-@Value(Ex_t)))*1.0))

Iy=@Evaluate(((@Value(Sx)*@Value(Ey)-@Value(Sy)*@Value(Ex))*(@Value(Sy_t)-@Value(Ey_t))-(@Value(Sy)-@Value(Ey))*(@Value(Sx_t)*@Value(Ey_t)-@Value(Sy_t)*@Value(Ex_t)))/(((@Value(Sx)-@Value(Ex))*(@Value(Sy_t)-@Value(Ey_t))-(@Value(Sy)-@Value(Ey))*(@Value(Sx_t)-@Value(Ex_t)))*1.0))

(test parallel beforehand! Very close to parallel can also get your computer crunching hard))

addendum. As it is old it still uses *1.0.

I have a couple of ideas, but have a few questions.

Are the lines that should be extended pre-identified (with say a common id) or do they need to be determined from the the complete line network?

When you have 3 lines, will they come to a perfect intersection, or is there some tolerance?

Hi @jdh,

The closest common id they have is the autocad layer name. There are multiple areas within the map that are similar. Yes, they will need to form a an intersection. The end goal will then turn the areas that they form into polygons. I am trying to use an algorithm that will find that intersection in space. I'm brushing up on some Linear Algebra to solve this but it is proving to be a bit more difficult.

Thanks!

The closest common id they have is the autocad layer name. There are multiple areas within the map that are similar. Yes, they will need to form a an intersection. The end goal will then turn the areas that they form into polygons. I am trying to use an algorithm that will find that intersection in space. I'm brushing up on some Linear Algebra to solve this but it is proving to be a bit more difficult.

Thanks!

The algebraic method to solve for the theoretical intersection of two lines defined by coordinates is:

It will work for all cases except parallel lines.

The trick is to pair the relevant lines.

I would probably use a TopologyBuilder to identify all the dangle nodes.

Bufferer->Dissolver->Counter OR

Snapper->Matcher (geometry only) (I don't know which is more efficient, but I suspect the latter)

Followed by a FeatureMerger to get a commonID for each "intersection".

A coordinateExtractor to get the last two (or first two) coordinates.

You can then use an Aggregator on the lines grouped by the commonID.

That will give you one feature per intersection, with the coordinates that can be plugged into the above equation.

You can either calculate an arbitrary pair of lines (non parallel) or all 3 potential intersections and take the average of the values.

You can then explode the aggregate and use the VertexCreator to add the intersection coordinates to the lines.

It will work for all cases except parallel lines.

The trick is to pair the relevant lines.

I would probably use a TopologyBuilder to identify all the dangle nodes.

Bufferer->Dissolver->Counter OR

Snapper->Matcher (geometry only) (I don't know which is more efficient, but I suspect the latter)

Followed by a FeatureMerger to get a commonID for each "intersection".

A coordinateExtractor to get the last two (or first two) coordinates.

You can then use an Aggregator on the lines grouped by the commonID.

That will give you one feature per intersection, with the coordinates that can be plugged into the above equation.

You can either calculate an arbitrary pair of lines (non parallel) or all 3 potential intersections and take the average of the values.

You can then explode the aggregate and use the VertexCreator to add the intersection coordinates to the lines.

Hi @david_prosack88, just an idea.

- LineExtenter: Extend the lines.
- CoordinateExtracter x 2: Extract coordinates from the end node of the Beginning line, extract coordinates from the start node of the End line.
- Bufferer: Transform the Beginning/End lines into long narrow polygons with a tiny buffer amount.
- AreaOnAreaOverlayer: Overlay those buffer areas, generate list to store the coordinates extracted by the CoordinateExtractor.
- Tester: Select overlaid area having 3 as the overlapping count attribute.
- CenterPointReplacer: Transform the selected area into its center point. Consider it as the cross point of the original three lines.
- ListExploder: Explode the list to make 3 copies of the center point.
- VertexCreator: Add vertex (x, y) which were saved with the CoordinateExtractor to connect between the center point and the original line.

Splitting lines at angles 2 Answers

Extend line in polygon to edge of this polygon 3 Answers

Cleaning the lines after intersection 5 Answers

Line to cylinder 2 Answers

NeighborFinder line 3 Answers

© 2020 Safe Software Inc | Legal

- Anonymous
- Sign in
- Create
- New Question
- New Article
- New Idea
- Spaces
- 3D (and BIM)
- Attribute Handling
- Automations (FME Server)
- CAD
- Cloud
- Coordinate Systems
- Custom Transformers
- Database
- Dynamic Workspaces
- FME Cloud API
- FME Cloud Administration
- FME Cloud Getting Started
- FME Desktop 3rd Party Integrations
- FME Desktop Administration
- FME Desktop Administration & Configuration
- FME Desktop Development
- FME Desktop Getting Started
- FME Desktop Installation
- FME Desktop Licensing
- FME Desktop Plug-In SDK
- FME Desktop Workbench Scripting
- FME Server 3rd Party Integrations
- FME Server Administration
- FME Server Administration & Configuration
- FME Server Development
- FME Server Getting Started
- FME Server Installation
- FME Server Licensing
- Fanouts
- Ideas FME Cloud
- Ideas FME Desktop: Data Inspector
- Ideas FME Desktop: Formats & Systems
- Ideas FME Desktop: Transformers
- Ideas FME Desktop: Workbench
- Ideas FME Server
- Indoor Mapping
- KML
- Lists
- Performance Tuning
- Point Cloud
- Published Parameters
- Raster
- Real-Time
- Running Multiple Workspaces
- Tabular
- Troubleshooting Techniques
- Vector / GIS
- Web
- Workflow Design
- XML / GML
- Zip Files
- *FME Desktop
- *FME Server
- *FME Cloud
- *Other
- Explore
- Topics
- Questions
- Articles
- Ideas
- Users
- Badges