paleolimbot opened a new pull request, #1039:
URL: https://github.com/apache/sedona-db/pull/1039
Adds ST_HausdorffDistance backed by GEOS
```python
import sedona.db
import pandas as pd
sd = sedona.db.connect()
sd.sql("""
SELECT ST_HausdorffDistance(
ST_GeomFromText('LINESTRING (0 0, 1 1 1)'),
ST_GeomFromText('LINESTRING (0.5 0, 1 0, 1.5 1)')
) AS h
""").show()
# ┌────────────────────┐
# │ h │
# │ float64 │
# ╞════════════════════╡
# │ 0.7071067811865476 │
# └────────────────────┘
densify_values = pd.DataFrame(
{
"l": ["LINESTRING (130 0, 0 0, 0 150)"] * 4,
"r": ["LINESTRING (10 10, 10 150, 130 10)"] * 4,
"dens": [0.1, 0.25, 0.75, 1.0],
}
)
sd.create_data_frame(densify_values).to_view("t", overwrite=True)
sd.sql("""
SELECT dens, ST_HausdorffDistance(
ST_GeomFromText(l),
ST_GeomFromText(r),
dens
) as h
FROM t
""").show()
# ┌─────────┬────────────────────┐
# │ dens ┆ h │
# │ float64 ┆ float64 │
# ╞═════════╪════════════════════╡
# │ 0.1 ┆ 70.0 │
# ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
# │ 0.25 ┆ 70.0 │
# ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
# │ 0.75 ┆ 14.142135623730951 │
# ├╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
# │ 1.0 ┆ 14.142135623730951 │
# └─────────┴────────────────────┘
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]