The SVG (Scalable Vector Graphics) Writer enables FME to write documents that conform to the World Wide Web Consortium’s (W3C) SVG 1.1 specification. This chapter assumes familiarity with the specification.
FME’s SVG output is optimal for scripting and spatial information display. Specific features include:
- coordinate preservation
- layered spatial geometry with adjustable paint order
- template processing for incorporation of predefined scripts, style sheets, images and other SVG entities
- single SVG element output for each FME feature (including features with donut and aggregate geometry)
- international character support
- gzip compression support
The SVG writer converts a set of FME features into geometric SVG elements. These elements are output in a document with three sections:
- Template section: Composed of a single non-extended SVG document.
- Layer section: Embedded in the template section, and composed of zero to more SVG group elements. One SVG group element is produced for each unique feature type in a writer’s feature set. The id attribute on this group element is set equal to the feature type name. The layer is inserted immediately before the template document’s closing root element tag.
- Geometric section: Embedded in the layer section, and composed of zero to more geometric SVG elements. This section contains a single SVG element for each FME feature that is sent to the writer. These elements are grouped according to their feature type and embedded under the group element with a matching ID in the layer section.
The SVG writer does not check FME attribute name characters that are invalid XML attribute name characters. FME attribute names are transcoded from the operating system’s local code page to UTF-8 and written directly to the SVG document; the writer does not escape any attribute name characters into character entities. It is the responsibility of the user to ensure the FME attribute names are valid XML attribute names.