{"id":224,"date":"2013-07-23T06:40:02","date_gmt":"2013-07-23T05:40:02","guid":{"rendered":"http:\/\/karstieltopia.com\/?p=224"},"modified":"2016-02-25T14:16:50","modified_gmt":"2016-02-25T13:16:50","slug":"obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android","status":"publish","type":"post","link":"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/","title":{"rendered":"Obtener la direcci\u00f3n a partir de unas coordenadas en Google Maps en Android"},"content":{"rendered":"

Si est\u00e1s en una de esas situaciones en que tienes la longitud \/ latitud de una posici\u00f3n y te gustar\u00eda saber a que direcci\u00f3n completa pertenece en Android, el siguiente c\u00f3digo podr\u00eda ser de utilidad ;-)<\/p>\n

Geocoder geoCoder =<\/span> new<\/span> Geocoder(<\/span>this<\/span>, Locale<\/span><\/a>.getDefault<\/span>(<\/span>)<\/span>)<\/span>;<\/span>
\n
List<\/span><\/a> <<\/span>address><\/span> matches =<\/span> geoCoder.getFromLocation<\/span>(<\/span>latitude, longitude, 1<\/span>)<\/span>;<\/span>
\nAddress bestMatch =<\/span> (<\/span>matches.isEmpty<\/span>(<\/span>)<\/span> ?<\/span> null<\/span> :<\/span> matches.get<\/span>(<\/span>0<\/span>)<\/span>)<\/span>;<\/span>
\n
String<\/span><\/a> addressText =<\/span> String<\/span><\/a>.format<\/span>(<\/span>"%s, %s, %s"<\/span>, bestMatch.getMaxAddressLineIndex<\/span>(<\/span>)<\/span> &<\/span>gt;<\/span> 0<\/span> ?<\/span> bestMatch.getAddressLine<\/span>(<\/span>0<\/span>)<\/span> :<\/span> ""<\/span>, bestMatch.getLocality<\/span>(<\/span>)<\/span>, bestMatch.getCountryName<\/span>(<\/span>)<\/span>)<\/span>;<\/span><\/div><\/div>\n

Links:<\/strong><\/span>
\nstackoverflow:\u00a0
http:\/\/stackoverflow.com\/questions\/15191037\/how-to-reverse-geocode-in-google-maps-api-2-android<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

Si est\u00e1s en una de esas situaciones en que tienes la longitud \/ latitud de una posici\u00f3n y te gustar\u00eda saber a que direcci\u00f3n completa pertenece en Android, el siguiente c\u00f3digo podr\u00eda ser de utilidad ;-) Geocoder geoCoder = new Geocoder(this, Locale.getDefault()); List <address> matches = geoCoder.getFromLocation(latitude, longitude, 1); Address bestMatch = (matches.isEmpty() ? null […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[22],"tags":[44],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"yoast_head":"\nObtener la direcci\u00f3n a partir de unas coordenadas en Google Maps en Android - Karstieltopia<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Obtener la direcci\u00f3n a partir de unas coordenadas en Google Maps en Android - Karstieltopia\" \/>\n<meta property=\"og:description\" content=\"Si est\u00e1s en una de esas situaciones en que tienes la longitud \/ latitud de una posici\u00f3n y te gustar\u00eda saber a que direcci\u00f3n completa pertenece en Android, el siguiente c\u00f3digo podr\u00eda ser de utilidad ;-) Geocoder geoCoder = new Geocoder(this, Locale.getDefault()); List <address> matches = geoCoder.getFromLocation(latitude, longitude, 1); Address bestMatch = (matches.isEmpty() ? null […]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/\" \/>\n<meta property=\"og:site_name\" content=\"Karstieltopia\" \/>\n<meta property=\"article:published_time\" content=\"2013-07-23T05:40:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-25T13:16:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@karstiel\" \/>\n<meta name=\"twitter:site\" content=\"@karstiel\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/karstieltopia.com\/#website\",\"url\":\"http:\/\/karstieltopia.com\/\",\"name\":\"Karstieltopia\",\"description\":\"Programaci\\u00f3n, tecnolog\\u00eda y a\\u00f1adidos\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"http:\/\/karstieltopia.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/#webpage\",\"url\":\"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/\",\"name\":\"Obtener la direcci\\u00f3n a partir de unas coordenadas en Google Maps en Android - Karstieltopia\",\"isPartOf\":{\"@id\":\"http:\/\/karstieltopia.com\/#website\"},\"datePublished\":\"2013-07-23T05:40:02+00:00\",\"dateModified\":\"2016-02-25T13:16:50+00:00\",\"author\":{\"@id\":\"http:\/\/karstieltopia.com\/#\/schema\/person\/3d09a55c38c7c00e78c41fa3f71a6e75\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/karstieltopia.com\/programacion\/java\/obtener-la-direccion-a-partir-de-unas-coordenadas-en-google-maps-en-android\/\"]}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/karstieltopia.com\/#\/schema\/person\/3d09a55c38c7c00e78c41fa3f71a6e75\",\"name\":\"karstiel\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6AuIG-3C","_links":{"self":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/224"}],"collection":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/comments?post=224"}],"version-history":[{"count":16,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/224\/revisions"}],"predecessor-version":[{"id":243,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/224\/revisions\/243"}],"wp:attachment":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/media?parent=224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/categories?post=224"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/tags?post=224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}