Arc Strings in Python

class sphersgeo.ArcString(points: MultiSphericalPoint, closed: bool = False)

series of great circle arcs across the sphere, which can be open at the end or closed (returns to the initial point)

A great circle arc is the shortest geodesic distance over the surface of the sphere between any two points. Arcstrings are comprised of an ordered collection of spherical points. Arcstrings can also be closed, in which case the final point is considered as connected back to the first point.

Create an ArcString from a MultiSphericalPoint:

from sphersgeo import ArcString, MultiSphericalPoint

abc = ArcString(
    MultiSphericalPoint([(60.0, 0.0), (60.0, 30.0), (-30.0, -30.0)]), closed=True
)

... or from the inputs required to make a MultiSphericalPoint:

from sphersgeo import ArcString

de = ArcString(
    [
        (0.0, 0.0, 1.0),
        (0.0, 0.0, -1.0),
    ]
)
property lengths: numpy.ndarray[tuple[Any], numpy.dtype[numpy.float64]]

angle subtended on the sphere by each arc

property midpoints: MultiSphericalPoint

midpoints of each arc

property arcs: list[ArcString]

decomposes this arcstring into individual arcs of 2 points each

property closed: bool

whether this arcstring is “closed” (the last vertex is considered connected to the first)

property crosses_self: bool

whether this arcstring crosses itself

property crossings_with_self: MultiSphericalPoint

points at which this arcstring crosses itself

adjoins(other: ArcString) bool

whether this arcstring shares endpoints with another (ignoring closed arcstrings which have no endpoints)

join(other: ArcString) ArcString | None

join this arcstring to another

simplify()

remove redundant vertices that already lie along an arc in this arcstring

property boundary: MultiSphericalPoint | None

lower dimension geometry that bounds this geometry’s interior

The boundary of a polygon is a closed arcstring, the boundary of an arcstring is two endpoints (unless closed), and the boundary of a point (and a closed arcstring) is null.

property vertices: MultiSphericalPoint
property representative: SphericalPoint

point guaranteed to be within this geometry

property centroid: SphericalPoint

mean position of all possible points within this geometry

property convex_hull: SphericalPolygon | None

smallest convex polygon containing this geometry

property area: float

surface area of this geometry in square degrees

property length: float

angular length of this geometry in degrees

equals(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry’s interiors are identical and the geometry types are the same.

For further explanation of Equals see ArcGIS Equals or Shapely’s object.equals.

intersects(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry share ANY point(s). If this geometries contains, is within, crosses, touches, or overlaps the other geometry, they intersect.

For further explanation of Intersects see ArcGIS Intersects or Shapely’s object.intersects.

touches(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry share any vertices but do not overlap.

For further explanation of Touches see ArcGIS Touches or Shapely’s object.touches.

disjoint(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry do NOT share ANY point(s).

Disjoint is the inverse of Intersects.

For further explanation of Disjoint see ArcGIS Disjoint or Shapely’s object.disjoint.

crosses(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this arcstring / polygon and the other arcstring / polygon share only SOME (not all) interior points, but do NOT overlap.

Two arcstrings cross if they meet at point(s) only, and at least one of the shared points is internal to both arcstrings. An arcstring and polygon cross if they share an arcstring on the interior of the polygon, which is NOT equal to the entire arcstring.

For further explanation of Crosses see ArcGIS Crosses or Shapely’s object.crosses.

within(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether the other geometry covers this geometry AND the interiors share at least one point.

Within is the inverse of Contains.

For further explanation of Contains see ArcGIS Contains or Shapely’s object.contains.

contains(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this geometry covers the other geometry AND the interiors share at least one point.

Contains is the inverse of Within.

For further explanation of Contains see ArcGIS Contains or Shapely’s object.contains.

overlaps(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry are of the same geometry type, AND their intersection is also of the same geometry type BUT is not equal to either.

For further explanation of Overlaps see ArcGIS Overlaps or Shapely’s object.overlaps.

covers(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether the other geometry is a subset of this geometry (every point of the other geometry is a point on the interior OR boundary of this geometry).

union(other: SphericalPoint | MultiSphericalPoint) MultiSphericalPoint | None

union of points from this geometry and the other geometry

For further explanation of Union see Shapely’s object.union.

distance(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) float

shortest great-circle distance over the sphere from any part of this geometry to another

intersection(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon | None

any part of this geometry that is within another

NOTE: this function is NOT rigorous; it will ONLY return the lower order of geometry being compared and will NOT handle touching, colinear overlap, or degenerate cases

symmetric_difference(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon

points in this object not in the other geometric object, and the points in the other not in this geometric object.

Splits this geometry into a multi-geometry, at the crossing with the other geometry.

For further explanation of Symmetric Difference see Shapely’s object.symmetric_difference.

class sphersgeo.MultiArcString(arcstrings: list[ArcString])

collection of multiple series of great circle arcs (arcstrings)

Create a MultiArcString from a list of ArcString s:

from sphersgeo import ArcString, MultiArcString

abc = ArcString([(60.0, 0.0), (60.0, 30.0), (-30.0, -30.0)], closed=True)
de = ArcString([(0.0, 0.0, 1.0), (0.0, 0.0, -1.0)])
abc_de = MultiArcString([abc, de])
property parts: list[ArcString]
append(other: ArcString)

append the geometry to this collection

extend(other: MultiArcString)

extend this collection with geometries from the other collection

property boundary: MultiSphericalPoint | None

lower dimension geometry that bounds this geometry’s interior

The boundary of a polygon is a closed arcstring, the boundary of an arcstring is two endpoints (unless closed), and the boundary of a point (and a closed arcstring) is null.

property vertices: MultiSphericalPoint
property representative: SphericalPoint

point guaranteed to be within this geometry

property centroid: SphericalPoint

mean position of all possible points within this geometry

property convex_hull: SphericalPolygon | None

smallest convex polygon containing this geometry

property area: float

surface area of this geometry in square degrees

property length: float

angular length of this geometry in degrees

equals(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry’s interiors are identical and the geometry types are the same.

For further explanation of Equals see ArcGIS Equals or Shapely’s object.equals.

intersects(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry share ANY point(s). If this geometries contains, is within, crosses, touches, or overlaps the other geometry, they intersect.

For further explanation of Intersects see ArcGIS Intersects or Shapely’s object.intersects.

touches(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry share any vertices but do not overlap.

For further explanation of Touches see ArcGIS Touches or Shapely’s object.touches.

disjoint(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry do NOT share ANY point(s).

Disjoint is the inverse of Intersects.

For further explanation of Disjoint see ArcGIS Disjoint or Shapely’s object.disjoint.

crosses(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this arcstring / polygon and the other arcstring / polygon share only SOME (not all) interior points, but do NOT overlap.

Two arcstrings cross if they meet at point(s) only, and at least one of the shared points is internal to both arcstrings. An arcstring and polygon cross if they share an arcstring on the interior of the polygon, which is NOT equal to the entire arcstring.

For further explanation of Crosses see ArcGIS Crosses or Shapely’s object.crosses.

within(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether the other geometry covers this geometry AND the interiors share at least one point.

Within is the inverse of Contains.

For further explanation of Contains see ArcGIS Contains or Shapely’s object.contains.

contains(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this geometry covers the other geometry AND the interiors share at least one point.

Contains is the inverse of Within.

For further explanation of Contains see ArcGIS Contains or Shapely’s object.contains.

overlaps(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether this and the other geometry are of the same geometry type, AND their intersection is also of the same geometry type BUT is not equal to either.

For further explanation of Overlaps see ArcGIS Overlaps or Shapely’s object.overlaps.

covers(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) bool

Whether the other geometry is a subset of this geometry (every point of the other geometry is a point on the interior OR boundary of this geometry).

union(other: SphericalPoint | MultiSphericalPoint) MultiSphericalPoint | None

union of points from this geometry and the other geometry

For further explanation of Union see Shapely’s object.union.

distance(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) float

shortest great-circle distance over the sphere from any part of this geometry to another

intersection(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon | None

any part of this geometry that is within another

NOTE: this function is NOT rigorous; it will ONLY return the lower order of geometry being compared and will NOT handle touching, colinear overlap, or degenerate cases

symmetric_difference(other: SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon) SphericalPoint | MultiSphericalPoint | ArcString | MultiArcString | SphericalPolygon | MultiSphericalPolygon

points in this object not in the other geometric object, and the points in the other not in this geometric object.

Splits this geometry into a multi-geometry, at the crossing with the other geometry.

For further explanation of Symmetric Difference see Shapely’s object.symmetric_difference.