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 Engine API reference for shear.

Python and SQL Examples

PythonPythonSQL
1
2
3
4
5
6
7
8
9
10
11
12

from geoanalytics.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
1
2
3
4
5
6
7
8
9
10
11
12

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
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.2.0

Python and SQL functions introduced

1.5.0

Scala function introduced

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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close