This is a static archive of our old OSM Help Site. Please post any new questions and answers at community.openstreetmap.org.

Can osmfilter work with spaces in tag value?

1

Hello! I want to filter some administrative boundaries out. It works fine when city/village name consist of one word. But if there is a whitespace in the name it goes like this:

$ ./osmfilter -v --keep='name="Новые Ляды"' perm.osm
osmfilter Parameter: --keep=name="Новые Ляды"
osmfilter: Filter: keep nodes:
osmfilter: Filter:     "name" = ""Новые"
osmfilter: Filter:     "Ляды"" = "(anything)"
osmfilter: Filter: keep ways:
osmfilter: Filter:     "name" = ""Новые"
osmfilter: Filter:     "Ляды"" = "(anything)"
osmfilter: Filter: keep relations:
osmfilter: Filter:     "name" = ""Новые"
osmfilter: Filter:     "Ляды"" = "(anything)"
osmfilter Parameter: perm.osm
Interrelational hierarchy 1: 0 dependencies.
osmfilter: Relation hierarchies: 0 of maximal 12.
osmfilter: Number of bytes read: 56401798
(3 lines of OSM XML)
osmfilter: Last processed: relation 3496144

It fails to filter tag values with whitespaces. So the question is — is it a feature, a bug or there is a way to insert whitespace in query?

asked 13 Feb '14, 07:07

alsv's gravatar image

alsv
46115
accept rate: 0%


One Answer:

2

I've Read The F-ing Source and found an answer:

The space should be escaped with backslash!

$ ./osmfilter -v --keep="name=Новые\ Ляды or place_name=Новые\ Ляды" perm.osm 
osmfilter Parameter: --keep=name=Новые\ Ляды or place_name=Новые\ Ляды
osmfilter: Filter: keep nodes:
osmfilter: Filter:     "name" = "Новые Ляды"
osmfilter: Filter:   OR
osmfilter: Filter:     "place_name" = "Новые Ляды"
osmfilter: Filter: keep ways:
osmfilter: Filter:     "name" = "Новые Ляды"
osmfilter: Filter:   OR
osmfilter: Filter:     "place_name" = "Новые Ляды"
osmfilter: Filter: keep relations:
osmfilter: Filter:     "name" = "Новые Ляды"
osmfilter: Filter:   OR
osmfilter: Filter:     "place_name" = "Новые Ляды"
osmfilter Parameter: perm.osm

answered 18 Feb '14, 06:28

alsv's gravatar image

alsv
46115
accept rate: 0%