[[TranslatedPages]] [[PageOutline(2-10,Table of Content)]] = JOSM Map Styles = [[JOSMImage(dialogs/mapstyle,middle,margin-right=20,48,link=)]] The JOSM [wikitr:/Help/MapView map display] can be easily customized with different styles. Many styles are included with JOSM by default. There are ''base styles'' (e.g. [source:/trunk/resources/styles/standard/elemstyles.mapcss JOSM standard] or [wiki:/Styles/Potlatch2 Potlatch 2]) that cover a wide range of features each. They can be combined with ''add-on styles'' that cover more special topics. See the [#Availablestyleslist available styles list] below. Further customization is possible via [#AdvancedPreferences style options] or by [#CreateStyle creating your own style]. == Choose styles ==#ChooseStyles JOSM has ''three lists'' of ''map styles:'' available styles (all styles from the style repository) → active styles (your favourites) → ☑ chosen styles (actually used for the map painting). JOSM comes with some styles being in the "active styles" list by default. You can choose styles from this list of "active styles" to be actually used for the map painting by clicking the check box (☑) at the desired style's line * in the [wikitr:/Help/Dialog/MapPaint map paint style dialog] or * in the [wikitr:/Help/Menu/View "View" menu] ( → "Map paint styles") or * in the Map Paint Styles Preferences (see section below) Note that, unless you are working with add-on styles, likely you want to have only one style ☑ checked at a time. === Activating more styles === ''Instructions:'' 1. Open the [wikitr:/Help/Preferences/MapPaintPreference Map Paint Styles preferences] * via the header of the Map Paint Styles panel with the [[JOSMImage(dialogs/mappaintpreference)]] [wikitr:/Help/Dialog/MapPaint#MapStyleSettings Preferences] button or [[Image(addstyle.gif,right,250px,title=animation of how to activate and choose an example style,margin=10,link=)]] * via [wikitr:/Help/Menu/View View menu] → ''Map paint styles'' → ''Map paint preferences'' or * via the general preferences dialog [wikitr:/Help/Menu/Edit Menu Edit] → [wikitr:/Help/Action/Preferences Preferences] → [[JOSMImage(dialogs/mapstyle,24,middle,link=)]] [wikitr:/Help/Preferences/MapPaintPreference Map Paint Styles] 1. Choose a style in the list of ''Available styles'' (left side) 1. Activate it by clicking the [[JOSMImage(preferences/activate-right)]] blue right arrow button between the lists. 1. Exit and confirm by clicking the OK button ''Example:'' Let's assume that you want to add [osmwiki:Key:maxspeed maxspeed=*] tags to OSM, then you probably will make use of the style [wikitr:/Styles/Maxspeed Maxspeed] (which displays the value of maxspeed on roads with different colors). The screencast/animation on the right side (click to enlarge) shows how to add this style to your list of "active styles". ==== Adding own styles ==== You can add own styles (from any URL/file) to the list of active styles – for example a style file which you have [#CreateStyle created yourself]. Just click the [[JOSMImage(dialogs/add)]] plus sign on the right and enter either path and filename or URL of your style file. == Available styles list == [[Styles(en|styles|short description|author|description|version|More details)]] == Create your own style ==#CreateStyle You don't like the standard style? Change it to your own liking: * In the [wikitr:/Help/Dialog/MapPaint map paint style dialog], right click one of the styles and select [[JOSMImage(copy,middle,24,link=)]] "save as...". A copy will be added to the list of styles. You can open the file in a text editor and reload after doing some changes. * Or create a style from scratch and add it in the JOSM mappaint preferences. JOSM supports styles in the MapCSS format. It is a style language similar to [https://en.wikipedia.org/wiki/Cascading_Style_Sheets CSS] originally developed for Potlatch 2. * General information can be found in the [osmwiki:Category:MapCSS osm wiki]. * A [wikitr:/Help/Styles/MapCSSTutorial Short tutorial] should get you started. * The [wikitr:/Help/Styles/MapCSSImplementation JOSM implementation reference] lists the supported features in more detail. == Make your style available to other users == * Either create a wiki page similar to [wiki:Styles/Modified]. I. go to [wiki:Styles/MyStyleName https://josm.openstreetmap.de/wiki/Styles/MyStyleName] A. change the URL so it matches the name of your style; change only the last part after `...Styles/`, (preferred is CamelCase) a. press `Enter` after adjusting the name 1. don't forget to enclose your mappaint code by a code block (`#!style type="mapcss"` needs to be on a **new line** after `{{{`): 1. `{{{` 1. `#!style type="mapcss"` 1. ... 1. `}}}` 1. for automatic version adjustment you have to use `[[revision]]_[[date]]` in your version variable: * `[[revision]]` - is the latest version number of the wiki page * `[[date]]` - is the date of the last edit of the wiki page * recommended usage: `version="1.[[revision]]_[[date]]"` (converts to e.g. `1.13_2019-02-24`) * this is required for an automatic update within JOSM * **Note**: Spam filter prohibits adding many external (icon) links. Please, if possible, attach icons to the wiki page ([#Iconhandling see below]). … * '''or''' edit the page StylesSource and add URLs for new style files to the list at the top. (JOSM wiki based Styles (see above) is the preferred method.) * **Note**: Only URLs with file-extension (e.g. *.mapcss, *.zip, *.php) are supported. In both cases, the new style will be automatically listed in the table above after a few minutes. Then it will also be available in the JOSM mappaint preferences (after clicking the reload button). == Icons ==#Icons `.png` and `.svg` files are supported. See [wikitr:/DevelopersGuide/DefaultPresets#NewIcons Defaultpresets New Icons] for details and problems with `.svg` === Icon testing === Icons can be tested with the [wikitr:/Styles/IconTester icon tester]. === Icon handling === #Iconhandling There are different forms to handle icons: * Icons distributed with JOSM can be entered directly with the path (relative to JOSM's [source:/trunk/resources/images internal image directory]). * Use a path relative to your local style file. (This works only for Styles, not for Presets.) * Use a path relative to a directory specified at the bottom in the [wikitr:/Help/Preferences/MapPaintPreference Map Paint Styles preferences] or [wikitr:/Help/Preferences/TaggingPresetPreference Tagging Presets preferences].) * New icons can be directly referenced using a https- or http-link. These are downloaded and cached internally. * zip files are supported too. * The zip file must contain at least one file with extension mapcss (for styles) or xml (for presets). * Icon names and path are relative to the topmost zip directory. * If there are multiple files, a file with "style" in the name is preferred (to allow packaging styles and presets in one archive). * Inline encoding as described in [https://tools.ietf.org/html/rfc2397 RFC 2397] is supported too. * Example for PNG: `data:image/png;base64,...databytes...` * Example for SVG: `data:image/svg+xml;base64,...databytes...` * [wikitr:/Help/Base64 More information] about `data:image/...` in JOSM. * When the JOSM wiki is used for designing of new styles or presets you have some additional options: * Each file attached to the wiki page is automatically included in the zip file downloaded by JOSM. * If you don't want a file in the zip file, add the text **(NOZIP)** in the description of the attachment. * If you add a zip file and want its contents included, you may add **(EXTRACT)** in the description of the attachment. * Empty image paths are not allowed. == Translation == Styles, Rules, Presets and Plugins use the same translation mechanism as JOSM core. The files must be delivered as Zip and contain a directory called `data` with the .lang files. To create these files there exist scripts in the SVN directory [source:osm/applications/editors/josm/i18n/ i18n]. See also [wikitr:/Translations#Software software translation section] in translation documentation. == Updating styles in JOSM == Once a style was updated in the wiki (or another external source) it takes up to 10 days until the style gets updated in JOSM automatically (#8933). To immediately force an update you can do the following steps: * Open the [wikitr:/Help/Action/Preferences Preferences] * Make sure [wikitr:/Help/ExpertMode Expert mode] is enabled * Open the [wikitr:/Help/Preferences/Advanced Advanced Preferences] * Search for keys starting with: `mirror.https://josm.openstreetmap.de/josmfile?page_Styles/` (or `mirror.` for other external sources) * Select the style you want to update * Click on Reset at the bottom of the window * Click on OK to save the changes (and to close the preference window) * Restart JOSM or: * Remove the content of your [wikitr:/Help/Action/About#InstallationDetails ] folder * Restart JOSM To check the version of the style in JOSM do the following steps * Open the [wikitr:/Help/Dialog/MapPaint Map Paint Styles Dialog] * Right click on a style * Choose Info * Click on Source Tab * Search for `version:` at the beginning of the source code == Styles managed in JOSM wiki == [[TitleIndex(Styles/)]] == Rendering == Mappaint renders the map data so it looks much more like a map (colors, icons, annotations, ...) - compared to the JOSM Wireframe view. === Nodes === Most nodes that correspond to tags in the [osmwiki:Map_Features Map Features] page will show an appropriate icon, e.g. a white "P" on blue ground for `amenity=parking`. There are some special icons for missing/incomplete things: [[Image(Mappaint_no_icon.png,margin-right=5,link=)]] missing icon \\ We don't have the right icon for every node tag in map features yet, e.g. icons for most `natural=*` tags are still missing. If you encounter such a "missing icon", feel free to create a nice 16*16 pixel icon that matches the tag. To submit your work, open a [/newticket new ticket] and add your image or zip archive as attachment. [[Image(Mappaint_deprecated.png,margin-right=5,link=)]] warning icon \\ The corresponding tag was once used but is no longer recommended to be used - or - it is not suitable for a node, e.g. `highway=motorway` just doesn't make sense on a node. Probably not all deprecated tags will show this icon. === Ways === Most ways that correspond to tags in the map features page will get special color, thickness and line style (e.g. dashed lines for railways). === Areas === Areas are ways that form a sort of ring. Most areas that corresponds to tags in the map features page will be filled with a special color (the filling will be transparent to some degree). == Advanced Preferences ==#AdvancedPreferences Some styles may have options. They are available via a right click (context menu) on the style's entry inside the [wikitr:/Help/Dialog/MapPaint map paint style dialog] window. E.g. JOSM's current default map style (MapCSS) has the option to display nodes at low zoom levels "less obtrusive" (enabled by default). In addition, you can use the following hidden preferences: * `mappaint.fillalpha` * alpha "opacity level", that is used to fill areas. An integer value between 0 (transparent) and 255 (solid) with the default of 50. * `mappaint.fillareas` (show areas) * 10000000 (default) - areas will be filled with their corresponding colour and name will be rendered * 0 - areas will be surrounded by lines only and name will not be rendered * any other number - areas will be filled with their corresponding colour and name will be rendered at any zoom level below the given number in meters * `mappaint.showicons` * select whether icons are shown - same values as `mappaint.fillareas` * `mappaint.shownames` * select whether names are shown - same values as `mappaint.fillareas` * `mappaint.strokes` * select whether strokes or full lines are used - same values as `mappaint.fillareas` * ~~`mappaint.useRealWidth`~~ * ~~true - ways will change width corresponding to the real width in meters set in the elemstyle.xml file~~ * ~~false (default) - ways will have the same width on every zoom level~~ * `mappaint.zoomLevelDisplay` * true - elements visibility depends on zoom level * false (default) - all elements are displayed * `mappaint.fontsize` * size of mappaint texts (default=8) ---- Back to [wikitr:/Help Main Help]