次の方法で共有


h3_try_distance

同じ解像度の 2 つの H3 セル ID 間のグリッド距離を返します。未定義の場合は None します。

対応する Databricks SQL 関数については、 h3_try_distance 関数を参照してください。

構文

from pyspark.databricks.sql import functions as dbf

dbf.h3_try_distance(col1=<col1>, col2=<col2>)

パラメーター

パラメーター タイプ Description
col1 pyspark.sql.Column または str または文字列として表される H3 セル ID。
col2 pyspark.sql.Column または str または文字列として表される H3 セル ID。

例示

from pyspark.databricks.sql import functions as dbf
df1 = spark.createDataFrame([(599686030622195711, 599686015589810175,)], ['h3l1', 'h3l2'])
df1.select(dbf.h3_try_distance('h3l1', 'h3l2').alias('result')).collect()
[Row(result=2)]
df2 = spark.createDataFrame([(644730217149254377, 644877068142171537,)], ['h3l1', 'h3l2'])
df2.select(dbf.h3_try_distance('h3l1', 'h3l2').alias('result')).collect()
[Row(result=None)]