ST_LineFromBinary takes a binary column and returns a linestring column.
The input binary column must contain the
well-known binary (WKB)
representation of linestring geometries. You can optionally specify a spatial reference for the result linestring column.
The sr
parameter value must be a valid SRID or WKT string.
If a linestring cannot be created from the input binary the function will return null
.
Function | Syntax |
---|---|
Python | line |
SQL | ST |
Scala | line |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for line_from_binary.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics_fabric.sql import functions as ST
line_binary= bytearray(b'\x01\x02\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00>@\x00\x00\x00\x00\x00\x00$@\x00\x00\x00\x00\x00\x00$@\x00\x00\x00\x00\x00\x00>@\x00\x00\x00\x00\x00\x00D@\x00\x00\x00\x00\x00\x00D@')
df = spark.createDataFrame([(line_binary,)], ["wkb"])
df.select(ST.line_from_binary("wkb", sr=4326).alias("line_from_binary")).show(truncate=False)
+-------------------------------------+
|line_from_binary |
+-------------------------------------+
|{"paths":[[[30,10],[10,30],[40,40]]]}|
+-------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |