| 498 | }}} |
| 499 | |
| 500 | === Territory selector === |
| 501 | |
| 502 | You 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 |
| 506 | node[inside("FR")] /* matches any node located inside of France (this includes all the overseas territories) */ |
| 507 | node[inside("FX")] /* matches any node located inside of Metropolitan France (i.e. only the mainland part with its near islands including Corse) */ |
| 508 | node[inside("FR,DE")] /* matches any node located inside of France __OR__ inside of Germany */ |
| 509 | node[inside("US-FL")] /* matches any node located inside of the US state Florida */ |
| 510 | |
| 511 | node[outside("FR")] /* matches any node located outside of France */ |
| 512 | node[outside("FR,DE")] /* matches any node located outside of France __AND__ outside of Germany */ |
| 513 | node[inside("US")][outside("US-FL")] /* matches any node located inside of the USA except the state Florida */ |