File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1
1
QuadKey
2
2
=======
3
3
4
- Quad key object used for Geospatial segmentation
4
+ Quad key object used for Geospatial segmentation. Based off the idea of a quadtree and used as the Bing Maps tile system.
5
+
6
+ Given a (lat, lon) and level produce a quadkey to be used in Bing Maps.
7
+ Can also supply methods to generate a Google Maps TileXYZ
8
+
9
+ Built off of the TileSystem static class outlined here: http://msdn.microsoft.com/en-us/library/bb259689.aspx
10
+
11
+ Converts a lat,lon to pixel space to tile space to a quadkey
12
+
5
13
6
14
from quadkey import QuadKey
7
15
8
- qk = QuadKey((-105, 40) 17)
16
+ qk = QuadKey.from_geo ((-105, 40), 17)
9
17
print qk.key # => 02310101232121212
10
18
assert qk.level is 17
11
- copy = QuadKey.from_str( qk.key)
19
+ tile = qk.to_tile() # => [(x, y), z]
Original file line number Diff line number Diff line change 4
4
class QuadKey :
5
5
6
6
@precondition (lambda c , key : valid_key (key ))
7
+
7
8
def __init__ (self , key ):
8
9
"""
9
10
A quadkey must be between 1 and 23 digits and can only contain digit[0-3]
@@ -50,6 +51,9 @@ def area(self):
50
51
side = (size / 2 ) * res
51
52
return side * side
52
53
54
+ def to_tile (self ):
55
+ return TileSystem .quadkey_to_tile (self .key )
56
+
53
57
def __eq__ (self , other ):
54
58
return self .key == other .key
55
59
You can’t perform that action at this time.
0 commit comments