Making Shapes: sr_shape
ΒΆ
If you have a
Shapely geometry you can
use the sr_shape
function to convert it into an
SrGeometry
instance.
The function will determine the best SrGeometry type by inspecting the Shapely base geometry.
from shapely.geometry import LineString, Polygon
from shapeit import sr_shape
geometry1 = sr_shape(
base_geometry=LineString([(2, 0), (2, 4), (3, 4)])
)
geometry2 = sr_shape(
base_geometry=Polygon([(0, 0), (1, 1), (1, 0)]),
sr=32615
)
print(f"geometry1 is a(n) {type(geometry1).__name__}.")
print(f"The SRID is {geometry1.srid}.")
print(f"geometry2 is a(n) {type(geometry2).__name__}.")
print(f"The SRID is {geometry2.srid}.")
geometry1 is a(n) SrPolyline.
The SRID is 4326.
geometry2 is a(n) SrPolygon.
The SRID is 32615.