ST_PointFromShape

ST_PointFromShape takes a binary column and returns a point column. The input binary column must contain the shapefile representation of point geometries. You can optionally specify a spatial reference for the result point column. The sr parameter value must be a valid SRID or WKT string. If a point cannot be created from the input binary the function will return null.

FunctionSyntax
Pythonpoint_from_shape(shp,sr=None)
SQLST_PointFromShape(shp,sr)
ScalapointFromShape(shp,sr)

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

Examples

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

point_shape = bytearray(b'\x01\x00\x00\x00^\xbaI\x0c\x02\x03R\xc0L7\x89A`\xa5H\xc0')

df = spark.createDataFrame([(point_shape, )], ["shape"])

df.select(ST.point_from_shape("shape", sr=4326).alias("point_from_shape")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+-------------------------+
|point_from_shape         |
+-------------------------+
|{"x":-72.047,"y":-49.292}|
+-------------------------+

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.