From e161684053d190baf929c18c7771474db4a72ad5 Mon Sep 17 00:00:00 2001 From: Buck Heroux Date: Sun, 20 Apr 2014 18:52:46 -0600 Subject: [PATCH] added to/from on QuadKey --- quadkey/__init__.py | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/quadkey/__init__.py b/quadkey/__init__.py index 4998190..7090252 100644 --- a/quadkey/__init__.py +++ b/quadkey/__init__.py @@ -54,6 +54,13 @@ def area(self): def to_tile(self): return TileSystem.quadkey_to_tile(self.key) + def to_geo(self): + ret = TileSystem.quadkey_to_tile(self.key) + tile = ret[0] + lvl = ret[1] + pixel = TileSystem.tile_to_pixel(tile) + return TileSystem.pixel_to_geo(pixel, lvl) + def __eq__(self, other): return self.key == other.key @@ -79,3 +86,7 @@ def from_geo(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)) diff --git a/setup.py b/setup.py index 24ffdae..9276af4 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup(name="quadkey", - version="0.0.1", + version="0.0.3", description="Python Implementation for Geospatial Quadkeys", author="Buck Heroux", url="https://github.com/buckheroux/QuadKey",