<?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: How to convert lat/long to geohash in databricks using geohashTools R library in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26245#M18353</link>
    <description>&lt;P&gt;Whmmmmm. I ran installed.packages() from the command line and its shows the geohashTools package libpath as "/databricks/spark/R/lib" (version 0.3.1) so I am assuming I've got it loaded. So then I ran the following test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;lat &amp;lt;- c(24.123, 45.123)&lt;/P&gt;&lt;P&gt;long &amp;lt;- c(145.123, 130.124)&lt;/P&gt;&lt;P&gt;test &amp;lt;- gh_encode(lat, long, precision = 9L)&lt;/P&gt;&lt;P&gt;test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[1] "xhrlnr7qd" "ybh89n3ks"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the command works but the following code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# add geohash&lt;/P&gt;&lt;P&gt;my_tbl &amp;lt;- my_tbl %&amp;gt;%&lt;/P&gt;&lt;P&gt; mutate(geo_hash = gh_encode(Latitude, Longitude, precision = 9L)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;results in the following error message:&lt;/P&gt;&lt;P&gt;Error in Use("escape") : Error in UseMethod("escape") :&lt;/P&gt;&lt;P&gt; no application method for 'escape' applied to an object of class "c('my_tbl', 'tbl_lazy', 'tbl')"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm to new to databricks to have any clue what the error is trying to tell me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------&lt;/P&gt;&lt;P&gt;I just couldn't get the R gh_encode function to work on the Spark df so I ran the collect() function  and then re-ran the mutate and gh_encode functions on the R data.frame and converted back to a Spark dataframe. That appears to have worked. However not the optimal solution (need to work in the Spark dataframe) but worked.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2022 14:07:12 GMT</pubDate>
    <dc:creator>Jeff1</dc:creator>
    <dc:date>2022-03-08T14:07:12Z</dc:date>
    <item>
      <title>How to convert lat/long to geohash in databricks using geohashTools R library</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26243#M18351</link>
      <description>&lt;P&gt;I continues to receive a parsing error when attempting to convert lat/long data to a geohash in data bricks . I've tried two coding methods in R and get the same error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;library(geohashTools)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method #1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my_tbl$geo_hash &amp;lt;- gh_encode(my_tbl$Latitude, my_tbl$Longitude, precision = 9L)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method #2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my_tbl &amp;lt;- my_tbl %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mutate(geo_hash = gh_encode(Latitude, Longitude, precision = 9L))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 19:53:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26243#M18351</guid>
      <dc:creator>Jeff1</dc:creator>
      <dc:date>2022-03-07T19:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert lat/long to geohash in databricks using geohashTools R library</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26244#M18352</link>
      <description>&lt;P&gt;Please install required library in cluster settings tab -&amp;gt; libraries, than install new and install it from CRAN. I tested and after that geoHashTools worked without problem (second screenshot)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2041iC2F6AB5EEC73D0DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/2048iEE598458A9A24E6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 10:50:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26244#M18352</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-03-08T10:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert lat/long to geohash in databricks using geohashTools R library</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26245#M18353</link>
      <description>&lt;P&gt;Whmmmmm. I ran installed.packages() from the command line and its shows the geohashTools package libpath as "/databricks/spark/R/lib" (version 0.3.1) so I am assuming I've got it loaded. So then I ran the following test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%r&lt;/P&gt;&lt;P&gt;lat &amp;lt;- c(24.123, 45.123)&lt;/P&gt;&lt;P&gt;long &amp;lt;- c(145.123, 130.124)&lt;/P&gt;&lt;P&gt;test &amp;lt;- gh_encode(lat, long, precision = 9L)&lt;/P&gt;&lt;P&gt;test&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[1] "xhrlnr7qd" "ybh89n3ks"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the command works but the following code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# add geohash&lt;/P&gt;&lt;P&gt;my_tbl &amp;lt;- my_tbl %&amp;gt;%&lt;/P&gt;&lt;P&gt; mutate(geo_hash = gh_encode(Latitude, Longitude, precision = 9L)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;results in the following error message:&lt;/P&gt;&lt;P&gt;Error in Use("escape") : Error in UseMethod("escape") :&lt;/P&gt;&lt;P&gt; no application method for 'escape' applied to an object of class "c('my_tbl', 'tbl_lazy', 'tbl')"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm to new to databricks to have any clue what the error is trying to tell me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------&lt;/P&gt;&lt;P&gt;I just couldn't get the R gh_encode function to work on the Spark df so I ran the collect() function  and then re-ran the mutate and gh_encode functions on the R data.frame and converted back to a Spark dataframe. That appears to have worked. However not the optimal solution (need to work in the Spark dataframe) but worked.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 14:07:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26245#M18353</guid>
      <dc:creator>Jeff1</dc:creator>
      <dc:date>2022-03-08T14:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert lat/long to geohash in databricks using geohashTools R library</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26246#M18354</link>
      <description>&lt;P&gt;The problem was I was trying to run the gh_encode function on a Spark dataframe.  I needed to collect the date into a R dataframe then run the function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 14:05:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-convert-lat-long-to-geohash-in-databricks-using/m-p/26246#M18354</guid>
      <dc:creator>Jeff1</dc:creator>
      <dc:date>2022-03-17T14:05:31Z</dc:date>
    </item>
  </channel>
</rss>

