Git Product home page Git Product logo

simplegeolocation's Introduction

This gem was created with geolocation in mind, meaning that the main goal is to get a latitude and longitude, but it will return additional data if available. With this gem you can pass an IP number or an ZIP number or an ordinary address and it will try to get as many information as possible about the given argument.

@usage

gem install simple_geolocation
require 'simple_geolocation'

# Using with IP.
location = SimpleGeolocation.Geocoder.new("74.125.113.104")
location.geocode!
geo.success? # => true
location.city # => "Mountain View"
location.state # => "CA"
location.lat # => 37.41919999999999
location.lng # => -122.0574
location.provider # => "geoip"

# Using with zipcode (Brazilian zipcode only)
geo = SimpleGeolocation.Geocoder.new("22640100")
geo.geocode!
geo.success? # => true
geo.street # => "Av. Das Américas"
geo.district # => "Barra da Tijuca"
geo.state # => "RJ"
geo.city # => "Rio De Janeiro"
geo.zip # => "22640-100"
geo.lat # => -23.0032808
geo.lng # => -43.3230295


# Using with standard address
geo = SimpleGeolocation::Geocoder.new("Rua do Principe, 199, Joinville, SC")
geo.geocode!
geo.success? # => true
geo.lat # => -26.30101
geo.lng # => -48.8452974
geo.completeness # => 88


The returned attributes are: lat, lng, city, state, provider, zip, street, district, number

simplegeolocation's People

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.