@@ -21,6 +21,7 @@ def osm_gdf():
2121 return gpd .GeoDataFrame (
2222 {
2323 "osm_id" : [100 , 200 , 300 ],
24+ "osm_type" : ["node" , "way" , "relation" ],
2425 "name" : ["Coffee Shop" , "Grocery Store" , "Park" ],
2526 "brand" : ["Starbucks" , None , None ],
2627 "conf_mean" : [0.8 , 0.6 , 0.9 ],
@@ -171,6 +172,7 @@ def test_geometry_preference_polygon_over_point(self):
171172 osm = gpd .GeoDataFrame (
172173 {
173174 "osm_id" : [1 ],
175+ "osm_type" : ["way" ],
174176 "name" : ["Park" ],
175177 "brand" : [None ],
176178 "conf_mean" : [0.9 ],
@@ -219,7 +221,8 @@ def test_expected_columns(
219221 osm_labels , ov_labels ,
220222 )
221223 expected_cols = {
222- "unified_id" , "source" , "osm_id" , "overture_id" ,
224+ "unified_id" , "source" , "osm_id" , "osm_type" ,
225+ "overture_id" ,
223226 "name" , "brand" , "shared_label" ,
224227 "conf_mean" , "conf_lower" , "conf_upper" ,
225228 "match_score" , "match_distance_m" ,
@@ -252,6 +255,30 @@ def test_shared_label_values(
252255 ].iloc [0 ]
253256 assert park_row ["shared_label" ] == "Park"
254257
258+ def test_osm_type_propagation (
259+ self , osm_gdf , overture_gdf , matches ,
260+ ):
261+ """osm_type must flow through matched + unmatched-OSM rows and
262+ be null on unmatched-Overture rows so the frontend can route
263+ OpenStreetMap links to /node/, /way/, or /relation/ correctly.
264+ """
265+ osm_labels = np .array (["Cafe" , "Supermarket" , "Park" ])
266+ ov_labels = np .array (["Cafe" , "Supermarket" , "Park" ])
267+ result = merge_matched_pois (
268+ osm_gdf , overture_gdf , matches ,
269+ osm_labels , ov_labels ,
270+ )
271+ # Matched row (osm_idx=0 → node)
272+ matched = result [result ["source" ] == "matched" ].iloc [0 ]
273+ assert matched ["osm_type" ] == "node"
274+ # Unmatched-OSM rows (idx 1,2 → way, relation)
275+ osm_only = result [result ["source" ] == "osm" ].set_index ("osm_id" )
276+ assert osm_only .loc [200 , "osm_type" ] == "way"
277+ assert osm_only .loc [300 , "osm_type" ] == "relation"
278+ # Unmatched-Overture rows carry no osm_type
279+ ov_only = result [result ["source" ] == "overture" ]
280+ assert ov_only ["osm_type" ].isna ().all ()
281+
255282
256283# -----------------------------------------------------------------
257284# Disk-backed row-sliced merge
0 commit comments