Giter VIP home page Giter VIP logo

geohash's Introduction

NOTE: this is not maintained. Recommend checking out other gems such as this one:
https://rubygems.org/gems/dynamodb_geo

---
= geohash

* http://rubyforge.org/projects/geohash

== DESCRIPTION:

GeoHash Gem for Ruby (c) 2008-2010 David Troy
[email protected]

Geohash is a latitude/longitude encoding system invented by Gustavo Niemeyer when writing the
web service at geohash.org, and put into the public domain. Geohashes offer properties like
arbitrary precision, similar prefixes for nearby positions, and the possibility of gradually
removing characters from the end of the code to reduce its size (and gradually lose precision).

See these resources online:
http://geohash.org
http://en.wikipedia.org/wiki/Geohash
http://openlocation.org/geohash/geohash-js (javascript implementation and demo)

== FEATURES/PROBLEMS:

* Encode to Geohash Format to an arbitrary level of precision
* Decode from Geohash Format to an arbitrary level of precision
* C implementation is over 10 times faster than native Ruby code (we checked)
* No known problems

== SYNOPSIS:

GeoHash is very easy to use (and fast) because it's written in C with Ruby bindings.

  require 'rubygems'
  require 'geohash'

  GeoHash.decode('f77')
  => [63.98438, -73.82813]

  GeoHash.encode(39.51, -76.24)
  => "dr1bc0edrj"
  
  # Decode a geohash to a bounding box
  decode_bbox('dqcw4')
  => [39.0234375, -76.552734375], [39.0673828125, -76.5087890625]]
  
You can encode or decode to an arbitrary level of precision:

# Encode latitude and longitude to a geohash with precision digits
encode(lat, lon, precision=10)

# Decode a geohash to a latitude and longitude with decimals digits
decode(geohash, decimals=5)

Have fun with this!  GeoHash is the new black.

== REQUIREMENTS:

* GCC and a Gnu-ish build environment (for native extensions)

== INSTALLATION

1) Enable gems from github, if you haven't already done so (rubygems >= 1.2):
    > sudo gem sources -a http://gems.github.com

2) Install gem
    > sudo gem install davetroy-geohash

3) Profit!

== LICENSE:

(The MIT License)

Copyright (c) 2008-2010 David Troy

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

geohash's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

geohash's Issues

installing with Bundler

First, thanks for this useful gem. It simply works!
I installed it some time ago following the instruction in the README, and it worked, but now I have to use Bundler and it doesn't.

The Gemfile contains this line...

gem "geohash", '~> 1.1', :git => "https://github.com/davetroy/geohash.git"

and when "bundle install" is run, the result is...

Using geohash (1.1.1) from https://github.com/davetroy/geohash.git (at master) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c geohash_native.c
geohash_native.c: In function 'encode':
geohash_native.c:123: error: 'struct RFloat' has no member named 'float_value'
geohash_native.c:123: error: 'struct RFloat' has no member named 'float_value'
geohash_native.c: In function 'encode':
geohash_native.c:123: error: 'struct RFloat' has no member named 'float_value'
geohash_native.c:123: error: 'struct RFloat' has no member named 'float_value'
lipo: can't open input file: /var/folders/Eo/EoP8v2DDHw4avD+-wzeu6E+++TI/-Tmp-//cc0DIVD8.out (No such file or directory)
make: *** [geohash_native.o] Error 1

Any idea on how to solve it? I would really appreaciate it.

Thanks in advance.

Push v1.1.1 to Rubygems

There seem to be a number of folks having issues installing (see #4 and #1) because of an issue present in 1.0.1 (the current gem), this appears to be fixed in 1.1.1 (master) for me.

Is there a reason for not pushing the latest gem? If not, could you kindly push 1.1.1 to Rubygems?

Ruby 1.9: Failed to build gem native extension.

Hi,
trying to install gem on ruby 1.9, I got the following error:

Building native extensions. This could take a while...
ERROR: Error installing davetroy-geohash:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -fPIC -O2 -g -Wall -Wno-parentheses -o geohash_native.o -c geohash_native.c
geohash_native.c: In function ‘encode’:
geohash_native.c:123: error: ‘struct RFloat’ has no member named ‘value’
geohash_native.c:123: error: ‘struct RFloat’ has no member named ‘value’
geohash_native.c: In function ‘decode_bbox’:
geohash_native.c:135: error: ‘struct RString’ has no member named ‘ptr’
geohash_native.c: In function ‘decode’:
geohash_native.c:158: error: ‘struct RString’ has no member named ‘ptr’
geohash_native.c: In function ‘calculate_adjacent’:
geohash_native.c:196: error: ‘struct RString’ has no member named ‘ptr’
geohash_native.c:199: error: ‘struct RString’ has no member named ‘ptr’
make: *** [geohash_native.o] Błąd 1

Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/davetroy-geohash-1.1.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/davetroy-geohash-1.1.0/ext/gem_make.out

Base32 alphabet?

I'm curious how you settled on your Base32 alphabet (excluding AILO)? RFC4648 style (excluding 0189) and Crockford (excluding ILOU) seem more standard (per Wikipedia) and have active gem implementations. Might be being thick but I couldn't find a ready-made decoder for your scheme.

Thanks for your time.

Segmentation fault on ruby 2.0.0p195

/Users/patrick/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/geohash-03d655d5bf92/lib/geohash.rb:22: [BUG] Segmentation fault
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
c:0029 p:---- s:0135 e:000134 CFUNC  :encode_base
c:0028 p:0017 s:0129 e:000128 METHOD /Users/patrick/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/bundler/gems/geohash-03d655d5bf92/lib/geohash.rb:22

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.