-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GeoHash | ||
======= | ||
|
||
FFI Ruby wrapper for [SimpleGeo's libgeohash](http://github.com/simplegeo/libgeohash). | ||
|
||
GeoHash.encode(42.60498046875, -5.60302734375, 5) # => 'ezs42' | ||
GeoHash.decode('ezs42') # => {:lat => 42.60498046875, :lng => -5.60302734375} | ||
Geohash.neighbors('ezs42) # => ["ezs48", "ezs49", "ezs43", "ezs41", "ezs40", "ezefp", "ezefr", "ezefx"] | ||
|
||
What's a GeoHash? | ||
---------------- | ||
|
||
Geohash is a latitude/longitude geocode system invented by Gustavo Niemeyer when writing the web service at geohash.org, and put into the public domain. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape. | ||
Geohashes offer properties like arbitrary precision and the possibility of gradually removing characters from the end of the code to reduce its size (and gradually lose precision). | ||
|
||
As a consequence of the gradual precision degradation, nearby places will often (but not always) present similar prefixes. On the other side, the longer a shared prefix is, the closer the two places are. | ||
|
||
- [Wikipedia article](http://en.wikipedia.org/wiki/Geohash) | ||
- [GeoHash site](http://geohash.org/site/tips.html) | ||
- [JS Demo](http://openlocation.org/geohash/geohash-js/) | ||
|
||
Credits | ||
------- | ||
|
||
- Derek Smith - libgeohash author | ||
- Ilya Grigorik - FFI wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'rake' | ||
require 'spec/rake/spectask' | ||
|
||
begin | ||
require 'jeweler' | ||
Jeweler::Tasks.new do |gemspec| | ||
gemspec.name = 'libgeohash' | ||
gemspec.summary = 'Ruby FFI wrapper for libgeohash' | ||
gemspec.description = gemspec.summary | ||
gemspec.email = 'ilya@igvita.com' | ||
gemspec.homepage = 'http://github.com/igrigorik/libgeohash' | ||
gemspec.authors = ['Ilya Grigorik'] | ||
gemspec.rubyforge_project = gemspec.name | ||
end | ||
|
||
Jeweler::GemcutterTasks.new | ||
rescue LoadError | ||
puts 'Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org' | ||
end | ||
|
||
task :default => :spec | ||
|
||
Spec::Rake::SpecTask.new do |t| | ||
t.ruby_opts = ['-rtest/unit'] | ||
t.spec_files = FileList['spec/**/*_spec.rb'] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by jeweler | ||
# DO NOT EDIT THIS FILE DIRECTLY | ||
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = %q{libgeohash} | ||
s.version = "0.1.0" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Ilya Grigorik"] | ||
s.date = %q{2010-09-03} | ||
s.description = %q{Ruby FFI wrapper for libgeohash} | ||
s.email = %q{ilya@igvita.com} | ||
s.extra_rdoc_files = [ | ||
"README.md" | ||
] | ||
s.files = [ | ||
"README.md", | ||
"lib/libgeohash.rb", | ||
"spec/libgeohash_spec.rb" | ||
] | ||
s.homepage = %q{http://github.com/igrigorik/libgeohash} | ||
s.rdoc_options = ["--charset=UTF-8"] | ||
s.require_paths = ["lib"] | ||
s.rubyforge_project = %q{libgeohash} | ||
s.rubygems_version = %q{1.3.7} | ||
s.summary = %q{Ruby FFI wrapper for libgeohash} | ||
s.test_files = [ | ||
"spec/libgeohash_spec.rb" | ||
] | ||
|
||
if s.respond_to? :specification_version then | ||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION | ||
s.specification_version = 3 | ||
|
||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then | ||
else | ||
end | ||
else | ||
end | ||
end | ||
|