ops Package¶
geometry
Module¶

orangery.ops.geometry.
close
(line1, line2)¶

orangery.ops.geometry.
cut_by_distance
(line, distance)¶ This line cutting function is from shapely recipes http://sgillies.net/blog/1040/shapelyrecipes/
Parameters:  line (LineString) – the line to cut.
 distance (float) – distance from beginning of line to cutting point.
Returns: array of cut line segments.
Return type: segments (LineString array)

orangery.ops.geometry.
cut_by_distances
(line, intersections)¶ Cut a line at multiple points by calculating the distance of each point along the line. Uses the cut_by_distance function.
Parameters:  line (LineString) – the line to cut.
 intersections (MultiPoint) – a MultiPoint object containing cut points
Returns: contains the line segments.
Return type: segments (MultiLineString)

orangery.ops.geometry.
cut_by_point
(line, pt)¶ A cut function that divides a line and inserts points at the cut location.
Parameters:  line (LineString) – the line to cut.
 pt (Point) – a point on the line where the cut is to be made.
Returns: array of cut line segments.
Return type: segments (LineString array)

orangery.ops.geometry.
cut_by_points
(line, intersections)¶ Cut a line at multiple points by breaking the line and inserting each point. Uses the cut_by_point function.
Parameters:  line (LineString) – the line to cut.
 intersections (MultiPoint) – a MultiPoint object containing the cut points.
Returns: contains the line segments.
Return type: segments (MultiLineString)

orangery.ops.geometry.
difference
(line1, line2, close_ends=False)¶ Create polygons from two LineString objects.
Parameters:  line1 (LineString) – a line representing the initial condition.
 line2 (LineString) – a line representing the final condition.
 close_ends (bool) – option to close open line ends with vertical line segments.
Returns: the intersections between the LineString objects. polygons (Polygon array) : the polygons between the lines. signs (int array) : contains values of +1 or 1 to identify polygons as cut or fill.
Return type: intersections (Point array)

orangery.ops.geometry.
extend
(line, pt, prepend)¶ Extends a LineString by one Point, which may be prepended at the start of the LineString, or appended at the end.
Parameters:  line (LineString) – the line to extend.
 pt (Point) – the coordinate to extend to.
 prepend (bool) – if True then prepend, else append.
Returns: the extended LineString.
Return type: newline (LineString)

orangery.ops.geometry.
project
(p1, p2, p3)¶ Project a Point, p3 onto a line between Points p1 and p2.
Uses Shapely and GEOS functions, which set distance to zero for all negative distances.
Parameters:  p1 (Point) – point at zero distance on line between p1 and p2.
 p2 (Point) – endpoint of line.
 p3 (Point) – the point to project.
Returns: the projected Point, disctance along line, offset from line, and fractional distance along line.
Return type: result (dict)

orangery.ops.geometry.
project2
(p1, p2, p3)¶ Project a Point, p3 onto a line intersecting Points p1 and p2.
Adapted from tutorial by Paul Bourke: http://paulbourke.net/geometry/pointline/ This projection function allows for points at negative distances.
Parameters:  p1 (Point) – point at zero distance on line between p1 and p2.
 p2 (Point) – endpoint on line.
 p3 (Point) – the point to project.
Returns: the projected Point, distance along line, offset from line, and fractional distance along line.
Return type: result (dict)

orangery.ops.geometry.
project_points
(points, p1, p2)¶ Project multiple points onto a line through Points p1, p2.
Parameters:  points (pandas.DataFrame) – survey data to project.
 p1 (Point) – point at zero distance on line between p1 and p2.
 p2 (Point) – endpoint of line.
Returns: DataFrame of projected points, including x, y, z, distance along line, offset from line, and fractional distance along line.
Return type: result (DataFrame)

orangery.ops.geometry.
sign
(line1, line2)¶ Determine leftright orientation of a line relative to another
Iterates over points in two lines to identify line intersections at identical coordinates. At each intersection looks ahead and projects the next coordinate from line2 onto line1, and determines whether line2 is left or right of line1. Left offsets give a negative sign representing cut; right offsets give positive sign representing fill.
Parameters:  line1 (LineString) – the line representing the initial condition.
 line2 (LineString) – the line representing the final condition.
Returns: members are positive or negative integer one.
Return type: signs (int array)

orangery.ops.geometry.
snap_to_points
(segments, intersections)¶ Snap line segment endpoints to given points
Compare segment endpoints in a MultiLineString against points in a Point array to within a given precision; if the points match then update the segment endpoint with the coordinate given in the Point array.
Parameters:  segments (MultiLineString) – the line segments to snap.
 intersections (Point array) – the points to snap to.
Returns: an updated MultiLineString.
Return type: newline (MultiLineString)

orangery.ops.geometry.
update
(line, pt, idx)¶ Update a point within a LineString
Parameters:  line (LineString) – the line to update.
 pt (Point) – the new coordinate.
 idx (int) – the integer index of the vertex to update.
Returns: the updated LineString.
Return type: newline (LineString)
text
Module¶

orangery.ops.text.
parse
(points, codebook)¶ Parses the codes in a DataFrame to extract information about points and chains of points.
Parameters:  points (DataFrame) – contains the survey data.
 codebook (dict) – a dict that describes the codes used in the survey.
Returns:  Describes the points and chains of points. Column names match keys in the codes subdict,
the added group column currently comes from the ‘comment’ field at each start command.
Return type: df (DataFrame)