git clone [email protected]:jbeuckm/cordova-plugin-geocoder.git
cd myproject
cordova plugin add ../cordova-plugin-geocoder
- iOS
- Android
- navigator.geocoder.geocodeString
Forward geocode a given address to find coordinates.
navigator.geocoder.geocodeString(successCallback, errorCallback, addressString);
- addressString: The address to be geocoded. (String)
function onError(err) {
alert(JSON.stringify(err));
}
function onSuccess(coords) {
alert("The location is lat="+coords.latitude+", lon="+coords.longitude);
}
navigator.geocoder.geocodeString(onSuccess, onError, "55418");