react-native-geocoding
A geocoding module for React Native to transform a description of a location (i.e. street address, town name, etc.) into geographic coordinates (i.e. latitude and longitude).
This module uses Google Maps Geocoding API and requires an API key for purposes of quota management. Please check this link out to obtain your API key.
Install
npm install --save react-native-geocoding
Example
import Geocoder from 'react-native-geocoding';
Geocoder.setApiKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
Geocoder.getFromLocation("Colosseum").then(
json => {
var location = json.results[0].geometry.location;
alert(location.lat + ", " + location.lng);
},
error => {
alert(error);
}
);
Geocoder.getFromLatLng(41.89, 12.49).then(
json => {
var address_component = json.results[0].address_components[0];
alert(address_component.long_name);
},
error => {
alert(error);
}
);
Release Notes
See CHANGELOG.md