• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Geohash in mapping applications
 

Geohash in mapping applications

on

  • 1,603 views

Geohash in mapping applications by Igor Luzhanov

Geohash in mapping applications by Igor Luzhanov

Statistics

Views

Total Views
1,603
Views on SlideShare
1,603
Embed Views
0

Actions

Likes
1
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Geohash in mapping applications Geohash in mapping applications Presentation Transcript

    • Geohash in mapping applications December, 2011 Igor Luzhanov
    • 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) { ... }
    • Common approach www.ciklum.net
    • Common approach problems www.ciklum.net
    • Solution - Geohash
      • 46.4845830 N, 30.7326000 E = u8mb7q6b36r6x
      • Invented by Gustavo Niemeyer, 2008, public domain
      www.ciklum.net
    • 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
    • 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
    • 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
    • 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)
    • 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
    • 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
    • Thank you!  ? www.ciklum.net