Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements: Roads + Boundaries + Landcover + Estimated Locality Populations #2013

Merged
merged 23 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ BEGIN
MIN(
CASE WHEN hstore(tags)->'network' IN ('icn', 'ncn') THEN 8
WHEN hstore(tags)->'network' IN ('iwn', 'nwn') THEN 9
WHEN hstore(tags)->'network' IN ('rcn') THEN 10
WHEN hstore(tags)->'network' IN ('rcn') THEN 11
WHEN hstore(tags)->'network' IN ('rwn') THEN 11
WHEN hstore(tags)->'network' IN ('lcn') THEN 11
WHEN hstore(tags)->'network' IN ('lcn') THEN 12
WHEN hstore(tags)->'network' IN ('lwn') THEN 12
ELSE NULL
END
Expand Down
2 changes: 1 addition & 1 deletion docs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ To improve performance, some road segments are merged at low and mid-zooms. To f

**Roads** from **Natural Earth** are used at low zooms below 8. Road `kind_detail` values are limited to `motorway`, `trunk`, `primary`, `secondary`, `tertiary`.

**Roads** from **OpenStreetMap** are shown starting at zoom 8 with `motorway`, `trunk`, `primary`. `secondary` are added starting at zoom 10, with `motorway_link`, `tertiary`, `unclassified`, and paved grade1 `track` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `residential`, `road`, and grade1 and grade2 `track`. Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, remaining `track`, `pedestrian`, `living_street`, `cycleway` and `bridleway`. Zoom 14 adds `tertiary_link`, all remaining `path`, `footway`, and `steps`, `corridor`, and `alley` service roads. By zoom 15 all remaining service roads are added, including `driveway`, `parking_aisle`, `drive_through`. Internationally and nationally significant paths (`path`, `footway`, `steps`) are added at zoom 9, regionally significant paths are added at zoom 11, locally significant at zoom 12, and named or designated paths at zoom 13. Internationally and nationally significant bicycle routes are added at zoom 8, regionally significant bike routes at zoom 10, and locally significant at zoom 11.
**Roads** from **OpenStreetMap** are shown starting at zoom 8 with `motorway`, `trunk`, `primary`. `secondary` are added starting at zoom 10, with `motorway_link`, `tertiary`, and paved grade1 `track` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `unclassified`, `residential`, `road`, and grade1 and grade2 `track`. Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, remaining `track`, `pedestrian`, `living_street`, `cycleway` and `bridleway`. Zoom 14 adds `tertiary_link`, all remaining `path`, `footway`, and `steps`, `corridor`, and `alley` service roads. By zoom 15 all remaining service roads are added, including `driveway`, `parking_aisle`, `drive_through`. Internationally and nationally significant paths (`path`, `footway`, `steps`) are added at zoom 9, regionally significant paths are added at zoom 11, locally significant at zoom 12, and named or designated paths at zoom 13. Internationally and nationally significant bicycle routes are added at zoom 8, regionally significant bike routes at zoom 10, and locally significant at zoom 11.

**Ferries** from both Natural Earth and OpenStreetMap are shown starting at zoom 5 with `kind` values of `ferry`.

Expand Down
94 changes: 94 additions & 0 deletions integration-test/1993-estimate-null-populations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import dsl
from . import FixtureTest


class EstimatePopulationsTest(FixtureTest):

def validate_est_population(self, point, tile_coord, min_zoom_with_pop, min_zoom_with_est_pop, est_pop):
z, x, y = tile_coord

self.generate_fixtures(point)
self.assert_has_feature(
z, x, y, 'places', {
'id': point.fid,
'population': int(point.properties['population']),
'min_zoom': min_zoom_with_pop
})

del point.properties['population']

self.generate_fixtures(point)
self.assert_has_feature(
z, x, y, 'places', {
'id': point.fid,
'population': est_pop,
'min_zoom': min_zoom_with_est_pop
})

def test_city(self):
z, x, y = (10, 518, 351)
# https://www.openstreetmap.org/node/26691955
city = dsl.point(26691955, (2.2481797, 48.9479069),
{'addr:postcode': u'95100', 'capital': u'7', 'name': u'Argenteuil',
'place': u'city', 'population': u'104282',
'ref:SIREN': u'219500188', 'source': u'openstreetmap.org',
'source:population': u'INSEE 2007', 'wikidata': u'Q181946',
'wikipedia': u'fr:Argenteuil (Val-dOise)', })

self.validate_est_population(city, (z, x, y), 8, 9, 10000)

def test_town(self):
z, x, y = (11, 1036, 703)
# https://www.openstreetmap.org/node/26691480
town = dsl.point(26691480, (2.2303498, 48.986025), {
'alt_name': u'Franconville',
'name': u'Franconville-la-Garenne',
'place': u'town',
'population': u'33097',
'source': u'openstreetmap.org',
'source:population': u'INSEE 2013',
'wikidata': u'Q237333',
})
self.validate_est_population(town, (z, x, y), 8, 10, 5000)

def test_locality(self):
z, x, y = (14, 8296, 5638)
# https://www.openstreetmap.org/node/442197
locality = dsl.point(442197, (2.2883604, 48.8326932),
{'name': u'Porte de Versailles', 'place': u'locality', 'population': u'1121',
'source': u'openstreetmap.org',
'unsigned': u'no', })
self.validate_est_population(locality, (z, x, y), 13, 14, 1000)

def test_village(self):
z, x, y = (13, 4141, 2827)
# https://www.openstreetmap.org/node/602470737
village = dsl.point(602470737, (1.9878964, 48.5872266),
{'addr:postcode': u'78730', 'name': u'Rochefort-en-Yvelines', 'place': u'village',
'population': u'956', 'source': u'openstreetmap.org', })

self.validate_est_population(village, (z, x, y), 12, 13, 2000)

def test_hamlet(self):
z, x, y = (15, 16563, 11302)
# https://www.openstreetmap.org/node/534228360
hamlet = dsl.point(534228360, (1.967011, 48.6425931),
{'name': u'Les Bordes', 'place': u'hamlet', 'population': u'816',
'source': u'openstreetmap.org', })
self.validate_est_population(hamlet, (z, x, y), 13, 14, 200)

def test_isolated_dwelling(self):
z, x, y = (16, 33142, 22608)
# https://www.openstreetmap.org/node/5111001636
dwelling = dsl.point(5111001636, (2.0597882, 48.6321613),
{'name': u'La Maison Grise', 'place': u'isolated_dwelling', 'population': u'220',
'source': u'openstreetmap.org', })
self.validate_est_population(dwelling, (z, x, y), 14, 15, 100)

def test_farm(self):
z, x, y = (16, 33137, 22614)
# https://www.openstreetmap.org/node/5922383856
farm = dsl.point(5922383856, (2.0303734, 48.6082567),
{'contact:website': u'https://www.fermedesclos.com/', 'name': u'Ferme des Clos',
'place': u'farm', 'population': u'91', 'source': u'openstreetmap.org', })
self.validate_est_population(farm, (z, x, y), 14, 15, 50)
Loading