ST_AsBinary

ST_AsBinary takes a geometry column and returns the well-known binary (WKB) representation of the geometry as a binary column.

FunctionSyntax
Pythonas_binary(geometry)
SQLST_AsBinary(geometry)
ScalaasBinary(geometry)

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

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
from geoanalytics.sql import functions as ST, Point

df = spark.createDataFrame([(Point(-178, -17),)], ["point"])

df.select(ST.as_binary("point").alias("as_binary")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+----------------------------------------------------------------+
|as_binary                                                       |
+----------------------------------------------------------------+
|[01 01 00 00 00 00 00 00 00 00 40 66 C0 00 00 00 00 00 00 31 C0]|
+----------------------------------------------------------------+

Version table

ReleaseNotes

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