顾OpenStreetMap (OSM) XML用户配置文件idelines
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
Adding Map Features
The primary method of adding map features is by writing
This adds the broad featureaerialwaywith specific featuresaerialway_cable_car,aerialway_gondola, andaerialway_chair_lift.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
An alternative way to add map features is by specifying the key and value in an
This is equivalent to the code found above, in theAdding Map Featuressection.Note that the attributevin the
The method of adding attributes and geometry types are almost identical via add commands.Both
This addsattr1andarea(xml_area) to ALL existing map features and also any map features that are created in the future.attr2andline(xml_line) are added to theshopfeature and also all of its specific features.Any specific features that are added toshopin the future will also haveattr2line(xml_line).attr3andpoint(xml_point) are added to ONLY theshop_carfeature.attr4has specified a value but notkey, soattr4will not be added to anything.
Note that the geometry types in the config file are generic so that the file can be shared with OSM PBF.These generic names will map to XML types on the actual feature for OSM XML.
The following is a list of the supported geometry types with their xml type mappings that you can specify in your config file:
aggregate -> xml_aggregate
no_geom -> xml_no_geom
area -> xml_area
line -> xml_line
point -> xml_point
You should only be specifying these values in thenameattribute of the
The attribute element also has an additional, optionaltypetag that can be used to add types to new attributes or modify the type of attributes on existing features.Note that the type names in the config file are also generic.These generic names will map to XML types on the actual feature for OSM XML.For example:
Ifshop_caralready has an attribute calledattr_with_type, its type will be changed todatetime(xml_datetime).Otherwise, an attribute calledattr_with_typewith typedatetime(xml_datetime) 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 tostring(xml_buffer).The following is a list of the supported attribute types (with their xml type mappings) that you can specify in your config file:
string -> xml_buffer
int32 -> xml_int32
int64 -> xml_int64
double -> xml_real64
datetime -> xml_datetime
Lastly, the
For the
Anareatag in an OSM element will override the default interpretation of a closed way feature.If theareatag is set toyes, closed way features will always be interpreted as an area.Whereas if theareatag is set tono, it will always be interpreted as a line.More information on this can be found athttp://wiki.openstreetmap.org/wiki/Key:area.
The Remove Command
The syntax and logic forremoving
- Specifyingremoveon an
with only akattribute won’t just remove the broad feature – it will also remove all of its specific features.For example:
This doesn’t just remove the barrier feature;it also removesbarrier_block,barrier_wall, etc.
- Note that the
element here does not accept a type attribute.
Ordering of Commands
The order in which map features are added and removed does matter – features that were previously added can be removed, and vice versa.This also applies to attributes and geometry types, which can be especially useful in certain cases.For example, imagine the broad featureshopand all of its specific features have the attributewidth.Suppose you only want the attribute width to be on the featureshop_car.用户配置可以包括下列this:
However, the way attributes and geometry types are applied to map features is not affected by order.This means that attributes and geometry types can be added to features that have not yet been defined.For example, compare the following two config files:
1.
2.
These files perform the exact same function.Map featurespark,park_tree,desert,desert_cactus, anddesert_sandare added:
- parkandpark_treewill haveglobal_attr
- desert,desert_cactus, anddesert_sandwill havek_attr
- desert_sandwill havev_attr
Default Attributes and Geometry Types
Specified in FME’s config file (found at at
id
timestamp
user
created_by
visible
area
layer
uid
version
changeset
tag{}.k
tag{}.v
nd{}.ref
member{}.type
member{}.ref
member{}.role
osm_feature_type
osm_theme
The default geometry types are:
aggregate (xml_aggregate)
no_geom (xml_no_geom)
area (xml_area)
line (xml_line)
point (xml_point)