ST_GeodesicDensify takes a geometry column and a numeric max value and returns a geometry column. This
function adds vertices along linestrings or polygons to create densified approximations of geodesic segments with each
segment being no longer than max. The max should be specified in meters and greater
than zero. This function is more accurate but less performant than ST_Densify
and requires that a spatial reference is set on the input geometry column. To learn more about the difference between
planar and geodesic calculations, see Coordinate systems and transformations.
| Function | Syntax |
|---|---|
| Python | geodesic |
| SQL | ST |
| Scala | geodesic |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for geodesic_densify.
Examples
from geoanalytics_fabric.sql import functions as ST
LINE_WKT = 'LINESTRING (117.61983168124925 34.061452833142205, 117.43262450694835 34.198818997647145)'
df = spark.createDataFrame([(LINE_WKT,)], ['wkt']) \
.withColumn("line", ST.line_from_text("wkt", 4326))
df.select(ST.geodesic_densify("line", 10000).alias("geodesic_densified")).show(truncate = False)+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|geodesic_densified |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|{"paths":[[[117.61983168124925,34.061452833142205],[117.55749656079557,34.10727359287857],[117.49509421655945,34.153062343775964],[117.43262450694834,34.198818997647145]]]}|
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+Version table
| Release | Notes |
|---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |