Skip to content

Commit

Permalink
changed staticmethods to module
Browse files Browse the repository at this point in the history
  • Loading branch information
buck heroux committed Oct 9, 2014
1 parent 8ec4a9b commit 9d348e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
35 changes: 18 additions & 17 deletions quadkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,21 @@ def __str__(self):
def __repr__(self):
return self.key

@staticmethod
def from_geo(geo, level):
"""
Constucts a quadkey representation from geo and level
geo => (lat, lon)
If lat or lon are outside of bounds, they will be clipped
If level is outside of bounds, an AssertionError is raised
"""
pixel = TileSystem.geo_to_pixel(geo, level)
tile = TileSystem.pixel_to_tile(pixel)
key = TileSystem.tile_to_quadkey(tile, level)
return QuadKey(key)

@staticmethod
def from_tile(tile, level):
return QuadKey(TileSystem.tile_to_quadkey(tile, level))
def from_geo(geo, level):
"""
Constucts a quadkey representation from geo and level
geo => (lat, lon)
If lat or lon are outside of bounds, they will be clipped
If level is outside of bounds, an AssertionError is raised
"""
pixel = TileSystem.geo_to_pixel(geo, level)
tile = TileSystem.pixel_to_tile(pixel)
key = TileSystem.tile_to_quadkey(tile, level)
return QuadKey(key)

def from_tile(tile, level):
return QuadKey(TileSystem.tile_to_quadkey(tile, level))

def from_str(qk_str):
return QuadKey(qk_str)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name="quadkey",
version="0.0.4",
version="0.0.5",
description="Python Implementation for Geospatial Quadkeys",
author="Buck Heroux",
url="https://github.com/buckheroux/QuadKey",
Expand Down

0 comments on commit 9d348e9

Please sign in to comment.