JSPM

react-native-geocoding

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17957
  • Score
    100M100P100Q135777F
  • License MIT

A React Native module to transform a description of a location (i.e. street address, town name, etc.) into geographic coordinates (i.e. latitude and longitude) and vice versa.

Package Exports

  • react-native-geocoding

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-geocoding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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'); // use a valid API key

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