Slightly offtopic - coordinate conversions
Peter Edwards
peter at dragonstaff.co.uk
Wed Jul 13 07:52:29 BST 2011
On 13 July 2011 07:16, Peter Sergeant <pete at clueball.com> wrote:
> I've been playing around with Google Maps recently, and noticed that
> they've started using hashes of some coordinates:
>
> latlng: 52.54296 -0.308166
> hnear : 0x4877f21032e242f5:0x805cb103d71d5051
>
> latlng: 51.411586,-0.300893
> hnear : 0x47d8a00baf21de75:0x52963a5addd52a99
>
>
Interesting. My guess is they change the Lat/Long to the centre of its
graticule square then truncate to a fixed number of floating point places
before doing an MD5 sum.
Then you can do a quick lookup all places within a graticule square to drive
products like Google Places.
http://en.wikipedia.org/wiki/Geohash
This makes for some good reading too
http://www.mongodb.org/display/DOCS/Geospatial+Indexing
they gave two presentations recently about indexing geolocations and doing
polygonal (spherical) searching rather than 2D searching. Handy if you live
on the North Pole ;-)
http://www.10gen.com/presentation/mongosf-2011/geospatial-indexing-mongodb
http://www.10gen.com/presentation/mongosf2011/wordsquared
To drag it back to Perl(ish) land
http://wiki.xkcd.com/geohashing/Main_Page
Cheers, Peter
http://perl.dragonstaff.co.uk
More information about the london.pm
mailing list