https://github.com/bizzarrowebgroup/react-native-geocode
A React Native library that transform a description of a location into geographic coordinates
https://github.com/bizzarrowebgroup/react-native-geocode
expo geolocation google-maps-api json latlng react-hooks react-native react-native-example
Last synced: 2 months ago
JSON representation
A React Native library that transform a description of a location into geographic coordinates
- Host: GitHub
- URL: https://github.com/bizzarrowebgroup/react-native-geocode
- Owner: bizzarrowebgroup
- License: mit
- Created: 2020-05-05T01:43:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T05:01:12.000Z (over 2 years ago)
- Last Synced: 2025-03-18T13:11:44.572Z (2 months ago)
- Topics: expo, geolocation, google-maps-api, json, latlng, react-hooks, react-native, react-native-example
- Language: TypeScript
- Size: 3.17 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# react-native-geocode
[](https://expo.io/)

transform a description of a location into geographic coordinates
## Installation
```sh
yarn add react-native-geocode
```## Usage
# Initialize the Geocode library with
```js
import Geocode from "react-native-geocode";
...Geocode.intialize("GMAPS-API-KEY");
// or with options
Geocode.intialize("GMAPS-API-KEY", {language : "en"});
```| Accepted props | Type | Description |
|----------------|--------|------------------------|
| apiKey | String | Google Maps Apikey |
| options | Object | Google Geocode Options |[for options props see](https://developers.google.com/maps/documentation/geocoding/intro#geocoding)
# You can call the from function with these parameters
| Accepted parameter | Type |
|-----------------------|---------|
| Address | String |
| {lat, lng} | Object |
| {latitude, longitude} | Object |
| [latitude, longitude] | Array |
| (latitude, longitude) | Numbers |### Others examples (See also the example folder)
```js
// Geocode
Geocode.from("Colosseum").then(json => {
var location = json.results[0].geometry.location;
console.log(location);
}).catch(error => console.warn(error));// Geocode from location
Geocode.from(41.89, 12.49).then(json => {
var addressComponent = json.results[0].address_components[0];
console.log(addressComponent);
}).catch(error => console.warn(error));// Geocode from latitude
Geocode.from({
latitude : 41.89,
longitude : 12.49
});// Geocode from latlng object
Geocode.from({
lat : 41.89,
lng : 12.49
});// Geocode from array
Geocode.from([41.89, 12.49]);
```## License
MIT
## Release Note
### 0.1.0
- Initial release