Created
April 27, 2020 11:50
-
-
Save Hugheym/484c83c470be617a0efd00cddebea27c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.uber.h3core.H3Core | |
| import scala.collection.JavaConversions._ | |
| import scala.collection.JavaConverters._ | |
| object H3 extends Serializable { | |
| val instance = H3Core.newInstance() | |
| } | |
| // Return the H3 | |
| val geoToH3 = udf{ (latitude: Double, longitude: Double, resolution: Int) => | |
| H3.instance.geoToH3(latitude, longitude, resolution) | |
| } | |
| val h3ToGeoLatBoundary = udf{ | |
| (h3: Long) => H3.instance.h3ToGeoBoundary(h3).map{g=>g.lat} | |
| } | |
| val h3ToGeoLonBoundary = udf{ | |
| (h3: Long) => H3.instance.h3ToGeoBoundary(h3).map{g=>g.lng} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment