Skip to content

Instantly share code, notes, and snippets.

@glaforge
Created March 28, 2023 07:23
Show Gist options
  • Save glaforge/4176e0ad13b396001c92ab5cd584b3d8 to your computer and use it in GitHub Desktop.
Save glaforge/4176e0ad13b396001c92ab5cd584b3d8 to your computer and use it in GitHub Desktop.
@Grab("com.google.openlocationcode:openlocationcode:1.0.4")
import com.google.openlocationcode.OpenLocationCode
// Eiffel Tower
def (lat, lon) = [48.8584, 2.29447]
def eiffelTowerPlusCode = OpenLocationCode.encode(lat, lon)
println "Eiffel Tower +code: ${eiffelTowerPlusCode}"
def decoded = OpenLocationCode.decode('8FW4V75V+9Q')
println "Original coord: ${decoded.centerLatitude}, ${decoded.centerLongitude}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment