-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1720 from tilezen/zerebubuth/1096-natural-landuse…
…-sort-key Add sort keys for "natural" landuse kinds
- Loading branch information
Showing
15 changed files
with
427 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- encoding: utf-8 -*- | ||
from . import FixtureTest | ||
|
||
|
||
class NaturalLanduseSortKeyTest(FixtureTest): | ||
|
||
def _check(self, tags, expected_kind, expected_sort_rank): | ||
import dsl | ||
|
||
z, x, y = (16, 0, 0) | ||
|
||
full_tags = { | ||
'source': 'openstreetmap.org' | ||
} | ||
full_tags.update(tags) | ||
|
||
self.generate_fixtures( | ||
dsl.way(1, dsl.tile_box(z, x, y), full_tags), | ||
) | ||
|
||
self.assert_has_feature( | ||
z, x, y, 'landuse', { | ||
'id': 1, | ||
'kind': expected_kind, | ||
'sort_rank': expected_sort_rank, | ||
}) | ||
|
||
def test_natural_wood(self): | ||
self._check({'natural': 'wood'}, 'natural_wood', 34) | ||
|
||
def test_natural_forest(self): | ||
self._check({'natural': 'forest'}, 'natural_forest', 33) | ||
|
||
def test_natural_park(self): | ||
self._check({'natural': 'park'}, 'natural_park', 32) | ||
|
||
def test_grass(self): | ||
self._check({'landuse': 'grass'}, 'grass', 35) | ||
|
||
def test_meadow(self): | ||
self._check({'landuse': 'meadow'}, 'meadow', 36) | ||
|
||
def test_scrub(self): | ||
self._check({'natural': 'scrub'}, 'scrub', 37) | ||
|
||
def test_wetland(self): | ||
self._check({'natural': 'wetland'}, 'wetland', 220) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- encoding: utf-8 -*- | ||
from . import FixtureTest | ||
|
||
|
||
class WetlandAboveWaterTest(FixtureTest): | ||
|
||
def test_wetland_above_water(self): | ||
import dsl | ||
|
||
z, x, y = (16, 0, 0) | ||
|
||
self.generate_fixtures( | ||
dsl.way(1, dsl.tile_box(z, x, y), { | ||
'natural': 'wetland', | ||
'wetland': 'bog', | ||
'source': 'openstreetmap.org', | ||
}), | ||
dsl.way(2, dsl.tile_box(z, x, y), { | ||
'natural': 'water', | ||
'source': 'openstreetmap.org', | ||
}), | ||
) | ||
|
||
# set here for convenience, in case we change them later. the exact | ||
# values aren't as important as the wetland one being more than the | ||
# water one. | ||
wetland_rank = 220 | ||
water_rank = 204 | ||
|
||
self.assertTrue(wetland_rank > water_rank) | ||
self.assert_has_feature( | ||
z, x, y, 'landuse', { | ||
'id': 1, | ||
'kind': 'wetland', | ||
'sort_rank': wetland_rank, | ||
}) | ||
self.assert_has_feature( | ||
z, x, y, 'water', { | ||
'id': 2, | ||
'kind': 'water', | ||
'sort_rank': water_rank, | ||
}) |
Oops, something went wrong.