Store entrance fields as columns on table

This commit is contained in:
Emily Love Watson
2025-08-22 15:57:28 -05:00
parent d0ad65f696
commit 91e345f77f
11 changed files with 127 additions and 72 deletions

View File

@@ -6,17 +6,18 @@ Feature: Entrance nodes are recorded
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry | extratags |
| W1 | building | yes | (1,2,3,4,1) | |
| N10 | entrance | main | 1 | 'wheelchair': 'yes' |
| N20 | entrance | yes | 3 | |
| osm | class | type | geometry | extratags |
| W1 | building | yes | (1,2,3,4,1) | |
| N1 | entrance | main | 1 | 'wheelchair': 'yes' |
| N2 | entrance | yes | 3 | |
And the ways
| id | nodes |
| 1 | 10,20,30,40 |
| id | nodes |
| 1 | 1,2,3,4,1 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
Then place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 10, 'extratags': {'wheelchair': 'yes'}}, {'lat': 1e-05, 'lon': 1e-05, 'type': 'yes', 'osm_id': 20, 'extratags': {}}] |
Then placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 1 | 1 | main | 1 | {'wheelchair': 'yes'} |
| 1 | 2 | yes | 3 | {} |

View File

@@ -15,8 +15,8 @@ Feature: Entrance nodes are recorded
Then placex contains exactly
| object | place_id |
| W1 | 1 |
Then place_entrance contains exactly
| place_id | entrances |
Then placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
When updating places
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
@@ -24,9 +24,9 @@ Feature: Entrance nodes are recorded
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
Then placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 1 | 1 | main | 1 | - |
Scenario: A building with a updated entrance node
Given the grid
@@ -44,8 +44,8 @@ Feature: Entrance nodes are recorded
| object | place_id |
| N1 | 1 |
| W1 | 2 |
Then place_entrance contains exactly
| place_id | entrances |
Then placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
When updating places
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
@@ -54,9 +54,9 @@ Feature: Entrance nodes are recorded
| object | place_id |
| N1 | 1 |
| W1 | 2 |
And place_entrance contains exactly
| place_id | entrances |
| 2 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
And placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 2 | 1 | main | 1 | - |
Scenario: A building with a removed entrance
Given the grid
@@ -73,9 +73,9 @@ Feature: Entrance nodes are recorded
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
| 1 | [{'lat': 0, 'lon': 0, 'type': 'main', 'osm_id': 1, 'extratags': None}] |
And placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 1 | 1 | main | 1 | - |
When marking for delete N1
And updating places
| osm | class | type | geometry |
@@ -83,5 +83,36 @@ Feature: Entrance nodes are recorded
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And place_entrance contains exactly
| place_id | entrances |
And placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
Scenario: A building with a removed and remaining entrance
Given the grid
| 1 | 2 |
| 4 | 3 |
Given the places
| osm | class | type | geometry |
| N1 | entrance | main | 1 |
| N3 | entrance | yes | 3 |
| W1 | building | yes | (1,2,3,4,1) |
And the ways
| id | nodes |
| 1 | 1, 2, 3, 4, 1 |
When importing
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 1 | 1 | main | 1 | - |
| 1 | 3 | yes | 3 | - |
When marking for delete N1
And updating places
| osm | class | type | geometry |
| W1 | building | yes | (2,3,4,2) |
Then placex contains exactly
| object | place_id |
| W1 | 1 |
And placex_entrance contains exactly
| place_id | osm_id | type | location!wkt | extratags |
| 1 | 3 | yes | 3 | - |