How to add support for multiple semicolon-separated values?

11 views
Skip to first unread message

Martin Ždila

unread,
Nov 13, 2023, 2:58:09 AM11/13/23
to imposm
Hello,

It is not uncommon to find in OSM database multiple tag values separated by semicolon, for example amenity=restaurant;cafe. How to handle this in imposm3? I would like it to create 2 records in the database.


Imre Samu

unread,
Nov 13, 2023, 3:33:14 AM11/13/23
to imp...@googlegroups.com
Martin Ždila <m.z...@gmail.com>  ( 2023. nov. 13., H, 8:58):
Hello,

It is not uncommon to find in OSM database multiple tag values separated by semicolon, for example amenity=restaurant;cafe. How to handle this in imposm3? I would like it to create 2 records in the database.

Hi Martin,

Interesting task,
What I would try (but haven't tested):

step1:
Create a table that contains a field for 'amenity' which includes the ';' character.
amenity: [_any_] + filters: contains ';'   ( require_regexp )

step2:
And you need to put a special SQL view on this table that arranges the record into multiple rows.
More precisely, 
- splitting the text (like "amenity=restaurant;cafe") into an array, 
-  and then turning the array into a set of rows (records).
similar to: unnest(string_to_array(amenity, ';'))

If you succeed, please share the final code!

regards,
 Imre

Martin Ždila

unread,
Nov 13, 2023, 3:40:14 AM11/13/23
to imposm
Thanks Imre. This is an interesting idea, I will give it a try and share you the code. But it may take couple of days/week until I get into it. So far I am just exploring my options :-).

Yves

unread,
Nov 13, 2023, 3:53:42 AM11/13/23
to imp...@googlegroups.com
Another way to deal with several values for rendering purpose is to use the LIKE matching keyword in your sql.
Yves
Reply all
Reply to author
Forward
0 new messages