Giter Site home page Giter Site logo

google_maps_geocoder's Introduction

GoogleMapsGeocoder

Build Status Code Climate Coverage Status Inline docs Gem Version security

A simple Plain Old Ruby Object wrapper for geocoding with Google Maps.

Installation

Add GoogleMapsGeocoder to your Gemfile and run bundle:

  gem 'google_maps_geocoder'

Or try it out in irb with:

  require './lib/google_maps_geocoder/google_maps_geocoder'

Ready to Go in One Step

chez_barack = GoogleMapsGeocoder.new '1600 Pennsylvania DC'

Usage

Get the complete, formatted address:

chez_barack.formatted_address
 => "1600 Pennsylvania Avenue Northwest, President's Park, Washington, DC 20500, USA"

...standardized name of the city:

chez_barack.city
 => "Washington"

...full name of the state or region:

chez_barack.state_long_name
 => "District of Columbia"

...standard abbreviation for the state/region:

chez_barack.state_short_name
 => "DC"

API

The complete, hopefully self-explanatory, API is:

  • GoogleMapsGeocoder#city
  • GoogleMapsGeocoder#country_long_name
  • GoogleMapsGeocoder#country_short_name
  • GoogleMapsGeocoder#county
  • GoogleMapsGeocoder#exact_match?
  • GoogleMapsGeocoder#formatted_address
  • GoogleMapsGeocoder#formatted_street_address
  • GoogleMapsGeocoder#lat
  • GoogleMapsGeocoder#lng
  • GoogleMapsGeocoder#partial_match?
  • GoogleMapsGeocoder#postal_code
  • GoogleMapsGeocoder#state_long_name
  • GoogleMapsGeocoder#state_short_name

For compatibility with Geocoder, the following aliases are also available:

  • GoogleMapsGeocoder#address
  • GoogleMapsGeocoder#coordinates
  • GoogleMapsGeocoder#country
  • GoogleMapsGeocoder#country_code
  • GoogleMapsGeocoder#latitude
  • GoogleMapsGeocoder#longitude
  • GoogleMapsGeocoder#state
  • GoogleMapsGeocoder#state_code

Google Maps API Key (Optional)

To have GoogleMapsGeocoder use your Google Maps API key, set it as an environment variable:

export GOOGLE_MAPS_API_KEY=[your key]

Copyright

Copyright © 2011-2018 Roderick Monje. See LICENSE.txt for further details.

google_maps_geocoder's People

Contributors

ivanoblomov avatar kiote avatar maxime-menant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.