Skip to content

Commit b54bca7

Browse files
U-NORTHAMERICA\taherouxU-NORTHAMERICA\taheroux
authored andcommitted
docs
1 parent d43b2c0 commit b54bca7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
QuadKey
22
=======
33

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+
513

614
from quadkey import QuadKey
715

8-
qk = QuadKey((-105, 40) 17)
16+
qk = QuadKey.from_geo((-105, 40), 17)
917
print qk.key # => 02310101232121212
1018
assert qk.level is 17
11-
copy = QuadKey.from_str(qk.key)
19+
tile = qk.to_tile() # => [(x, y), z]

quadkey/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class QuadKey:
55

66
@precondition(lambda c, key: valid_key(key))
7+
78
def __init__(self, key):
89
"""
910
A quadkey must be between 1 and 23 digits and can only contain digit[0-3]
@@ -50,6 +51,9 @@ def area(self):
5051
side = (size / 2) * res
5152
return side*side
5253

54+
def to_tile(self):
55+
return TileSystem.quadkey_to_tile(self.key)
56+
5357
def __eq__(self, other):
5458
return self.key == other.key
5559

0 commit comments

Comments
 (0)