How to exclude features with name space in my validation code?

Hi all,

I’m working on my custom validator. Currently i’m able to successfully flag for mismatching tags between node and way for the crossing:markings=‘value’. However, I can’t figure out how to flag for ways that have namespace in the value. For example, crossing=markings=ladder:paired. (I’m not sure if namespace is the correct term is the value syntax is value:value).

Here is my line of code that i’m trying to fix:

way[crossing:markings=ladder:paired]> node{ set .is_crossing_ladder_paired_marking}
node:tagged[highway=crossing][crossing:markings!=ladder:paired][!ladder:paired].is_crossing_ladder_paired_marking{
        throwError: tr("mismatching crossing:markings=ladder:paired between node and way");
    }

Thank you in advance for taking a look!

Here’s some tips I found useful for writing my own rules. I hope they are able to help you too!

The JOSM find dialog has a mode for “MapCSS Selector” that has been useful for me while trying to write rules like this. You may also find that useful as it will note when it cannot figure out how to parse your selector. For example this isn’t valid:

way[crossing:markings=ladder:paired]

But adding quotes around the key and value makes the find dialog happy:

way["crossing:markings"="ladder:paired"]

If you’re a fan of VS Code, there’s also an extremely basic syntax highlighter for mapcss files here.

Awesome, thanks @watmildon . Also thanks for the syntax highlighter. I’ve been wanting one that was specifically meant for mapcss. Im currently just using the css highlighter. lol

1 Like

It’s the absolute most rudimentary implementation but it was better than staring at all grey text. I don’t know how it compares to a CSS highlighter.

Just posted this in its own topic, but see the new extension I just published for VS Code. It extends the syntax highlighting @watmildon mentioned, but is now much more comprehensive of all of MapCSS’s functionality.

Hooray! Always refreshing to have someone who actually knows what they’re doing come along!

A million times better. Incredible.