Question

Finding a Point in a Polygon, along a Line

  • 6 December 2013
  • 3 replies
  • 3 views

Badge
Hi folks,

 

 

I have some Addresses (points), Streets (lines) and polygons for Roads and Footpaths/Sidewalks.

 

 

I have a line which represents the perpendicular dropped from the Address point to its nearest Street line.

 

 

Going along this line from the Address towards the Street it will traverse the Footpath polygon and then the Road polygon.

 

 

I would like to find the point along the line which is the midpoint of its traverse of the Footpath polygon.

 

 

Note sure how to start with this one?

 

 

cheers

 

 

IanM

3 replies

Userlevel 4
Hi,

 

 

you can use the Intersector (or the LineOnAreaOverlayer) to clip the line to the footpath polygon. Calculate the length of the part that's inside the polygon and use something like the Chopper to chop it at length / 2. Then use a CoordinateExtractor on either of the chopped segments to get the x,y values and send it to a 2DPointReplacer.

 

 

I'm sure there are lots of other ways as well, as is usually the case with FME :-)

 

 

David
Userlevel 2
Badge +17
Hi Ian,

 

 

Yes, there should be several ways to do that. I would use a Clipper (taking Footpath as CLIPPER, Line as CLIPPEE) to create line segment inside of Footpath polygon, and then use a CenterPointReplacer to get center point of the clipped line. Since the line is straight, center point (center of the bounding box) will be equal to midpoint of the line.

 

 

If you need coordinates of the midpoint as attributes, consider using a CoordinateExtracter after creating midpoint.

 

 

Takashi
Badge
Thanks for both of those - I'll have a go and see what comes out !

Reply