Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created July 9, 2013 03:40
Show Gist options
  • Select an option

  • Save levinotik/5954524 to your computer and use it in GitHub Desktop.

Select an option

Save levinotik/5954524 to your computer and use it in GitHub Desktop.
case class GeoData(geocode: GoogleGeocodeResult, elevation: GoogleApiResult[Elevation]) {
def city: Option[String] = {
if (geocode.results.isEmpty) {
None
} else if (geocode.results.head.address_components.isEmpty) {
None
} else {
geocode.results.head.address_components.find(a=> a.types.contains("neighborhood")) match {
case None => None
case Some(result) => Some(result.long_name)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment