ST_Densify takes a geometry column and a numeric max value and returns a geometry column. This function
adds vertices along linestrings or polygons such that every segment within the geometry is no longer than
max, using planar distance calculation. The max parameter is in the same units as the input geometry
and should be greater than zero. For example, if your input geometry is in a spatial reference that uses meters,
you should specify the max in meters.
| Function | Syntax |
|---|---|
| Python | densify(geometry, max |
| SQL | ST |
| Scala | densify(geometry, max |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for densify.
Examples
from geoanalytics_fabric.sql import functions as ST
df = spark.createDataFrame([("LINESTRING (0 0, 10 0)",)], ['wkt']) \
.withColumn("line", ST.line_from_text("wkt"))
df.select(ST.densify("line", 2.5).alias("densified")).show(truncate = False)+------------------------------------------------+
|densified |
+------------------------------------------------+
|{"paths":[[[0,0],[2.5,0],[5,0],[7.5,0],[10,0]]]}|
+------------------------------------------------+Version table
| Release | Notes |
|---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |