An open API service indexing awesome lists of open source software.

https://github.com/sixarm/sixarm_ruby_geocode_address

SixArm.com » Ruby Gem » GeocodeAddress using Google Maps API to get location, latitude, longitude, etc.
https://github.com/sixarm/sixarm_ruby_geocode_address

address geocode google-maps rails ruby

Last synced: about 1 year ago
JSON representation

SixArm.com » Ruby Gem » GeocodeAddress using Google Maps API to get location, latitude, longitude, etc.

Awesome Lists containing this project

README

          

# SixArm.com → Ruby →
GeocodeAddress gem to connect to Google Maps API

* Doc:
* Gem:
* Repo:

## Introduction

GeocodeAddress uses the Google Maps API to geocode an address string to a JSON result.

The address will cache as much as possible as it initializes and calls the Google Maps API.

For docs go to

Want to help? We're happy to get pull requests.

## Install

### Gem

To install this gem in your shell or terminal:

gem install sixarm_ruby_geocode_address

### Gemfile

To add this gem to your Gemfile:

gem 'sixarm_ruby_geocode_address'

### Require

To require the gem in your code:

require 'sixarm_ruby_geocode_address'

## Examples

address = GeocodeAddress.new("1 Main St, San Francisco, CA 94111")
address.href #=> "http://maps.googleapis.com/maps/api/geocode/json?address=1+Main+St,+San+Francisco,+CA+94111&sensor=false"
address.get #=> ...calls the Google Maps API via Net::HTTP and returns a JSON-formatted string of results
address.json #=> ...calls the Google Maps API via Net::HTTP and returns a JSON parse of results
address.location #=> {"lat" => 37.7931108, "lng" => -122.3964898}
address.lat #=> 37.7931108
address.lng #=> -122.3964898