-- prefill word table
select count(make_keywords(v)) from (select distinct svals(name) as v from place) as w where v is not null;
-select count(make_keywords(v)) from (select distinct postcode as v from place) as w where v is not null;
-select count(getorcreate_housenumber_id(make_standard_name(v))) from (select distinct housenumber as v from place where housenumber is not null) as w;
+select count(make_keywords(v)) from (select distinct address->'postcode' as v from place where address ? 'postcode') as w where v is not null;
+select count(getorcreate_housenumber_id(make_standard_name(v))) from (select distinct address->'housenumber' as v from place where address ? 'housenumber') as w;
-- copy the word frequencies
update word set search_name_count = count from word_frequencies wf where wf.word_token = word.word_token;
NEW.name := hstore('ref', NEW.address->'postcode');
END IF;
+ IF NEW.class in ('boundary')
+ AND ST_GeometryType(NEW.geometry) not in ('ST_Polygon','ST_MultiPolygon') THEN
+ DELETE FROM placex where place_id = existingplacex.place_id;
+ RETURN NULL;
+ END IF;
+
update placex set
name = NEW.name,
address = NEW.address,
update location_property_osmline p set indexed_status = 2 from planet_osm_ways w where p.linegeo && NEW.geometry and p.osm_id = w.id and NEW.osm_id = any(w.nodes);
END IF;
+ -- linked places should get potential new naming and addresses
+ IF existingplacex.linked_place_id is not NULL THEN
+ update placex x set
+ name = p.name,
+ extratags = p.extratags,
+ indexed_status = 2
+ from place p
+ where x.place_id = existingplacex.linked_place_id
+ and x.indexed_status = 0
+ and x.osm_type = p.osm_type
+ and x.osm_id = p.osm_id
+ and x.class = p.class;
+ END IF;
+
END IF;
-- Abort the add (we modified the existing place instead)
| json |
| jsonv2 |
- @wip
Scenario Outline: Boundingbox is returned
When sending <format> reverse coordinates 14.62,108.1
| zoom |
| ID | osm_type | osm_id |
| 0 | R | 2 |
- @wip
Scenario: Postcode boundaries without ref
Given the places
| osm | class | type | postcode | geometry |
| osm_type |
| R |
+ Scenario: Update linking relation when linkee name is updated
+ Given the places
+ | osm | class | type | name | admin | geometry |
+ | R1 | boundary | administrative | rel | 8 | poly-area:0.1 |
+ And the places
+ | osm | class | type | name+name:de | admin | geometry |
+ | N3 | place | city | pnt | 30 | 0.00001 0 |
+ And the relations
+ | id | members |
+ | 1 | N3:label |
+ When importing
+ Then placex contains
+ | object | linked_place_id | name+name:de |
+ | R1 | - | pnt |
+ | N3 | R1 | pnt |
+ When updating places
+ | osm | class | type | name+name:de | admin | geometry |
+ | N3 | place | city | newname | 30 | 0.00001 0 |
+ Then placex contains
+ | object | linked_place_id | name+name:de |
+ | N3 | R1 | newname |
+ | R1 | - | newname |
+
+ Scenario: Updating linkee extratags keeps linker's extratags
+ Given the named places
+ | osm | class | type | extra+wikidata | admin | geometry |
+ | R1 | boundary | administrative | 34 | 8 | poly-area:0.1 |
+ And the named places
+ | osm | class | type | geometry |
+ | N3 | place | city | 0.00001 0 |
+ And the relations
+ | id | members |
+ | 1 | N3:label |
+ When importing
+ Then placex contains
+ | object | extratags |
+ | R1 | 'wikidata' : '34', 'place' : 'city' |
+ When updating places
+ | osm | class | type | name | extra+oneway | admin | geometry |
+ | N3 | place | city | newname | yes | 30 | 0.00001 0 |
+ Then placex contains
+ | object | extratags |
+ | R1 | 'wikidata' : '34', 'oneway' : 'yes', 'place' : 'city' |
+
Then placex contains
| object | class | type |
| N3 | place | house |
+
+ Scenario: remove boundary when changing from polygon to way
+ Given the grid
+ | 1 | 2 |
+ | 3 | 4 |
+ And the places
+ | osm | class | type | name | admin | geometry |
+ | W1 | boundary | administrative | Haha | 5 | (1, 2, 4, 3, 1) |
+ When importing
+ Then placex contains
+ | object |
+ | W1 |
+ When updating places
+ | osm | class | type | name | admin | geometry |
+ | W1 | boundary | administrative | Haha | 5 | 1, 2, 4, 3 |
+ Then placex has no entry for W1
| object | class | type | geometry |
| W1 | highway | primary | 0 0, 0 0.1, 0.1 0.2 |
- @wip
Scenario: Import of ballon areas
When loading osm data
"""
if exact:
expected_content.add((res['osm_type'], res['osm_id'], res['class']))
for h in row.headings:
- if h.startswith('name'):
+ if h in ('extratags', 'address'):
+ if row[h] == '-':
+ assert_is_none(res[h])
+ else:
+ vdict = eval('{' + row[h] + '}')
+ assert_equals(vdict, res[h])
+ elif h.startswith('name'):
name = h[5:] if h.startswith('name+') else 'name'
assert_in(name, res['name'])
eq_(res['name'][name], row[h])