Address translation in Google Maps

1

I'm making an app to search for addresses in Google Maps.

Is there any way to convert a String to Location , so I can get the longitude and latitude? Or is there a better way?

    
asked by anonymous 18.04.2014 / 18:04

2 answers

0

I found the answer (it took but found!).

Android has a class called Geocoder , which allows you to do these conversions. You must also give permission to access the internet and GPS:

uses-permission android:name="android.permission.INTERNET"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
    
25.04.2014 / 00:46
2

Is it in JAVASCRIPT?

str = "12.12345 -15.12345";

x = str.split(" "); // para partir em 2 a string

lat = x[0];
lon = x[1];

latLon = new google.maps.LatLng(lat, lon);

latLon will be in the format supported by the google app. Want a tip? see how the latLon format is written:

alert(  JSON.stringify( latLon )  );
    
19.04.2014 / 01:38