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.
- Host: GitHub
- URL: https://github.com/sixarm/sixarm_ruby_geocode_address
- Owner: SixArm
- License: other
- Created: 2011-01-25T06:50:13.000Z (over 15 years ago)
- Default Branch: main
- Last Pushed: 2023-09-15T19:28:13.000Z (almost 3 years ago)
- Last Synced: 2025-02-06T00:27:45.956Z (over 1 year ago)
- Topics: address, geocode, google-maps, rails, ruby
- Language: Ruby
- Homepage: http://sixarm.com
- Size: 244 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
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