<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: h3 hex ID using Databricks Mosaic is not the same as h3.geo_to_h3 in missing-QuestionPost</title>
    <link>https://community.databricks.com/t5/missing-questionpost/h3-hex-id-using-databricks-mosaic-is-not-the-same-as-h3-geo-to/m-p/3167#M59</link>
    <description>&lt;P&gt;Hi @Keval Shah​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 04:35:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-15T04:35:09Z</dc:date>
    <item>
      <title>h3 hex ID using Databricks Mosaic is not the same as h3.geo_to_h3</title>
      <link>https://community.databricks.com/t5/missing-questionpost/h3-hex-id-using-databricks-mosaic-is-not-the-same-as-h3-geo-to/m-p/3165#M57</link>
      <description>&lt;P&gt;I am testing the Databricks Mosaic Spatial Grid Indexing method to obtain the `h3 hex` of a given lat, long. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;# Get the latitude and longitude
latitude = 37.7716736
longitude = -122.4485852
&amp;nbsp;
# Get the resolution
resolution = 7
&amp;nbsp;
# Get the H3 hex ID
h3_hex_id = grid_longlatascellid(lit(latitude), lit(longitude), lit(resolution)).hex
&amp;nbsp;
# Print the H3 hex ID
print(h3_hex_id)
&amp;nbsp;
Column&amp;lt;'grid_longlatascellid(CAST(37.7716736 AS DOUBLE), CAST(-122.4485852 AS DOUBLE), 7)[hex]'&amp;gt; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;    How do I see the actual hex id in the code above? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According the d&lt;A href="https://databrickslabs.github.io/mosaic/api/spatial-indexing.html" alt="https://databrickslabs.github.io/mosaic/api/spatial-indexing.html" target="_blank"&gt;ocs&lt;/A&gt;, the `h3 hex id` returned by `grid_longlatascellid` looks different from what is returned by `h3.geo_to_h3` method.  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;h3.geo_to_h3(float(latitude), float(longitude), 7)  
&amp;nbsp;
'872830829ffffff'&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;df = spark.createDataFrame([{'lon': 30., 'lat': 10.}])
df.select(grid_longlatascellid('lon', 'lat', lit(10))).show(1, False)
+----------------------------------+
|grid_longlatascellid(lon, lat, 10)|
+----------------------------------+
|                623385352048508927|&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I obtain the `h3 hex id` using Databricks Mosaic library? I have the following imports and configurations: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import h3
from mosaic import enable_mosaic
enable_mosaic(spark, dbutils)
from mosaic import *
spark.conf.set("spark.databricks.labs.mosaic.index.system", "H3")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 18:18:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/missing-questionpost/h3-hex-id-using-databricks-mosaic-is-not-the-same-as-h3-geo-to/m-p/3165#M57</guid>
      <dc:creator>kll</dc:creator>
      <dc:date>2023-06-13T18:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: h3 hex ID using Databricks Mosaic is not the same as h3.geo_to_h3</title>
      <link>https://community.databricks.com/t5/missing-questionpost/h3-hex-id-using-databricks-mosaic-is-not-the-same-as-h3-geo-to/m-p/3167#M59</link>
      <description>&lt;P&gt;Hi @Keval Shah​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 04:35:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/missing-questionpost/h3-hex-id-using-databricks-mosaic-is-not-the-same-as-h3-geo-to/m-p/3167#M59</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-15T04:35:09Z</dc:date>
    </item>
  </channel>
</rss>

