NOTE

This is still actively being developed and is very alpha. You can currently conduct a simple search and an MQL query. The results are returned as ruby hash.

TODO

  • Building data objects to represent Entities and Views.

  • Allow updates to views.

GeoAPI

A Ruby wrapper for the GeoAPI.com APIs. This gem was almost entirely inspired by the various geoplanet gems.

Usage

Reverse Geocoding:

require 'geoapi'
GeoAPI.apikey = [Your App ID Here]

# Location
latitude = -27.000
longitude = -131.000

# Non Required Options
optional_parameters = {:radius => '500m', :type => 'POI', "include-parents" => true, :limit => 5, :pretty => true}

# Simple Search
result = GeoAPI::Query.simple_search(latitude, longitude, optional_parameters)

# MQL Query
q = {:lat => 37.75629, :lon => -122.4213, :radius => "1km", :entity => [{:type => "business", :guid => nil}]}
results = GeoAPI::Query.query(q)

REQUIREMENTS:

To use this library, you must have a valid GeoAPI.com API Key. You can get one at api.geoapi.com

Additionally, geoapi has the following gem dependencies:

  • rest-client >= 0.9

  • json >= 1.1.3

Please note that if you have ActiveSupport::JSON defined (either by manually having loaded it or when you use geoapi within a Rails application) the json dependency will be ignored and geoapi uses ActiveSupport::JSON instead.

INSTALL:

This gem is hosted on Gemcutter. To install gemcutter:

gem install gemcutter
gem tumble

To install geoapi after gemcutter:

gem install geoapi