Skip to content

Commit

Permalink
update match rule 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Chalstrey authored and Ed Chalstrey committed Mar 18, 2020
1 parent b2a1203 commit 9a96a98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 11 additions & 3 deletions db/data-matching.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ select osm_repd_neighbours.osm_id,
where osm_repd_neighbours.osm_id = osm_repd_id_mapping.osm_id;

-- Match rule 1 (see doc/matching.md)
drop table if exists repd_copy;
select * into repd_copy from repd;
insert into matches
select repd.master_repd_id, osm.master_osm_id
from osm_with_existing_repd_neighbours, osm, repd
from osm_with_existing_repd_neighbours, osm, repd, repd_copy
-- Table linking:
where osm_with_existing_repd_neighbours.osm_id = osm.osm_id
and osm_with_existing_repd_neighbours.closest_geo_match_from_repd_repd_id = repd.repd_id
and (osm_with_existing_repd_neighbours.repd_id_in_osm = osm_with_existing_repd_neighbours.closest_geo_match_from_repd_repd_id
and osm_with_existing_repd_neighbours.repd_id_in_osm = repd_copy.repd_id
-- Matching relevant:
and (osm_with_existing_repd_neighbours.repd_id_in_osm = osm_with_existing_repd_neighbours.closest_geo_match_from_repd_repd_id
or osm_with_existing_repd_neighbours.repd_id_in_osm = osm_with_existing_repd_neighbours.closest_geo_match_from_repd_co_location_repd_id
or osm_with_existing_repd_neighbours.repd_id_in_osm = repd.master_repd_id);
or osm_with_existing_repd_neighbours.repd_id_in_osm = repd.master_repd_id
or osm_with_existing_repd_neighbours.closest_geo_match_from_repd_repd_id = repd_copy.co_location_repd_id
or osm_with_existing_repd_neighbours.closest_geo_match_from_repd_repd_id = repd_copy.master_repd_id
);
8 changes: 7 additions & 1 deletion doc/matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ This note documents the matching of entities between the various datasets in the
# Match Rules:

1. The nearest neighbour in meters of OSM entries to REPD entries where the REPD ID is the same as that already present in OSM data. Accept those that are the same (regardless of distance).
2. Nearest neighbour for remaining OSM where the `objtype` is `way` or `relation` and the object is a "group master" (the `osm_id = master_osm_id` or `repd_id = master_repd_id`). Accept all matches that are below a distance threshold and don't exceed a capacity difference of X.
2. Nearest neighbour for remaining OSM/REPD where the OSM `objtype` is `way` or `relation` and the object is a "group master" (the `osm_id = master_osm_id` or `repd_id = master_repd_id`). Accept all matches that are below a distance threshold and don't exceed a capacity difference of X.

# Matches

| Rule | Count |
| --- | --- |
| 1 | 880 |

0 comments on commit 9a96a98

Please sign in to comment.