LineString
This class represents a linear geometry composed of a sequence of points. It supports initialization from various data structures including lists, tuples, NumPy arrays, or Point objects, requiring a minimum of two coordinates. The class provides sequence-like interfaces to access and iterate over coordinates, with support for both 2D and 3D spatial data.
Attributes
| Attribute | Type | Description |
|---|---|---|
| has_cs | boolean = true | A boolean flag indicating that this geometry class utilizes a coordinate sequence for internal storage. |
| coords | tuple | Return a tuple version of the geometry from the coordinate sequence. |
Constructor
Signature
def LineString(
*args: Any,
**kwargs: Any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| *args | Any | A variable number of arguments which can be a single sequence of coordinates or multiple individual coordinate arguments. |
| **kwargs | Any | Keyword arguments, specifically supporting 'srid' to define the Spatial Reference Identifier. |
Signature
def LineString(
*args: Any,
**kwargs: Any
)
Parameters
| Name | Type | Description |
|---|---|---|
| *args | Any | A sequence of coordinates or Point objects used to define the LineString path. |
| **kwargs | Any | Keyword arguments, such as 'srid' to define the spatial reference system identifier. |
Methods
tuple()
@classmethod
def tuple() - > tuple
Return a tuple version of the geometry from the coordinate sequence.
Returns
| Type | Description |
|---|---|
tuple | A nested tuple containing all coordinates of the LineString. |
array()
@classmethod
def array() - > numpy.ndarray
Return a numpy array for the LineString.
Returns
| Type | Description |
|---|---|
numpy.ndarray | A NumPy array representation of all coordinates in the LineString. |
x()
@classmethod
def x() - > list | numpy.ndarray
Return a list or numpy array of the X variable.
Returns
| Type | Description |
|---|---|
| `list | numpy.ndarray` |
y()
@classmethod
def y() - > list | numpy.ndarray
Return a list or numpy array of the Y variable.
Returns
| Type | Description |
|---|---|
| `list | numpy.ndarray` |
z()
@classmethod
def z() - > list | numpy.ndarray | None
Return a list or numpy array of the Z variable.
Returns
| Type | Description |
|---|---|
| `list | numpy.ndarray |