From 091f46cb7dcaddc4c8842342341bc29d7c861dbf Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 17 May 2016 16:39:47 -0400 Subject: [PATCH] [polygons] Adding university and hospital polygons to the subdivisions index, (multiple sub-buildings but still want to know the parent entity) --- scripts/geodata/osm/admin_boundaries.py | 2 +- scripts/geodata/osm/fetch_osm_address_data.sh | 3 ++- scripts/geodata/polygons/reverse_geocode.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/geodata/osm/admin_boundaries.py b/scripts/geodata/osm/admin_boundaries.py index 2e9a349d..0d8cbef2 100644 --- a/scripts/geodata/osm/admin_boundaries.py +++ b/scripts/geodata/osm/admin_boundaries.py @@ -251,7 +251,7 @@ class OSMAdminPolygonReader(OSMPolygonReader): class OSMSubdivisionPolygonReader(OSMPolygonReader): def include_polygon(self, props): - return 'landuse' in props or 'place' in props + return 'landuse' in props or 'place' in props or 'amenity' in props class OSMBuildingPolygonReader(OSMPolygonReader): diff --git a/scripts/geodata/osm/fetch_osm_address_data.sh b/scripts/geodata/osm/fetch_osm_address_data.sh index 143413dc..68a60732 100755 --- a/scripts/geodata/osm/fetch_osm_address_data.sh +++ b/scripts/geodata/osm/fetch_osm_address_data.sh @@ -98,9 +98,10 @@ osmfilter $PLANET_O5M --keep="name= and ( $VALID_NEIGHBORHOODS )" --drop-relatio echo "Filtering for subdivision polygons" PLANET_SUBDIVISIONS="planet-subdivisions.osm" +SUBDIVISION_AMENITY_TYPES="amenity=university or amentiy=college or amentiy=school or amentiy=hospital" SUBDIVISION_LANDUSE_TYPES="landuse=residential or landuse=commercial or landuse=industrial or landuse=retail or landuse=military" SUBDIVISION_PLACE_TYPES="place=allotmenets or place=city_block or place=plot or place=subdivision" -osmfilter $PLANET_O5M --keep="( $SUBDIVISION_PLACE_TYPES or $SUBDIVISION_LANDUSE_TYPES )" --drop="( place= and not ( $SUBDIVISION_PLACE_TYPES ) ) or boundary=" --drop-author --drop-version -o=$PLANET_SUBDIVISIONS +osmfilter $PLANET_O5M --keep="( $SUBDIVISION_AMENITY_TYPES or $SUBDIVISION_PLACE_TYPES or $SUBDIVISION_LANDUSE_TYPES )" --drop="( place= and not ( $SUBDIVISION_PLACE_TYPES ) ) or boundary=" --drop-author --drop-version -o=$PLANET_SUBDIVISIONS echo "Filtering for postal_code polygons" PLANET_POSTAL_CODES="planet-postcodes.osm" diff --git a/scripts/geodata/polygons/reverse_geocode.py b/scripts/geodata/polygons/reverse_geocode.py index 20fa7bae..835cafa1 100644 --- a/scripts/geodata/polygons/reverse_geocode.py +++ b/scripts/geodata/polygons/reverse_geocode.py @@ -434,7 +434,7 @@ class OSMSubdivisionReverseGeocoder(OSMReverseGeocoder): cache_size = 10000 simplify_polygons = False polygon_reader = OSMSubdivisionPolygonReader - include_property_patterns = OSMReverseGeocoder.include_property_patterns | set(['landuse', 'place']) + include_property_patterns = OSMReverseGeocoder.include_property_patterns | set(['landuse', 'place', 'amenity']) class OSMBuildingReverseGeocoder(OSMReverseGeocoder):