JOSM: Icons and names not displaying for new keys

Hello,
I am pretty new to OSM, and am working with a civil society project to map a national park in Africa.

In parallel to OSM mapping in the strict sense, we are collecting other scientific geographic data (observations of wildlife, soils, climate, ecosystem boundaries, etc.) which we are maintaining separately but which have to be integrable with the OSM data for production of thematic maps, modelling, response to user queries, etc.

I have made a trial effort to input some mock scientific data into JOSM (maintained as a separate file, science.osm). The idea is to periodically merge the scientific and OSM layers to produce an integrated osm file which can be used to generate products and services for users.

I started by defining a prototype preset as follows:

<?xml version='1.0' encoding='UTF-8'?>
<presets>
  <item name="species" type="node,closedway,relation" icon="/home/john/Desktop/Science_preset/elephant.png">
    <label text="Ajouter une observation d'une espèce"/>
    <text key="name" text="Nom de l'espèce" default="" delete_if_empty="true"/>
    <text key="number" text="Nombre observé" default="x"/>
    <text key="details" text="Détails" default="" delete_if_empty="true"/>
  </item>
</presets>

When I activate the preset in JOSM and add some wildlife observations as nodes and as polygons, I find that the icon I specify (16x16 pixels) is not displayed in JOSM in either case. The species name is displayed for nodes but not for polygons (which are not filled). I assume that this is a problem with JOSM styles, but the documentation on this subject, but the JOSM documentation (http://josm.openstreetmap.de/wiki/Styles#AdvancedPreferences) is daunting. Could someone please give me some hints for a simple fix?

    Thanks and best regards,
    John

The icon you specify in the above example is for the JOSM menu, not for the items on the map. You have to add a mapcss file with details on how you want to display the items.
Since you do not really classify the items (you only have a name, a number and a details field), it will be hard to write a mapcss file for it.
I suggest you add something like observation=specie as well. Then you can style the appearance.

Documentation of mapcss syntax is here: http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation

It helps a lot to look at the default style: http://josm.openstreetmap.de/browser/trunk/styles/standard/elemstyles.mapcss or other styles: http://josm.openstreetmap.de/wiki/Styles#Availablestyleslist

A simple mapcss file could look like:


node[observation=specie] {
    icon-image: "/home/john/Desktop/Science_preset/elephant.png";
}
area[observation=specie] {
    fill-color: #123456;
}

node[observation=climate] {
    icon-image: "/home/john/Desktop/Science_preset/rain.png";
}
area[observation=climate] {
    fill-color: blue;
}

The text of the name of an area should appear as soon as the area has an areastyle.

Regarding your preset code: you can simply delete delete_if_empty=“true” (it has no function) and also default=“” since this is the default value anyway. See documentation at http://josm.openstreetmap.de/wiki/TaggingPresets

Thanks so much escada & Klumbumbus for this very helpful clarification.

My prototype preset was only a first try to see how additional data could be handled in parallel with OSM data.

I should really go into this more deeply, but I could save a lot of time if you could reply to the following questions/ideas:

  1. Do I understand correctly that new KEY/VALUE attributes entered into JOSM on the basis of a local preset file can be (if the user takes this responsibility - I’m not proposing to do this) uploaded into the main OSM server and/or saved in a local osm file. In either case I understand that other JOSM users who either download the data from the server or loaded the local osm file can see the new data (although they would not be able to add new data on the new objects unless they added the preset file to their local JOSM).

  2. Klumbumbus explains that I cannot see the names associated with my closedways through the new KEY/VALUE attributes because there is no areastyle for such objects. Strange that the names show for points by default but not for closedways by default, but I guess that is the way it is.

  3. I also assume that other applications which use osm files for input (like OSMAndMapCreator for the OSMAnd Android app) would also be able in principle to read and display the new data saved in the local osm file? However, other applications which rely on their own rendering models (Maperitive, mkgmap, Mapnik, etc.) will in general not be able to use the new data (or will would require that the rendering of the new elements be translated into their own rendering languages).

  4. For mapcss I can’t see right away where the default values are in JOSM. And are they provided with the standard JOSM and/or are they downloaded into JOSM when a part of the OSM map is downloaded for editing?

  5. And where to put the new supplementary mapcss file?

  6. Now when the new supplementary mapcss file is somehow added to JOSM, does that mean that the style data for the newly defined attributes will be saved in a local saved osm file (and thus be readable/usable by others) or that it will only be used for display in the particular JOSM installation in which the new mapcss file has been installed?

     	Thanks and best regards,
     	John
    

You do not need the preset to edit the tags. The presets only give a convenient popup with dropdowns, default values etc. You can always edit any tag.

Each renderer can be configured to render what you want and how you want. Much like you do with the mapcss file in JOSM. Of course, you do not have control over what a renderer does if you do not “own” it.

see the source repository

For local use: anywhere on your disk, see http://josm.openstreetmap.de/wiki/Styles for instructions on how add it to JOSM.

The style is kept separately from the the data. The .osm file nor the central database of OSM never know about the style you applied. In order to let others use your style, share the file and let them add it to JOSM just like you did, or upload it to the JOSM wiki next to the other styles so others can use it as well.