Your SlideShare is downloading. ×
0
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Geohash in mapping applications
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Geohash in mapping applications

1,551

Published on

Geohash in mapping applications by Igor Luzhanov …

Geohash in mapping applications by Igor Luzhanov

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,551
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Geohash in mapping applications December, 2011 Igor Luzhanov
  • 2. Points selection task <ul><li>Mapping application with brazillions of points </li></ul><ul><li>Need to select points in some rectangle </li></ul><ul><li>Common approach: </li></ul>www.ciklum.net if (point.lat &gt; bounds.S &amp;&amp; point.lat &lt; bounds.N &amp;&amp; point.lon &gt; bounds.W &amp;&amp; point.lon &lt; bounds.E) { ... }
  • 3. Common approach www.ciklum.net
  • 4. Common approach problems www.ciklum.net
  • 5. Solution - Geohash <ul><li>46.4845830 N, 30.7326000 E = u8mb7q6b36r6x </li></ul><ul><li>Invented by Gustavo Niemeyer, 2008, public domain </li></ul>www.ciklum.net
  • 6. How it works 1/2 <ul><li>Example: decoding from base 32 for ezs42 </li></ul><ul><li>Base-32  binary ezs42  0110111111110000010000010 </li></ul><ul><li>Even – longitude, odd – latitude (start from 0, left to right) lon = 0111110000000 lat = 101111001001 </li></ul>www.ciklum.net
  • 7. How it works 2/2 <ul><li>Latitude = 101111001001 (~ 42.6 ° ) </li></ul><ul><li>All latitude range: from [+90°, -90°], middle = 0° </li></ul><ul><li>First bit = 1, so select upper interval: [+90°, 0°], middle = 45° </li></ul><ul><li>Continue for all bits, getting more detailed range </li></ul><ul><li>Geohash define box, not point ! </li></ul>www.ciklum.net
  • 8. How you can use it – 1D <ul><li>In rectangular area (except &amp;quot;faultlines&amp;quot; ) points placed on contiguous slices </li></ul><ul><li>Points can be requested by single parameter: </li></ul>www.ciklum.net SELECT * FROM myPoints WHERE geohash &gt;= u85 AND geohash &lt;= u8x
  • 9. How you can use it – 2D <ul><li>Save all slices for point in DB ( u, u8, u8m, u8mb… etc ) </li></ul><ul><li>Detect all visible top-level slices </li></ul><ul><li>Make a query: </li></ul>www.ciklum.net SELECT p FROM PointEntity p JOIN p.slices s WHERE s IN (:boundSlices)
  • 10. Limitations <ul><li>Geohash define box, not point! Close points can have different geohashes </li></ul><ul><li>1D queries return incorrect results near “faultlines”. Solution – subqueries. </li></ul><ul><li>Close points not always have common prefix </li></ul>www.ciklum.net
  • 11. Java implementations <ul><li>javageomodel - http://code.google.com/p/javageomodel </li></ul><ul><li>geospatialweb - http://code.google.com/p/geospatialweb/ </li></ul><ul><li>geohash-java - https://github.com/kungfoo/geohash-java </li></ul><ul><li>jGeohash - http://sourceforge.net/projects/jgeohash </li></ul>www.ciklum.net
  • 12. Thank you!  ? www.ciklum.net

×