Skip to content

Instantly share code, notes, and snippets.

@rbanick
Created August 30, 2016 10:53
Show Gist options
  • Save rbanick/0f052a6b63eb5022358e15a215626747 to your computer and use it in GitHub Desktop.
Save rbanick/0f052a6b63eb5022358e15a215626747 to your computer and use it in GitHub Desktop.
comparing OSM to survey data
CREATE TABLE comparison AS
select aug29_clean.cluster,
count(*) as total,
sum(case when aug29_clean.b_materials=exposure_matching.b_materials then 1 else 0 end) as building_materials,
sum(case when aug29_clean.b_levels=exposure_matching.b_levels then 1 else 0 end) as building_levels,
sum(case when aug29_clean.b_category=exposure_matching.b_category then 1 else 0 end) as building_type,
sum(case when aug29_clean.b_foundation=exposure_matching.b_foundation then 1 else 0 end) as building_foundation,
sum(case when aug29_clean.b_age=exposure_matching.b_age then 1 else 0 end) as building_age,
sum(case when aug29_clean.r_shape=exposure_matching.r_shape then 1 else 0 end) as roof_shape,
sum(case when aug29_clean.r_materials=exposure_matching.r_material then 1 else 0 end) as roof_materials
from aug29_clean,exposure_matching
WHERE aug29_clean.osm_way_id=exposure_matching.osm_way_id
GROUP BY cluster;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment