Skip to content

Commit

Permalink
Ignore extra coordinates, e.g: z, in reprojection.
Browse files Browse the repository at this point in the history
NOTE: Back-ported from b2b66ce.
  • Loading branch information
Matt Amos committed Jan 30, 2017
1 parent 6555f1e commit d885fe6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tests/test_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,18 @@ def test_tiles_children_range(self):
exp.sort()
for actual_child, exp_child in zip(actual, exp):
self.assertEqual(exp_child, actual_child)


class TestReproject(unittest.TestCase):

def test_reproject(self):
from tilequeue.tile import reproject_lnglat_to_mercator
coord = reproject_lnglat_to_mercator(0, 0)
self.assertAlmostEqual(0, coord[0])
self.assertAlmostEqual(0, coord[1])

def test_reproject_with_z(self):
from tilequeue.tile import reproject_lnglat_to_mercator
coord = reproject_lnglat_to_mercator(0, 0, 0)
self.assertAlmostEqual(0, coord[0])
self.assertAlmostEqual(0, coord[1])
2 changes: 1 addition & 1 deletion tilequeue/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def coord_to_bounds(coord):
return bounds


def reproject_lnglat_to_mercator(x, y):
def reproject_lnglat_to_mercator(x, y, *unused_coords):
return pyproj.transform(latlng_proj, merc_proj, x, y)


Expand Down

0 comments on commit d885fe6

Please sign in to comment.