Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial KNN example notebook - incorrect filter for the dataframe df_bldg and df_bldg_shape #438

Open
danny-db opened this issue Oct 6, 2023 · 0 comments

Comments

@danny-db
Copy link

danny-db commented Oct 6, 2023

Describe the bug
The spatial KNN notebook:
https://github.com/databrickslabs/mosaic/blob/main/notebooks/examples/python/SpatialKNN/02.%20Spatial%20KNN.py

Line 83 and 84:
df_bldg = spark.read.table("building_50k").where(mos.st_geometrytype(F.col("geom_wkt")) == "Point")
df_bldg_shape = spark.read.table("building_50k").where(mos.st_geometrytype(F.col("geom_wkt")) == "MultiPolygon")

The st_geometrytype returns POINT and MULTIPOLYGON in capital letter, therefore the correct code should be:
df_bldg = spark.read.table("building_50k").where(mos.st_geometrytype(F.col("geom_wkt")) == "POINT")
df_bldg_shape = spark.read.table("building_50k").where(mos.st_geometrytype(F.col("geom_wkt")) == "MULTIPOLYGON")

Otherwise the dataframe df_bldg and df_bldg_shape will be empty.

To Reproduce
Run the notebook

Expected behavior
df_bldg and df_bldg_shape not empty if the filter is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant