Skip to content

Commit

Permalink
Merge pull request #200 from hotosm/fix/data-models
Browse files Browse the repository at this point in the history
Fix data models, remove join_or syntax
  • Loading branch information
robsavoye authored Oct 9, 2023
2 parents 694961d + a1118e7 commit 11c7777
Show file tree
Hide file tree
Showing 21 changed files with 244 additions and 189 deletions.
6 changes: 3 additions & 3 deletions docs/about/make_data_extract.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ ways, but needed to be automated to be used for FMTM.

## Examples

Make\*data_extract uses a Postgres database to extract OSM data. By
Make\*data*extract uses a Postgres database to extract OSM data. By
default, the program uses **localhost** as the database host. If you
use \**underpass*as the data base name, this will remotely access the
[Humanitarian OpenStreetMap Team(HOT)](https://www.hotosm.org)
maintained OSM database that covers the entire planet, and is updated
every minute. The name of the database can be specified using the
_--uri\*\* option. The program extracts the buildings category of OSM
*--uri\*\* option. The program extracts the buildings category of OSM
data by default. The size of the extracted data can be limited using
the _--boundary\* option. The program outputs the data in GeoJSON
the \_--boundary\* option. The program outputs the data in GeoJSON
format.

For raw OSM data, the existing country data is downloaded from [GeoFabrik](https://download.geofabrik.de/index.html), and imported using a
Expand Down
2 changes: 0 additions & 2 deletions osm_fieldwork/data_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
amenities = f"{data_models_path}/amenities.yaml"
buildings = f"{data_models_path}/buildings.yaml"
camping = f"{data_models_path}/camping.yaml"
category = f"{data_models_path}/category.yaml"
cemeteries = f"{data_models_path}/cemeteries.yaml"
education = f"{data_models_path}/education.yaml"
emergency = f"{data_models_path}/emergency.yaml"
health = f"{data_models_path}/health.yaml"
highways = f"{data_models_path}/highways.yaml"
landusage = f"{data_models_path}/landusage.yaml"
models = f"{data_models_path}/models.yaml"
nature = f"{data_models_path}/nature.yaml"
places = f"{data_models_path}/places.yaml"
religious = f"{data_models_path}/religious.yaml"
Expand Down
34 changes: 25 additions & 9 deletions osm_fieldwork/data_models/amenities.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
select:
osm_id: id
osm_id: id
from:
- nodes
- ways_poly
- nodes
- ways_poly
where:
tags:
- join_or:
- { amenity: [brewery, cafe, bar, pub, fuel, fire_station, library,
townhall, courthouse, hospital, restaurant, clinic], shop:
[alcohol, bakery, car_parts, hardware, convienience, general],
cusine: not null}
- amenity:
- brewery
- cafe
- bar
- pub
- fuel
- fire_station
- library
- townhall
- courthouse
- hospital
- restaurant
- clinic
shop:
- alcohol
- bakery
- car_parts
- hardware
- convienience
- general
cuisine: not null

keep:
- leisure
Expand All @@ -23,7 +39,7 @@ keep:
- parking
- amenity
- shop
- cusine
- cuisine
- amenity
- convenience
- diesel
32 changes: 17 additions & 15 deletions osm_fieldwork/data_models/buildings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ from:
- ways_poly
where:
tags:
- join_or:
- { building: not null, amenity: not null, tourism: not null }
- building: not null
amenity: not null
tourism: not null

keep:
- building
- building:levels
- building:material
- roof:material
- roof:shape
- roof:levels
- cusine
- amenity
- convenience
- diesel
- version
- name
- name:en
- building
- building:levels
- building:material
- roof:material
- roof:shape
- roof:levels
- cuisine
- amenity
- convenience
- diesel
- version
- name
- name:en
5 changes: 3 additions & 2 deletions osm_fieldwork/data_models/camping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ from:
- ways_poly
where:
tags:
- join_or:
- { tourism: [camp_site, camp_pitch] }
- tourism:
- camp_site
- camp_pitch

keep:
- leisure
Expand Down
6 changes: 4 additions & 2 deletions osm_fieldwork/data_models/cemeteries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ from:
- ways_poly
where:
tags:
- join_or:
- { amenity: [grave_yard], landuse: [cemetery] }
- amenity:
- grave_yard
landuse:
- cemetery
20 changes: 8 additions & 12 deletions osm_fieldwork/data_models/education.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ from:
- ways_poly
where:
tags:
- join_or:
- {
amenity:
[
college,
indergarten,
school,
music_school,
language_school,
university,
],
}
- amenity:
- college
- indergarten
- school
- music_school
- language_school
- university

keep:
- wheelchar
- religion
Expand Down
4 changes: 2 additions & 2 deletions osm_fieldwork/data_models/emergency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ from:
- ways_poly
where:
tags:
- join_or:
- { emergency: not null, fire_hydrant:type: not null }
- emergency: not null
fire_hydrant:type: not null
10 changes: 4 additions & 6 deletions osm_fieldwork/data_models/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ from:
- ways_poly
where:
tags:
- join_or:
- {
healthcare: not null,
social_facility: not null,
healthcare:speciality: not null,
}
- healthcare: not null
social_facility: not null
healthcare:speciality: not null

keep:
- healthcare:type
- healthcare
Expand Down
3 changes: 1 addition & 2 deletions osm_fieldwork/data_models/highways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ from:
- ways_line
where:
tags:
- join_or:
- { highway: not null }
- highway: not null
keep:
- name
- smoothness
Expand Down
3 changes: 1 addition & 2 deletions osm_fieldwork/data_models/landusage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ from:
- ways_poly
where:
tags:
- join_or:
- { landuse: not null }
- landuse: not null
3 changes: 1 addition & 2 deletions osm_fieldwork/data_models/nature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ from:
- ways_poly
where:
tags:
- join_or:
- { natural: not null }
- natural: not null
3 changes: 1 addition & 2 deletions osm_fieldwork/data_models/places.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ from:
- ways_poly
where:
tags:
- join_or:
- { place: not null }
- place: not null
3 changes: 1 addition & 2 deletions osm_fieldwork/data_models/religious.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ from:
- ways_poly
where:
tags:
- join_or:
- { religion: not null }
- religion: not null
15 changes: 6 additions & 9 deletions osm_fieldwork/data_models/toilets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ from:
- ways_poly
where:
tags:
- join_or:
- {
amenity: not null,
toilets:access: not null,
toilets:disposal: not null,
toilets:position: not null,
toilets:unisex: not null,
toilets:wheelchair: not null,
}
- amenity: not null
toilets:access: not null
toilets:disposal: not null
toilets:position: not null
toilets:unisex: not null
toilets:wheelchair: not null
31 changes: 13 additions & 18 deletions osm_fieldwork/data_models/wastedisposal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@ from:
- ways_poly
where:
tags:
- join_or:
- {
amenity:
[
waste_disposal,
waste_dump_site,
waste_transfer_station,
waste_basket,
recycling,
landfill,
],
waste: not null,
recycling_type: not null,
recycling: not null,
recycling:aluminum: not null,
recycling:glass: not null,
recycling:hazardous_waste: not null,
}
- amenity:
- waste_disposal
- waste_dump_site
- waste_transfer_station
- waste_basket
- recycling
- landfill
waste: not null
recycling_type: not null
recycling: not null
recycling:aluminum: not null
recycling:glass: not null
recycling:hazardous_waste: not null
11 changes: 5 additions & 6 deletions osm_fieldwork/data_models/waterpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ from:
- ways_poly
where:
tags:
- join_or:
- {
drinking_water: not null,
amenity: [drinking_water, water_point],
man_made: [water_tap],
}
- drinking_water: not null
amenity:
- drinking_water
- water_point
man_made: water_tap
4 changes: 2 additions & 2 deletions osm_fieldwork/data_models/waterways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ from:
- ways_line
where:
tags:
- join_or:
- { waterway: not null }
- waterway: not null

keep:
- name
- intermittent
Loading

0 comments on commit 11c7777

Please sign in to comment.