Skip to main content
Question

How can I add elevation on arc without changing its structure?


arthy
Contributor
Forum|alt.badge.img+8
  • Contributor

Hello,

I would like to add elevation values on arc without changing its structure.

Before, I have this arc

0684Q00000ArCgBQAV.png

And after I would like the arc to have this where the highlighted values should be the elevation values

0684Q00000ArCU6QAN.pngSO far my idea to do that is to use

arc =feature.getGeometry()                    
feat.setStartPoint(fmeobjects.FMEPoint(feat.getStartPoint().getXYZ()[0], feat.getStartPoint().getXYZ()[1], elevation_start))                      
feat.EndStartPoint(fmeobjects.FMEPoint(feat.getEndtPoint().getXYZ()[0], feat.getEndPoint().getXYZ()[1], elevation_end]))  

but it is not working.

Any hints?

3 replies

takashi
Evangelist
  • March 18, 2019

If you need to convert an "Arc By Center Point" to an "Arc By Center Point With Ends", you can re-create required arc based on properties of the original arc using a constructor of fmboejcts.FMEArc with this signature. See the API documentation.

init(centerPoint, rotation, primaryRadius, secondaryRadius, startAngle, sweepAngle, startPoint, endPoint)

Creates an arc using the center point supplied, along with the supplied radii, angles, and points. All angles are CCW up from the horizontal, and are measured in degrees.

Parameters:    
centerPoint (FMEPoint) – The centerPoint of the arc.
rotation (float) – The rotation of the arc.
primaryRadius (float) – The primary radius of the arc.
secondaryRadius (float) – The secondary radius of the arc.
startAngle (float) – The start angle of the arc.
sweepAngle (float) – The sweep angle of the arc.
startPoint (FMEPoint) – (Optional) The start point of the arc.
endPoint (FMEPoint) – (Optional) The end point of the arc.
Return type:    
FMEArc

Returns:    
An instance of an Arc Geometry object.

e.g.

import fmeobjects
def processFeature(feature):
    arc = feature.getGeometry()
    newArc = fmeobjects.FMEArc(
        arc.getCenterPoint(),
        arc.getRotation(),
        arc.getPrimaryRadius(),
        arc.getSecondaryRadius(),
        arc.getStartAngle(),
        arc.getSweepAngle(),
        arc.getStartPoint(),
        arc.getEndPoint()
    )
    feature.setGeometry(newArc)

 


takashi
Evangelist
  • March 18, 2019
takashi wrote:

If you need to convert an "Arc By Center Point" to an "Arc By Center Point With Ends", you can re-create required arc based on properties of the original arc using a constructor of fmboejcts.FMEArc with this signature. See the API documentation.

init(centerPoint, rotation, primaryRadius, secondaryRadius, startAngle, sweepAngle, startPoint, endPoint)

Creates an arc using the center point supplied, along with the supplied radii, angles, and points. All angles are CCW up from the horizontal, and are measured in degrees.

Parameters:    
centerPoint (FMEPoint) – The centerPoint of the arc.
rotation (float) – The rotation of the arc.
primaryRadius (float) – The primary radius of the arc.
secondaryRadius (float) – The secondary radius of the arc.
startAngle (float) – The start angle of the arc.
sweepAngle (float) – The sweep angle of the arc.
startPoint (FMEPoint) – (Optional) The start point of the arc.
endPoint (FMEPoint) – (Optional) The end point of the arc.
Return type:    
FMEArc

Returns:    
An instance of an Arc Geometry object.

e.g.

import fmeobjects
def processFeature(feature):
    arc = feature.getGeometry()
    newArc = fmeobjects.FMEArc(
        arc.getCenterPoint(),
        arc.getRotation(),
        arc.getPrimaryRadius(),
        arc.getSecondaryRadius(),
        arc.getStartAngle(),
        arc.getSweepAngle(),
        arc.getStartPoint(),
        arc.getEndPoint()
    )
    feature.setGeometry(newArc)

 

This script is also possible, if you just need to set z-coordinate to start and end points.

def processFeature(feature):
    elevation_start = 100
    elevation_end = 200
    arc = feature.getGeometry()
    p0 = arc.getStartPoint()
    p1 = arc.getEndPoint()
    p0.setZ(elevation_start)
    p1.setZ(elevation_end)
    arc.setStartPoint(p0)
    arc.setEndPoint(p1)
    feature.setGeometry(arc)

arthy
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • March 19, 2019
takashi wrote:

This script is also possible, if you just need to set z-coordinate to start and end points.

def processFeature(feature):
    elevation_start = 100
    elevation_end = 200
    arc = feature.getGeometry()
    p0 = arc.getStartPoint()
    p1 = arc.getEndPoint()
    p0.setZ(elevation_start)
    p1.setZ(elevation_end)
    arc.setStartPoint(p0)
    arc.setEndPoint(p1)
    feature.setGeometry(arc)

Thanks @takashi


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings