Changes between Version 121 and Version 122 of Help/Styles/MapCSSImplementation


Ignore:
Timestamp:
2016-11-23T00:00:43+01:00 (9 years ago)
Author:
Klumbumbus
Comment:

+docu for Territory selectors

Legend:

Unmodified
Added
Removed
Modified
  • Help/Styles/MapCSSImplementation

    v121 v122  
    442442{{{
    443443#!mapcss
    444 way[!highway]                     /* matches any way which does not have a tag 'highway'                                              */
     444way[!highway]                     /* matches any way which does not have a tag 'highway'                               */
    445445way[!"VALSOU"]                    /* use quotes if case sensitive matching is required                                 */
    446446way[!"name:fr"]                   /* use quotes if the tag name includes special caracters (white space, colons, etc.) */
     
    496496way[oneway?!]                  /* matches any way with a false value in the tag 'oneway'  */
    497497}}}
     498}}}
     499
     500=== Territory selector ===
     501
     502You can test whether an object is located inside or outside of a specific territory. JOSM has an internal database for this. The territories file is an osm file and can be downloaded [https://josm.openstreetmap.de/export/HEAD/josm/trunk/data/boundaries.osm here] and opened in JOSM to investigate it [attachment:boundaries.png (screenshot preview)]. It contains borders of all countries of the world. Due to performance reasons the boaders are simplified. They can be refined for special cases on request. The territories are "tagged" with their [https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 ISO_3166-1_alpha-2 codes]. USA, Kanada and Australia have additional boundaries for their subdevisions. See the following examples on how to use the territory selectors. Territory selectors are less usefull in mappaint styles and can be very resource heavy there. However they are much more usefull for [wiki:Help/Validator/MapCSSTagChecker mapcss based validator rules]. To select territories with left-hand-traffic or right-hand-traffic, there is a simpler way, see #PseudoClasses. See #10387 for main implementation of this feature.
     503
     504{{{
     505#!mapcss
     506node[inside("FR")]                    /* matches any node located inside of France (this includes all the overseas territories)                                     */
     507node[inside("FX")]                    /* matches any node located inside of Metropolitan France (i.e. only the mainland part with its near islands including Corse) */
     508node[inside("FR,DE")]                 /* matches any node located inside of France __OR__ inside of Germany                                                         */
     509node[inside("US-FL")]                 /* matches any node located inside of the US state Florida                                                                    */
     510
     511node[outside("FR")]                   /* matches any node located outside of France                                                                                 */
     512node[outside("FR,DE")]                /* matches any node located outside of France __AND__ outside of Germany                                                      */
     513node[inside("US")][outside("US-FL")]  /* matches any node located inside of the USA except the state Florida                                                        */
    498514}}}
    499515