Your SlideShare is downloading. ×
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,432

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

×