ST_Flip

ST_Flip takes a geometry column and a string column, and returns a geometry column. The result is the input geometry flipped

around an axis using the mode specified. You can choose from the following modes:

  • 'X_AXIS'—Flip the geometries around the horizontal axis.
  • 'Y_AXIS'—Flip the geometries around the vertical axis.
  • 'BOTH_AXES'—Flip the geometries around both the horizontal and vertical axes.
FunctionSyntax
Pythonflip(geometry, mode)
SQLST_Flip(geometry, mode)
Scalaflip(geometry, mode)

For more details, go to the GeoAnalytics Engine API reference for flip.

Python and SQL Examples

PythonPythonSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

from geoanalytics.sql import functions as ST

data = [
    ("POINT (0.5 0.5)",),
    ("MULTIPOINT (4.0 4.5, 5.0 4.5, 5.5 5.0)",),
    ("LINESTRING (2.0 0.0, 3.0 1.0, 4.0 0.5)", ),
    ("POLYGON ((5.0 2.0, 6.0 1.0, 5.5 1.0, 4.0 2.0, 5.0 2.0))", )
]

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

df_flip = df.withColumn("flip", ST.flip("geometry", "X_AXIS"))

ax = df_flip.st.plot("geometry", facecolor="none", edgecolor="red")
df_flip.st.plot("flip", ax=ax, facecolor="none", edgecolor="blue")
Plotted example for ST_Flip
Plotted result for ST_Flip.

Scala Example

Scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14

import com.esri.geoanalytics.sql.{functions => ST}

case class GeometryRow(wkt: String)
val data = Seq(GeometryRow("POINT (0.5 0.5)"),
               GeometryRow("MULTIPOINT (4.0 4.5, 5.0 4.5, 5.5 5.0)"),
               GeometryRow("LINESTRING (2.0 0.0, 3.0 1.0, 4.0 0.5)"),
               GeometryRow("POLYGON ((5.0 2.0, 6.0 1.0, 5.5 1.0, 4.0 2.0, 5.0 2.0))"))

val df = spark.createDataFrame(data)
              .withColumn("geometry", ST.geomFromText($"wkt"))
              .withColumn("flip", ST.flip($"geometry", "X_AXIS"))

df.select("flip").show(truncate = false)
Result
1
2
3
4
5
6
7
8
+--------------------------------------------------+
|flip                                              |
+--------------------------------------------------+
|{"x":0.5,"y":-0.5}                                |
|{"points":[[4,-4.5],[5,-4.5],[5.5,-5]]}           |
|{"paths":[[[2,0],[3,-1],[4,-0.5]]]}               |
|{"rings":[[[5,-2],[6,-1],[5.5,-1],[4,-2],[5,-2]]]}|
+--------------------------------------------------+

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