Solved

Extract the middle coordinate of a three point arc

  • 21 December 2017
  • 10 replies
  • 13 views

Badge

Hi! I would like to extract the middle coordinate of a three point arc. With the ArcPropertyExtractor I only get start, end and center point coordinates. The mid point does not necessarily be in the middle of the arc, but helps to describe it, together with the start and end point.

Thanks a lot!!

icon

Best answer by takashi 22 December 2017, 11:51

View original

10 replies

Badge +2

Hi,

Have you tried snipper with vertex percentage 50-50 option along with coordinate extractor?

Userlevel 2
Badge +12

Not sure, but would the CoordinateExtractor with index 1 work?

Index 0 should be start and index 2 should be end point.

Badge

Hi,

Have you tried snipper with vertex percentage 50-50 option along with coordinate extractor?

That is unfortunately not exactly what I need. That would give me the point exact halfway of the arc. But I need the mid point that describes the form of the arc (see this link under last section "ArcBy3Points"). They explain it, but do not tell, how they calculate it.

 

 

Badge

Not sure, but would the CoordinateExtractor with index 1 work?

Index 0 should be start and index 2 should be end point.

Thanks a lot! Unfortunately that doesn't work. With index 1, the coordinates are 0. For index 0 and -1 both the center point (from the ellipse) are calculated. I find it quite difficult to extract the geometry information (which obviously is somewhere, seen in the attached picture) into an attribute.. Maybe you know more about it?

 

 

Userlevel 2
Badge +17

Hi,

Have you tried snipper with vertex percentage 50-50 option along with coordinate extractor?

The exact halfway point is also a mid-point. What kind of "mid-point" do you need?

 

 

Badge +2

Please provide example to understand better

Badge

Hi Takashi. You are right. There are indeed many points describing an arc, also the one exact halfway. In the below example (highligthed in yellow and illustrated in the arc), it is not the midpoint exact halfway, but somewhere between start and end point. Somehow, fme gets this coordinate from the incoming data, but I cannot find, where to extract this information from the IFMEArc geometry. Is this at all possible?

Badge

Please provide example to understand better

Hi! Attached a screenshot of the problem. You see, the arc has a mid point, which is not exactly half way, but also given in the geometry. And I'd like to extract the coordinates of this red point ("Mid Point") to a new attribute. All I can extract with CoordinateConcatenator is Start, End and Center Point (the last one is the middle of the ellipse).

 

example-fme.png

 

 

Userlevel 2
Badge +17

Hi @schulthesskatha, if the arc was made of three points, a PythonCaller with this script extracts the coordinates of the mid-point. Otherwise, the method "getMidPoint()" returns interpolated half way point.

# PythonCaller Script Example
import fmeobjects
def extractMidPointOfArc(feature):
    arc = feature.getGeometry()
    if isinstance(arc, fmeobjects.FMEArc):
        coord = arc.getMidPoint().getXYZ()
        feature.setAttribute('_x', coord[0])
        feature.setAttribute('_y', coord[1])

See the Python FME Objects API Reference (fmeobjects.FMEArc class) to learn more.

Badge

Hi @schulthesskatha, if the arc was made of three points, a PythonCaller with this script extracts the coordinates of the mid-point. Otherwise, the method "getMidPoint()" returns interpolated half way point.

# PythonCaller Script Example
import fmeobjects
def extractMidPointOfArc(feature):
    arc = feature.getGeometry()
    if isinstance(arc, fmeobjects.FMEArc):
        coord = arc.getMidPoint().getXYZ()
        feature.setAttribute('_x', coord[0])
        feature.setAttribute('_y', coord[1])

See the Python FME Objects API Reference (fmeobjects.FMEArc class) to learn more.

Hi Takashi! It worked!! Thanks a lot, I'm very happy :)

 

 

Reply