OpenStreetMap (OSM) XML User Configuration File Guidelines

The OSM configuration file is a simple XML document that users can write to modify the map features and attributes that FME recognizes. The syntax is divided into two simple functions: adding/modifying map features, attributes, and geometry types; and removing them.

All the remaining content of the config should be contained within a root <fme_osm_config> element. You can find an example of a configuration file by looking at FME’s config file at <FMEInstallDir>\xml\osm\fme_map_features.xml. This file adds all the OSM wiki defined map features to FME. It is strongly recommended that you do not edit this file and instead specify any changes you wish to make in your own config file.

Adding Map Features

The primary method of adding map features will be by writing <key> elements that contain child <value> elements. For example:

<key k="aerialway">
<value v="cable_car"></value>
<value v="gondola"></value>
<value v="chair_lift"></value>
</key>

This would add the broad feature ‘aerialway’ with specific features aerialway_cable_car, aerialway_gondola, and so on. In this case, writing this in your user config would be unnecessary because aerialway is an OSM wiki defined feature and is already understood by FME.

The Add Command

An add command can be specified by adding children elements to an <add> element. These children elements include <ftype>, <attribute>, and <geom_type>.

An alternative way to add map features is by specifying the key and value in an <ftype> element. For example:

<add>
<ftype k=”aerialway” v=”cable_car”></ftype>
<ftype k=”aerialway” v=”gondola”></ftype>
<ftype k=”aerialway” v=”chair_lift”></ftype>
</add>

This is equivalent to the code found in the Adding Map Features section. Note that the attribute ‘v’ in the ftype element is optional.

The method of adding attributes and geometry types are almost identical via add commands. Both <attribute> and <geom_type> elements have ‘name’, ‘k’, and ‘v’ attributes. Only the ‘name’ attribute is mandatory, whereas the ‘k’ attribute is only necessary when ‘v’ is specified. For example:

<add>
<attribute name=”attr1”></attribute>
<attribute name=”attr2” k=”shop”></attribute>
<attribute name=”attr3” k=”shop” v=”car”></attribute>
<geom_type name=”xml_area”></geom_type>
<geom_type name=”xml_line” k=”shop”></geom_type>
<geom_type name=”xml_point” k=”shop” v=”car”></ geom_type>
<attribute name=”attr4” v=”car”></attribute>
</add>

This adds attr1 and xml_area to ALL existing map features and also any map features that are created in the future. attr2 and xml_line are added to the ‘shop’ feature and also all of its specific features. Any specific features that are added to 'shop’ in the future will also have attr2 and xml_line. attr3 and xml_point are added to ONLY the shop_car feature. attr4 has specified a value but not key, so attr4 will not be added to anything. Note that FME only accepts the following geometry types:

xml_aggregate
xml_no_geom
xml_area
xml_line
xml_point

You should only be specifying these values in the ‘name’ attribute of the <geom_type> element.

The attribute element also has an additional, optional ‘type’ tag that can be used to add types to new attributes or modify the type of attributes on existing features. For example:

<add>
<attribute name=”attr_with_type” k=”shop” v=”car” type=”xml_boolean”</attribute>
</add>

If shop_car already has an attribute called attr_with_type, its type will be changed to xml_boolean. Otherwise, an attribute called attr_with_type with type xml_boolean will be added to it. Either way, the result ends up being the same. Note that if the type isn’t specified in the attribute element, the type will be defaulted to xml_buffer. The following is a list of the supported types you can specify in your config file:

xml_char(width)
xml_buffer
xml_xml
xml_datetime
xml_date
xml_time
xml_int64
xml_uint64
xml_int32
xml_uint32
xml_int16
xml_uint16
xml_byte
xml_ubyte
xml_real32
xml_real64
xml_decimal(width, decimal)
xml_boolean
xml_geometry