File tree Expand file tree Collapse file tree 3 files changed +61
-3
lines changed Expand file tree Collapse file tree 3 files changed +61
-3
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ bool flex_table_t::has_id_column() const noexcept
76
76
77
77
bool flex_table_t::matches_type (osmium::item_type type) const noexcept
78
78
{
79
- // This table takes any type -> okay
80
- if (m_id_type == flex_table_index_type::any_object) {
79
+ // This table takes any type or has no ids -> okay
80
+ if (m_id_type == flex_table_index_type::any_object ||
81
+ m_id_type == flex_table_index_type::no_index) {
81
82
return true ;
82
83
}
83
84
Original file line number Diff line number Diff line change
1
+ Feature : Test for correct id column generation
2
+
3
+ Background :
4
+ Given the 0.1 grid
5
+ | 1 | | 2 |
6
+ | 3 | | 4 |
7
+
8
+ Scenario : Data can be inserted into tables without an iD column
9
+ Given the lua style
10
+ """
11
+ local simple = osm2pgsql.define_table{
12
+ name = 'simple',
13
+ columns = {{ column = 'id', type = 'bigint'}}
14
+ }
15
+
16
+ function osm2pgsql.process_node(object)
17
+ simple:insert{ id = object.id }
18
+ end
19
+
20
+ function osm2pgsql.process_way(object)
21
+ simple:insert{ id = object.id }
22
+ end
23
+
24
+ function osm2pgsql.process_relation(object)
25
+ simple:insert{ id = object.id }
26
+ end
27
+ """
28
+ And the OSM data
29
+ """
30
+ n1 Tp=1
31
+ n2 Tp=2
32
+ w10 Tp=10 Nn1,n2,n4
33
+ r100 Tp=100 Mn1@,n2@
34
+ """
35
+ When running osm2pgsql flex with parameters
36
+ | --slim |
37
+ Then table simple contains
38
+ | id |
39
+ | 1 |
40
+ | 2 |
41
+ | 10 |
42
+ | 100 |
43
+ Given the OSM data
44
+ """
45
+ n1 v2 dD
46
+ w11 Tp=11 Nn1,n3
47
+ """
48
+ When running osm2pgsql flex with parameters
49
+ | --slim | -a |
50
+ Then table simple contains
51
+ | id |
52
+ | 1 |
53
+ | 2 |
54
+ | 10 |
55
+ | 11 |
56
+ | 100 |
57
+
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def complete_node_list(self, nodes):
104
104
assert ' y' not in line
105
105
106
106
coords = self .grid_node (nid )
107
- assert coords is not None , f"Coordinates missing for node { node } "
107
+ assert coords is not None , f"Coordinates missing for node { nid } "
108
108
nodes [i ] = f"{ line } x{ coords [0 ]:.{self .grid_precision }f} y{ coords [1 ]:.{self .grid_precision }f} "
109
109
110
110
todos .discard (nid )
You can’t perform that action at this time.
0 commit comments