location_distance FLOAT;
location_parent GEOMETRY;
location_isaddress BOOLEAN;
+ location_keywords INTEGER[];
tagpairid INTEGER;
IF location.rank_address != location_rank_search THEN
location_rank_search := location.rank_address;
- location_distance := location.distance * 1.5;
+ IF location.isguess THEN
+ location_distance := location.distance * 1.5;
+ ELSE
+ IF location.rank_address <= 12 THEN
+ -- for county and above, if we have an area consider that exact
+ -- (It would be nice to relax the constraint for places close to
+ -- the boundary but we'd need the exact geometry for that. Too
+ -- expensive.)
+ location_distance = 0;
+ ELSE
+ -- Below county level remain slightly fuzzy.
+ location_distance := location.distance * 0.5;
+ END IF;
+ END IF;
+ ELSE
+ CONTINUE WHEN location.keywords <@ location_keywords;
END IF;
IF location.distance < location_distance OR NOT location.isguess THEN
+ location_keywords := location.keywords;
location_isaddress := NOT address_havelevel[location.rank_address];
IF location_isaddress AND location.isguess AND location_parent IS NOT NULL THEN
When updating osm data
Then table place has no entry for R1
+
+Scenario: Change type of a relation
+ Given the osm nodes:
+ | id | geometry
+ | 200 | 0 0
+ | 201 | 0 0.0001
+ | 202 | 0.0001 0.0001
+ | 203 | 0.0001 0
+ Given the osm ways:
+ | id | tags | nodes
+ | 2 | 'ref' : '45' | 200 201 202 203 200
+ Given the osm relations:
+ | id | tags | members
+ | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When loading osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'XZ'
+ Given the osm relations:
+ | action | id | tags | members
+ | M | 1 | 'type' : 'multipolygon', 'amenity' : 'prison', 'name' : 'XZ' | W2
+ When updating osm data
+ Then table place has no entry for R1:tourism
+ And table place contains
+ | object | class | type | name
+ | R1 | amenity | prison | 'name' : 'XZ'
+
+Scenario: Change name of a relation
+ Given the osm nodes:
+ | id | geometry
+ | 200 | 0 0
+ | 201 | 0 0.0001
+ | 202 | 0.0001 0.0001
+ | 203 | 0.0001 0
+ Given the osm ways:
+ | id | tags | nodes
+ | 2 | 'ref' : '45' | 200 201 202 203 200
+ Given the osm relations:
+ | id | tags | members
+ | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'AB' | W2
+ When loading osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'AB'
+ Given the osm relations:
+ | action | id | tags | members
+ | M | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When updating osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'XZ'
+
+
+Scenario: Change type of a relation into something unknown
+ Given the osm nodes:
+ | id | geometry
+ | 200 | 0 0
+ | 201 | 0 0.0001
+ | 202 | 0.0001 0.0001
+ | 203 | 0.0001 0
+ Given the osm ways:
+ | id | tags | nodes
+ | 2 | 'ref' : '45' | 200 201 202 203 200
+ Given the osm relations:
+ | id | tags | members
+ | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When loading osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'XZ'
+ Given the osm relations:
+ | action | id | tags | members
+ | M | 1 | 'type' : 'multipolygon', 'amenities' : 'prison', 'name' : 'XZ' | W2
+ When updating osm data
+ Then table place has no entry for R1
+
+Scenario: Type tag is removed
+ Given the osm nodes:
+ | id | geometry
+ | 200 | 0 0
+ | 201 | 0 0.0001
+ | 202 | 0.0001 0.0001
+ | 203 | 0.0001 0
+ Given the osm ways:
+ | id | tags | nodes
+ | 2 | 'ref' : '45' | 200 201 202 203 200
+ Given the osm relations:
+ | id | tags | members
+ | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When loading osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'XZ'
+ Given the osm relations:
+ | action | id | tags | members
+ | M | 1 | 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When updating osm data
+ Then table place has no entry for R1
+
+Scenario: Type tag is renamed to something unknown
+ Given the osm nodes:
+ | id | geometry
+ | 200 | 0 0
+ | 201 | 0 0.0001
+ | 202 | 0.0001 0.0001
+ | 203 | 0.0001 0
+ Given the osm ways:
+ | id | tags | nodes
+ | 2 | 'ref' : '45' | 200 201 202 203 200
+ Given the osm relations:
+ | id | tags | members
+ | 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When loading osm data
+ Then table place contains
+ | object | class | type | name
+ | R1 | tourism | hotel | 'name' : 'XZ'
+ Given the osm relations:
+ | action | id | tags | members
+ | M | 1 | 'type' : 'multipolygonn', 'tourism' : 'hotel', 'name' : 'XZ' | W2
+ When updating osm data
+ Then table place has no entry for R1
+