Groundspeak Forums: geohash.org - Groundspeak Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

geohash.org Short links for referencing a position

#1 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 26 February 2008 - 08:05 AM

Yesterday I've put online a service I've been developing for quite a while,
but just recently I've managed to finish it (it's not a big system, but the
time has been on the short side).

Basically, http://geohash.org is a site that allows a pair of latitude/longitude
to be encoded as a short string, in a way that enables it to be used in
references pointing to specific places in a practical form. The person
following the link can check where the place is located (through embedded
google maps), go to another site for more details (including nearest caches,
in geocaching.com), download a GPX waypoint with it, or even send it
directly to the GPS (with Garmin Communicator).

As an example, at http://geohash.org/c216ne we can find Mount Hood, in
Oregon, and from there geocaches around it, Google Maps, etc.

I've tried to make the input box quite flexible, accepting pretty much any
reasonable format of latitude/longitude. If it doesn't work with your preferred
format, please let me know.

Nearby places will present similar geohash prefixes, and characters may be
stripped from the end of the hash to get a shorter string (and gradually
less precise).

Enjoy!

#2 User is offline   CoyoteRed 

  • Geocacher
  • Group: Members
  • Posts: 7122
  • Joined: 22-August 02

Posted 26 February 2008 - 08:26 AM

Nifty site.

Curiosity asks how are you converting a single number into coordinates?

Thanks!

#3 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 26 February 2008 - 09:05 AM

Bits from the latitude and longitude values are mixed.

I'll write a detailed article, when I get some time, to explain details of the algorithm used.
I want to make sure that it stays within public domain, rather than being patented like
other algorithms have been.

This post has been edited by niemeyer: 26 February 2008 - 03:06 PM


#4 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 26 February 2008 - 03:50 PM

Here is an explanation about the algorithm used:

http://en.wikipedia.org/wiki/Geohash

Hopefully this establishes prior art and allows people to use it for whatever they want.

#5 User is offline   ReadyOrNot 

  • Geocacher
  • Group: +Premium Members
  • Posts: 2210
  • Joined: 03-March 05

Posted 26 February 2008 - 03:58 PM

Do you have any source code? I'd love to convert this into a SOAP service so others can take advantage in a very simplistic way. It could be as simple as having two functions. Can you host .net apps? If so, let me know and I'd be happy to help out any way I can.

Way cool.

This post has been edited by ReadyOrNot: 26 February 2008 - 04:01 PM


#6 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 26 February 2008 - 06:19 PM

Source code isn't available yet, but it should be trivial to get programmatic access to the system. If you access http://geohash.org/c216ne/text, you'll get a plain text latitude/longitude pair, and if you access, e.g. http://geohash.org/?q=49.26,-123.26 , you get the geohash URL back.

It'd be awesome to see some client libraries available. Let me know if you need any help with that.

#7 User is offline   ReadyOrNot 

  • Geocacher
  • Group: +Premium Members
  • Posts: 2210
  • Joined: 03-March 05

Posted 26 February 2008 - 07:19 PM

View Postniemeyer, on Feb 26 2008, 06:19 PM, said:

Source code isn't available yet, but it should be trivial to get programmatic access to the system. If you access http://geohash.org/c216ne/text, you'll get a plain text latitude/longitude pair, and if you access, e.g. http://geohash.org/?q=49.26,-123.26 , you get the geohash URL back.

It'd be awesome to see some client libraries available. Let me know if you need any help with that.


The neat thing about subscribing to a SOAP service is I can use the functions directly in my code. The other neat thing is that its compatible with any programming language.

Dim coords as String = myService.GetCoords("c216ne")
or
Dim text as String = myService.GetText(coords)

Once you release the source code, I can write the SOAP service for you. Sounds like more fun than what I'm working on at work right now ;)

#8 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 27 February 2008 - 05:30 AM

HTTP is also compatible with any programming language. Here is a working sketch, in Python:

from urllib import urlopen

def get_coords(geohash):
	return urlopen("http://geohash.org/%s/text" % geohash).readline()

def get_geohash(coords):
	return urlopen("http://geohash.org/?format=url&q=%s" % coords).readline()


#9 User is offline   lordelph 

  • Premium Member
  • Group: +Premium Members
  • Posts: 583
  • Joined: 28-August 04

Posted 27 February 2008 - 01:02 PM

I have a PHP implementation of the algorithm - will release it shortly!

#10 User is offline   lordelph 

  • Premium Member
  • Group: +Premium Members
  • Posts: 583
  • Joined: 28-August 04

Posted 27 February 2008 - 03:06 PM

My test cases failed, possibly highlighting a difference between the documented algorithm and the one on the geohash website. Have contacted the author to figure out the problem!

#11 User is offline   lordelph 

  • Premium Member
  • Group: +Premium Members
  • Posts: 583
  • Joined: 28-August 04

Posted 27 February 2008 - 04:48 PM

Many thanks to Gustavo for updating the algorithm documentation so quickly!

Problem solved, so if anyone would like a PHP implementation of the algorithm, you can get one here: http://blog.dixo.net...hash-php-class/

#12 User is offline   Robespierre 

  • Premium Member
  • Group: +Premium Members
  • Posts: 1840
  • Joined: 20-August 03

Posted 27 February 2008 - 06:11 PM

Honestly, I want to understand.

I entered the coords to my newest cache, and it gave me a map and a few choices for the style of coords - but I don't see the point.

What am I missing?

#13 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 27 February 2008 - 07:09 PM

The point of the service is offering a short URL to link to a given location, so that instead of pointing people to a pair of numbers, you point them to a convenient place where they can more comfortably act on the location.

FWIW, I've built a service primarily for my own use. I'll be happy if it helps other people somehow, but the primary goal has already been met.

#14 User is offline   barryhunter 

  • Geocacher
  • Group: Members
  • Posts: 322
  • Joined: 03-July 04

Posted 28 February 2008 - 02:43 PM

Thanks to Lordelph, I've added this to a conversion webservice:
http://www.nearby.or...onvert-help.php

example
http://www.nearby.org.uk/api/convert.php?k...t=geohash-wgs84
but can cope with coordinates other that lat/long
http://www.nearby.org.uk/api/convert.php?k...t=geohash-wgs84
and the otherway
http://www.nearby.org.uk/api/convert.php?k...n=geohash-wgs84
http://www.nearby.org.uk/api/convert.php?k...n=geohash-wgs84
(specify the coordinate to avoid confusion with postcodes)

(there is soap wrapper too)

:laughing:

#15 User is offline   niemeyer 

  • Geocacher
  • Group: Members
  • Posts: 21
  • Joined: 14-January 03

Posted 01 March 2008 - 08:21 AM

Nice site. Thanks for adding support for Geohashes.

I've made some improvements to geohash.org as well, adding support for geocoding of
addresses (streets, city names, whatever), implemented a bookmark and a mapplet to help
using it from Google Maps (check Tips & Tricks), and also documented the supported
query parameters, in case someone would like to build custom tools (in the same document).

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic