Opened 6 years ago

Last modified 6 months ago

#18380 closed enhancement

[RFC] Add implied tags to presets — at Initial Version

Reported by: taylor.smock Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: implies, implied, tags, presets, tag, preset Cc:

Description

I'd like to be able to get default access tags, if none exist on a highway. For example, in most countries highway=motorway implies bicycle=no, motor_vehicle=yes, foot=no, oneway=yes, and surface=paved.

So there are two methods available to get this information:
1) Hardcode it (i.e., make a java class that stores common implied information)
2) Extend the presets.xml parser to understand an implies tag

For example,

        <item name="Motorway" icon="presets/transport/way/way_motorway.svg" type="way" preset_name_label="true">
            <link wiki="Tag:highway=motorway" />
            <space />
            <key key="highway" value="motorway" />
            <text key="ref" text="Reference" />
            <optional>
                <text key="name" text="Name" />
                <reference ref="highway_base" />
                <text key="destination" text="Destination" />
                <text key="destination:ref" text="Destination reference" />
                <text key="width" text="Width (meters)" />
                <combo key="placement" text="Placement" values="left_of:1,left_of:2,left_of:3,middle_of:1,middle_of:2,middle_of:3,right_of:1,right_of:2,right_of:3,transition" />
                <checkgroup columns="4">
                    <check key="oneway" text="Oneway" default="on" />
                    <check key="bridge" text="Bridge" disable_off="true" />
                    <check key="tunnel" text="Tunnel" disable_off="true" />
                    <check key="cutting" text="Cutting" disable_off="true" />
                    <check key="embankment" text="Embankment" disable_off="true" />
                    <check key="lit" text="Lit" />
                    <check key="toll" text="Toll" />
                </checkgroup>
            </optional>
            <preset_link preset_name="Road Restrictions" />
            <implies>
                <key key="motor_vehicle" value="yes" />
                <key key="bicycle" value="no" />
                <key key="foot" value="no" />
                <key key="oneway" value="yes" />
                <key key="surface" value="paved" />
            </implies>
        </item> <!-- Motorway -->

Ideally, the implies xml tag group would also take a country code (so <implies country="US,MX,GR,GB" excludes-country="US-FL,US-CO">) for country specific regions, or applying the implied tags worldwide except for specific countries. So the default scope for an implies block would be worldwide, unless it has a country attribute, in which case the scope decreases to those countries. If there are excludes, then those countries are excluded.
The more specific country wins (so country="US-FL,Earth" excludes-country="US" would include the entire world, except for the US, with Florida still having the implies block). This does mean that there needs to be a special value for worldwide, for which I would use Earth instead World or global (this is mostly for future-proofing -- hopefully we will eventually have an OpenStreetMap for the Moon/Mars, but maybe we would want to use the global defaults for those anyway).

Since there are some tags (highway=motorway as an example) where the default implied tags are recommended to be included due to different localities having different implied tags, so we can have a recommended=yes attribute as well, so <implied recommended=yes>.

I do have some proof of concept code to add the implies tag, but it needs significantly more work (it doesn't have include/exclude countries, check if the implied tags are recommended, and it adds the tags as if they were required tags, due to re-using the key tag).

This may also mean that we can write a validator rule to check if the implied tags have been added to a way (so if we have a way with the tags highway=residential access=yes foot=yes bicycle=yes), we can indicate that there are three unnecessary tags (access=yes is implied, as is foot=yes and bicycle=yes, but even if foot and bicycle weren't implied, access=yes also implies foot=yes and bicycle=yes).

Change History (0)

Note: See TracTickets for help on using tickets.