[osm] neighborhood polygon reader

This commit is contained in:
Al
2017-02-14 01:50:04 -05:00
parent 6c68d446a0
commit 6d580f4c87

View File

@@ -19,6 +19,7 @@ from geodata.file_utils import ensure_dir
from geodata.graph.scc import strongly_connected_components
from geodata.i18n.languages import osm_admin1_ids
from geodata.math.floats import isclose
from geodata.osm.definitions import osm_definitions
from geodata.osm.extract import *
@@ -317,6 +318,11 @@ class OSMCountryPolygonReader(OSMPolygonReader):
return 'ISO3166-1:alpha2' in props or (props.get('type', 'relation'), safe_encode(props.get('id', ''))) in osm_admin1_ids
class OSMNeighborhoodPolygonReader(OSMPolygonReader):
def include_polygon(self, props):
return osm_definitions.meets_definition(props, osm_definitions.NEIGHBORHOOD)
class OSMPostalCodesPolygonReader(OSMPolygonReader):
def include_polygon(self, props):
return props.get('boundary') == 'postal_code'