[osm] neighborhood polygon reader
This commit is contained in:
@@ -19,6 +19,7 @@ from geodata.file_utils import ensure_dir
|
|||||||
from geodata.graph.scc import strongly_connected_components
|
from geodata.graph.scc import strongly_connected_components
|
||||||
from geodata.i18n.languages import osm_admin1_ids
|
from geodata.i18n.languages import osm_admin1_ids
|
||||||
from geodata.math.floats import isclose
|
from geodata.math.floats import isclose
|
||||||
|
from geodata.osm.definitions import osm_definitions
|
||||||
from geodata.osm.extract import *
|
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
|
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):
|
class OSMPostalCodesPolygonReader(OSMPolygonReader):
|
||||||
def include_polygon(self, props):
|
def include_polygon(self, props):
|
||||||
return props.get('boundary') == 'postal_code'
|
return props.get('boundary') == 'postal_code'
|
||||||
|
|||||||
Reference in New Issue
Block a user