Skip to content

Commit

Permalink
Fix issue with duplicates rows for multilines
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Feb 8, 2025
1 parent 7cc8563 commit cd299b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions images/tiler-imposm/queries/transport_lines_mviews.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BEGIN
FROM osm_transport_lines%s
WHERE geometry IS NOT NULL
UNION ALL
SELECT
SELECT DISTINCT ON (osm_id)
''relation_'' || CAST(osm_id AS TEXT) || ''_'' || COALESCE(CAST(member AS TEXT), '''') AS osm_id,
geometry,
type,
Expand Down Expand Up @@ -92,9 +92,9 @@ DECLARE
BEGIN
FOR zoom IN SELECT UNNEST(zoom_levels)
LOOP
-- Create UNIQUE index
-- Create UNIQUE index using osm_id + type to prevent duplicates
sql_unique_index := format(
'CREATE UNIQUE INDEX idx_mview_transport_lines%s_osm_id ON mview_transport_lines%s (osm_id);',
'CREATE UNIQUE INDEX idx_mview_transport_lines%s_osm_id ON mview_transport_lines%s (osm_id, type);',
zoom, zoom
);
EXECUTE sql_unique_index;
Expand All @@ -109,4 +109,4 @@ BEGIN
-- Log success message
RAISE NOTICE 'Indexes created on mview_transport_lines%s', zoom;
END LOOP;
END $$;
END $$;

0 comments on commit cd299b3

Please # to comment.