Skip to content

Commit

Permalink
add match rule 7
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Chalstrey authored and Ed Chalstrey committed Mar 23, 2020
1 parent 820a018 commit 2dbf9c1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
3 changes: 1 addition & 2 deletions db/data-matching-rules/rule-6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ insert into matches
select '6', repd.master_repd_id, NULL, mv_repd_neighbours.mv_id
from mv_repd_neighbours, repd
where repd.repd_id = mv_repd_neighbours.repd_id
and mv_repd_neighbours.distance_meters < 1000
order by distance_meters;
and mv_repd_neighbours.distance_meters < 1000;
8 changes: 8 additions & 0 deletions db/data-matching-rules/rule-7.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Match rule 7 (see doc/matching.md)
\echo -n Performing match rule 7...

insert into matches
select '7', NULL, osm.master_osm_id, osm_mv_neighbours.mv_id
from osm_mv_neighbours, osm
where osm.osm_id = osm_mv_neighbours.osm_id
and osm_mv_neighbours.distance_meters < 1000;
3 changes: 3 additions & 0 deletions db/data-matching.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ select * into repd_non_operational from repd where dev_status != 'Operational';

-- REPD-MV matching
\include data-matching-rules/rule-6.sql

-- OSM-MV matching
\include data-matching-rules/rule-7.sql
5 changes: 4 additions & 1 deletion doc/matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Repeat matching rules 1-5 for non-operational REPD entries. Label these match ru
First, proximity match to get the nearest neighbouring OSM way/relation for every single Machine Vision object and separately, the nearest REPD for each Machine Vision Object.

6. Nearest neighbour REPD to each Machine Vision object, below a 1000m distance threshold.
7. Nearest neighbour OSM way/relation to each Machine Vision object, but only those that didn't already find a match with REPD (bear in mind that REPD already linked to OSM at this point).
7. Nearest neighbour OSM way/relation to each Machine Vision object, below a 1000m distance threshold.

# Matches

Expand All @@ -39,6 +39,9 @@ First, proximity match to get the nearest neighbouring OSM way/relation for ever
| 3a | 46 | 2,221|
| 4a | 893 | 3,114|
| 5a | 0 | 3,114|
| ---- | ----- | ----- |
| 6 | 1,759| |
| 7 | 1,851| |

# Notes

Expand Down
20 changes: 20 additions & 0 deletions explorations/final_round/match-rule-7.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

select
osm_mv_neighbours.osm_id,
osm.master_osm_id,
machine_vision.mv_id,
osm_mv_neighbours.osm_date,
osm_mv_neighbours.mv_date,
osm_mv_neighbours.osm_area,
osm_mv_neighbours.mv_area,
osm_mv_neighbours.distance_meters,
osm.latitude as osm_lat,
osm.longitude as osm_lon,
machine_vision.latitude as mv_lat,
machine_vision.longitude as mv_lon,
osm.objtype,
osm.located
from osm_mv_neighbours, osm, machine_vision
where osm.osm_id = osm_mv_neighbours.osm_id
and machine_vision.mv_id = osm_mv_neighbours.mv_id
order by distance_meters;

0 comments on commit 2dbf9c1

Please sign in to comment.