Introduction
GML in JPEG 2000 (GMLJP2) is an OGC standard for geospatial images that embeds GML metadata inside JPEG 2000 imagery. GMLJP2 is also one of the OGC standards that FME 2025 is certified compliant with. In this article, you will be guided through the process of transforming a GeoTIFF orthophoto into a GMLJP2 file.
GMLJP2 is a powerful format because it is self-contained – both the image and the geographical context are held in a single file. The coordinate systems, vector overlays such as building footprints, and the JPEG image are combined into one file.
Source Data
The starting data used in this tutorial is a GeoTIFF image of an area in Vancouver, BC. A copy of the image used in the tutorial and the completed workspace can be found in the link here: GeoTIFFtoGMLJP2.zip
Step-by-Step Instructions
We will use the GeoTIFF and a couple of transformers to create an OGC-compliant GMLJP2 output. Download the attached data and workspace templates to get started.
1. Open FME Workbench
Open FME Workbench and start a new workspace, or open the .fmwt file from the Source Data section to follow along with a completed workspace.
2. Add a GeoTIFF Reader
Add a reader and set the following fields:
- Format: GeoTiff (Geo-referenced Tagged Image File Format)
-
Dataset: image_geo.tif
- Click on the ellipses to navigate to the file location on your computer
Click OK.
3. Add an AttributeCreator Transformer
To store our GML data, we must place it within a valid MLCOV XML. Add an AttributeCreator to the canvas. We will name our attribute “root” since it will be used for our writer’s root instance in a later step.
- Output Atribute: Root
- Value:
- Type: buffer
The root element is gmljp2:GMLJP2CoverageCollection, which acts as a container for other elements. The root element’s content varies depending on the dataset it’s describing. Refer to the OGC’s OpenGIS Implementation Specification for more information on formatting the root element that is input for the Value in AttributeCreator. The root element used for this step was taken from the GMLJP2 2.0 implementation standard document (Section 8.2 GMLCOV for JPEG2000).
4. Add an XMLValidator Transformer
Our root element should be valid XML. With an XMLValidator transformer, we can ensure that the syntax and namespace are valid before we use it. If we connect the output of the AttributeCreator to the input of the XMLValidator, we can set the following parameter:
- Attribute with XML Text: root
Click OK.
5. Add a Logger Transformer
If our XML fails syntax and namespace validation, a Logger can notify us. Connect the XMLValidator's Failed port to the logger's Input port. You can customize the message and output it to a specific severity.
6. Add an OpenJPEG Writer
Now that we have ensured our XML root element is valid, we can write an output GMLJP2 file. Connect the Passed port of the XMLValidator to the writer. After, double-click the OpenJPEG writer feature type to open the parameters. Enable and select the following parameters:
- Custom GMLJP2: Click the checkbox to enable
- Root Instance: root
Click OK.
The output will hold the XML combined with the input GeoTIFF as a .jp2 file in your destination folder.
Here is the output in Data Inspector with the root attribute holding the GML within the raster image.
Additional Resources
For examples on creating the root element, consult the OGC Implementation Specification documents:
To learn more about how FME handles reading and writing GMLJP2, refer to the following FME documentation:
Data Attribution
The data in this tutorial originates from the Government of Canada’s Open Government open data website.
This data can be accessed from: Open Government: Lac-Mégantic accident: satellite images after the incident