mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-24 13:31:37 +03:00
add simple tests for postcode import
This commit is contained in:
parent
f9205caf22
commit
e55ac77c94
115
test/bdd/db/import/postcodes.feature
Normal file
115
test/bdd/db/import/postcodes.feature
Normal file
@ -0,0 +1,115 @@
|
||||
@DB
|
||||
Feature: Import of postcodes
|
||||
Tests for postcode estimation
|
||||
|
||||
Scenario: Postcodes on the object are prefered over those on the address
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | admin | addr+postcode | geometry |
|
||||
| R1 | boundary | administrative | 6 | 112 | :b0 |
|
||||
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
|
||||
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
|
||||
And the named places
|
||||
| osm | class | type | addr+postcode | geometry |
|
||||
| W93 | highway | residential | 112 DE 344 | :w2N |
|
||||
| W22 | building | yes | 112 DE 344N | :building:w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode |
|
||||
| W22 | 112 DE 344N |
|
||||
| W93 | 112 DE 344 |
|
||||
| R4 | 112 DE 34 |
|
||||
| R34 | 112 DE |
|
||||
| R1 | 112 |
|
||||
|
||||
Scenario: Postcodes from a road are inherited by an attached building
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | addr+postcode | geometry |
|
||||
| W93 | highway | residential | 86034 | :w2N |
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W22 | building | yes | :building:w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode | parent_place_id |
|
||||
| W22 | 86034 | W93 |
|
||||
|
||||
Scenario: Postcodes from the lowest admin area are inherited by ways
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | admin | addr+postcode | geometry |
|
||||
| R1 | boundary | administrative | 6 | 112 | :b0 |
|
||||
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
|
||||
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W93 | highway | residential | :w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode |
|
||||
| W93 | 112 DE 34 |
|
||||
|
||||
Scenario: Postcodes from the lowest admin area with postcode are inherited by ways
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | admin | addr+postcode | geometry |
|
||||
| R1 | boundary | administrative | 6 | 112 | :b0 |
|
||||
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
|
||||
And the named places
|
||||
| osm | class | type | admin | geometry |
|
||||
| R4 | boundary | administrative | 10 | :b2:N |
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W93 | highway | residential | :w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode | parent_place_id |
|
||||
| W93 | 112 DE | R4 |
|
||||
|
||||
Scenario: Postcodes from the lowest admin area are inherited by buildings
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | admin | addr+postcode | geometry |
|
||||
| R1 | boundary | administrative | 6 | 112 | :b0 |
|
||||
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
|
||||
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W22 | building | yes | :building:w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode |
|
||||
| W22 | 112 DE 34 |
|
||||
|
||||
Scenario: Roads get postcodes from nearby buildings without other info
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W93 | highway | residential | :w2N |
|
||||
And the named places
|
||||
| osm | class | type | addr+postcode | geometry |
|
||||
| W22 | building | yes | 445023 | :building:w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode |
|
||||
| W93 | 445023 |
|
||||
|
||||
@wip
|
||||
Scenario: Postcodes from admin boundaries are preferred over estimated postcodes
|
||||
Given the scene admin-areas
|
||||
And the named places
|
||||
| osm | class | type | admin | addr+postcode | geometry |
|
||||
| R1 | boundary | administrative | 6 | 112 | :b0 |
|
||||
| R34 | boundary | administrative | 8 | 112 DE | :b1:E |
|
||||
| R4 | boundary | administrative | 10 | 112 DE 34 | :b2:N |
|
||||
And the named places
|
||||
| osm | class | type | geometry |
|
||||
| W93 | highway | residential | :w2N |
|
||||
And the named places
|
||||
| osm | class | type | addr+postcode | geometry |
|
||||
| W22 | building | yes | 445023 | :building:w2N |
|
||||
When importing
|
||||
Then placex contains
|
||||
| object | postcode |
|
||||
| W93 | 112 DE 34 |
|
@ -287,7 +287,7 @@ def import_and_index_data_from_place_table(context):
|
||||
WHERE class='place' and type='houses' and osm_type='W'
|
||||
and ST_GeometryType(geometry) = 'ST_LineString'""")
|
||||
context.db.commit()
|
||||
context.nominatim.run_setup_script('index', 'index-noanalyse')
|
||||
context.nominatim.run_setup_script('calculate-postcodes', 'index', 'index-noanalyse')
|
||||
|
||||
@when("updating places")
|
||||
def update_place_table(context):
|
||||
|
@ -4,4 +4,4 @@ n-outer | POINT(1.0039478 2.0004676)
|
||||
n-edge-WE | POINT(1.0039599 2.0002345)
|
||||
w-WE | LINESTRING(1.0031759 2.0002316,1.0040361 2.0002211,1.0042735 2.0002264)
|
||||
w-NS | LINESTRING(1.0040414 2.0001051,1.0040361 2.0002211,1.0040364 2.0006377)
|
||||
w-building | MULTIPOLYGON(((1.0040019 2.000324,1.0040016 2.0002344,1.0039599 2.0002345,1.0039037 2.0002347,1.0039043 2.0004389,1.0040023 2.0004386,1.0040019 2.000324)))
|
||||
w-building | MULTIPOLYGON(((1.0039037 2.0002347,1.0039599 2.0002345,1.0040016 2.0002344,1.0040019 2.000324,1.0040023 2.0004386,1.0039043 2.0004389,1.0039037 2.0002347)))
|
||||
|
@ -1,11 +1,11 @@
|
||||
0.0001 | MULTIPOLYGON(((0.001 0,0 0,0 0.1,0.001 0.1,0.001 0)))
|
||||
0.0005 | MULTIPOLYGON(((0.005 0,0 0,0 0.1,0.005 0.1,0.005 0)))
|
||||
0.001 | MULTIPOLYGON(((0.01 0,0 0,0 0.1,0.01 0.1,0.01 0)))
|
||||
0.005 | MULTIPOLYGON(((0.05 0,0 0,0 0.1,0.05 0.1,0.05 0)))
|
||||
0.01 | MULTIPOLYGON(((0.1 0,0 0,0 0.1,0.1 0.1,0.1 0)))
|
||||
0.05 | MULTIPOLYGON(((0.5 0,0 0,0 0.1,0.5 0.1,0.5 0)))
|
||||
0.1 | MULTIPOLYGON(((0.1 0,0 0,0 1,0.1 1,0.1 0)))
|
||||
0.5 | MULTIPOLYGON(((0.5 0,0 0,0 1,0.5 1,0.5 0)))
|
||||
1.0 | MULTIPOLYGON(((1 0,0 0,0 1,1 1,1 0)))
|
||||
2.0 | MULTIPOLYGON(((2 0,0 0,0 1,2 1,2 0)))
|
||||
5.0 | MULTIPOLYGON(((5 0,0 0,0 1,5 1,5 0)))
|
||||
0.0001 | MULTIPOLYGON(((0 0,0.001 0,0.001 0.1,0 0.1,0 0)))
|
||||
0.0005 | MULTIPOLYGON(((0 0,0.005 0,0.005 0.1,0 0.1,0 0)))
|
||||
0.001 | MULTIPOLYGON(((0 0,0.01 0,0.01 0.1,0 0.1,0 0)))
|
||||
0.005 | MULTIPOLYGON(((0 0,0.05 0,0.05 0.1,0 0.1,0 0)))
|
||||
0.01 | MULTIPOLYGON(((0 0,0.1 0,0.1 0.1,0 0.1,0 0)))
|
||||
0.05 | MULTIPOLYGON(((0 0,0.5 0,0.5 0.1,0 0.1,0 0)))
|
||||
0.1 | MULTIPOLYGON(((0 0,0.1 0,0.1 1,0 1,0 0)))
|
||||
0.5 | MULTIPOLYGON(((0 0,0.5 0,0.5 1,0 1,0 0)))
|
||||
1.0 | MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)))
|
||||
2.0 | MULTIPOLYGON(((0 0,2 0,2 1,0 1,0 0)))
|
||||
5.0 | MULTIPOLYGON(((0 0,5 0,5 1,0 1,0 0)))
|
||||
|
@ -1,5 +1,5 @@
|
||||
inner-C | POINT(0.0035625 -0.0066188)
|
||||
outer-C | POINT(0.0041244 -0.0060007)
|
||||
inner-N | POINT(0.0018846 -0.0023652)
|
||||
inner-S | POINT(0.0048516 -0.0095176)
|
||||
area | MULTIPOLYGON(((0.0077125 -0.0066566,0.0065469 -0.0099414,0.0038979 -0.0109481,0.0026794 -0.0105772,0.0022025 -0.0099944,0.0026264 -0.0091997,0.0026264 -0.0080341,0.0019376 -0.0065507,0.0010369 -0.0072924,0.0005071 -0.0060738,0.0017787 -0.00565,0.0005071 -0.0042195,0.0005601 -0.0025771,0.0013019 -0.0015175,0.0050105 -0.0021533,0.006441 -0.0025771,0.0075006 -0.0040076,0.0033681 -0.0059149,0.0051694 -0.0076633,0.0061231 -0.0064977,0.0068648 -0.0049612,0.0077125 -0.0066566)))
|
||||
inner-N | POINT(0.0018846 -0.0023652)
|
||||
outer-C | POINT(0.0041244 -0.0060007)
|
||||
inner-C | POINT(0.0035625 -0.0066188)
|
||||
area | MULTIPOLYGON(((0.0005071 -0.0060738,0.0010369 -0.0072924,0.0019376 -0.0065507,0.0026264 -0.0080341,0.0026264 -0.0091997,0.0022025 -0.0099944,0.0026794 -0.0105772,0.0038979 -0.0109481,0.0065469 -0.0099414,0.0077125 -0.0066566,0.0068648 -0.0049612,0.0061231 -0.0064977,0.0051694 -0.0076633,0.0033681 -0.0059149,0.0075006 -0.0040076,0.006441 -0.0025771,0.0050105 -0.0021533,0.0013019 -0.0015175,0.0005601 -0.0025771,0.0005071 -0.0042195,0.0017787 -0.00565,0.0005071 -0.0060738)))
|
||||
|
@ -541,7 +541,7 @@ if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
|
||||
}
|
||||
}
|
||||
$sSQL = "SELECT count(getorcreate_postcode_id(v)) FROM ";
|
||||
$sSQL .= "(SELECT distinct(postcode) FROM location_postcode) p";
|
||||
$sSQL .= "(SELECT distinct(postcode) as v FROM location_postcode) p";
|
||||
|
||||
if (!pg_query($oDB->connection, $sSQL)) {
|
||||
fail(pg_last_error($oDB->connection));
|
||||
|
Loading…
Reference in New Issue
Block a user