ST_Shear

ST_Shear takes a geometry column and two numbers and returns a geometry column. The result is the input geometry with its coordinates translated to a distance proportional to the original coordinate values. The proportions used for x and y coordinates are specified with the proportion_x and proportion_y parameters respectively.

FunctionSyntax
Pythonshear(geometry, proportion_x, proportion_y)
SQLST_Shear(geometry, proportion_x, proportion_y)
Scalashear(geometry, proportionX, proportionY)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for shear.

Python and SQL Examples

PythonPythonSQL
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
from geoanalytics_fabric.sql import functions as ST

data = [("POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))", )]

df = spark.createDataFrame(data, ["wkt"]) \
          .withColumn("geometry", ST.poly_from_text("wkt", srid=4326))

df_shear = df.select(ST.shear("geometry", proportion_x=0.5, proportion_y=0.5).alias("shear"))

ax = df.st.plot("geometry", facecolor="none", edgecolor="red")
df_shear.st.plot(ax=ax, facecolor="none", edgecolor="blue")
Plotted example for ST_Shear
Plotted result for ST_Shear.

Scala Example

Scala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
import com.esri.geoanalytics.sql.{functions => ST}
import org.apache.spark.sql.{functions => F}

case class GeometryRow(wkt: String)
val data = Seq(GeometryRow("POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))"))

val df = spark.createDataFrame(data)
              .withColumn("geometry", ST.geomFromText($"wkt", F.lit(4326)))
              .select(ST.shear($"geometry", 0.5, 0.5).alias("shear"))

df.show(truncate = false)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+---------------------------------------------------+
|shear                                              |
+---------------------------------------------------+
|{"rings":[[[0,0],[2.5,5],[7.5,7.5],[5,2.5],[0,0]]]}|
+---------------------------------------------------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.