Introduction
This article details how to write OGC-compliant GeoPackage outputs. GeoPackage is an open standard that can be used to store vector and raster data. FME is certified compliant by the OGC for generating both vector and raster GeoPackages. The OGC defines the specifications for GeoPackage, and the format is useful for efficient storage of tilesets in an SQLite database file, sending data over the web, and displaying data on a mobile device.
Source Data
Two datasets are used in this tutorial.
Part One source dataset is a GeoJSON file containing point information for building footprints in Vancouver, BC. The FME template workspace containing the data can be downloaded here: GeoJSONtoGeoPackage.zip
The source data set for Part Two is a GeoTIFF raster of Vancouver, BC. The FME template workspace containing the data can be downloaded here: GeoTIFFtoGeoPackage.zip
Step-by-Step Instructions
FME can be used to write out fully OGC-compliant GeoPackage data. This tutorial is split into two parts to cover writing out both vector and raster GeoPackage data. Download the workspaces and associated data to get started.
Part 1: GeoJSON to GeoPackage (Vector)
The first part of this tutorial will walk you through the process of converting a GeoJSON input to a GeoPackage output. We will use a dataset with building footprints.
1. Open FME Workbench
Open FME Workbench to start a new workspace or download the GeoJSONtoGeoPackage.zip file to follow along in the finished workspace.
2. Add a GeoJSON Reader
Add a reader and select GeoJSON as the Format to start the workflow. If you are using the data downloaded from this tutorial, select building-footprints-2015.geojson as the Dataset.
- Format: GeoJSON (Geographic JavaScript Object Notation)
-
Dataset: building-footprints-2025.geojson
- Click the ellipsis to navigate to the file location on your computer
Click OK
3. Optional: Add a Sampler Transformer
Samplers are useful when you’re working with a large dataset and would like to test a subset of your data. For this example, the Sampler transformer retained 1 out of 1000 records by changing the following parameter:
- Sampling Rate (N): 1000
- Sampling Type: Every Nth Feature
- Randomize Sampling: No
Click OK.
4. Add an AttributeManager Transformer
An AttributeManager transformer is very useful for removing, renaming, and adding attributes. For our purposes, keep the object_id and remove all remaining attributes.
-
Remove Attribute:
-
Input Attribute: geo_point_2d.lon
- Action: Remove
-
Input Attribute: geo_point_2d.lat
- Action: Remove
-
Input Attribute: geo_point_2d.lon
5. Add an OGC GeoPackage Writer
Because our data does not need much transformation, we are now ready to add an OGC GeoPackage writer. Click the Add Writer button in the toolbar, type OGC in the Format field, and select OGC GeoPackage. Specify a name and location for your output dataset.
- Format: OGC GeoPackage
-
Dataset: < choose your filename>
- Click the ellipsis to select a location on your computer
Click OK
In the following Feature Type window, we will give our table an appropriate name and geometry by setting the following:
- Table Name: building_footprints
- Geometry: geopackage_polygon
Click OK to add the writer to the canvas.
6. Run Workspace and View the Output
Connect the AttributeManager output to the newly added writer. Once the workspace is complete, click the Run button in the menu bar. We have successfully transformed our GeoJSON input into a GeoPackage! Preview the GeoPackage in Data Inspector. Zoom in to see the building footprint polygons in detail.
Part 2: GeoTIFF to GeoPackage (Raster)
In the second part of this tutorial, we will walk through the process of converting a set of 6 GeoTIFF orthophotos into a single GeoPackage Tiles.
1. Open FME Workbench
Open FME Workbench to start a new workspace or download the GeoTIFFtoGeoPackage.zip to follow along in the finished workspace.
2. Add a GeoTIFF Reader
Add a reader and set the following parameters. If you are using the data downloaded from this tutorial, select all six of the orthophotos in the folder as the Dataset.
- Format: GeoTIFF (Geo-referenced Tagged Image File Format)
-
Dataset: Select all six orthophotos
- Click on the ellipses and navigate to the file location on your computer
- Click on the first file, press and hold shift, and then select the last file to select them all
- Coordinate System: EPSG:26910
3. Add a RasterMosaicker
Our 6 orthophotos are meant to be displayed side-by-side. To stitch them together, we will use a RasterMosaicker and keep the default settings.
Two important parameters to note are under the Data Values section. The option selected for “Overlapping Values” will dictate how output cell values will be calculated when rasters overlap. By choosing “Last”, we preserve the value of the last raster. This means the order of our rasters is very important. The option selected for “Nodata Overwrites Data” is set to “No”. By doing so, we ignore any nodata cells that overlap with real data cells and prioritize data over nodata.
4. Add an OGC GeoPackage Tiles Writer
Our raster data is now ready to be written out. Add a writer and fill in the following fields:
- Format: OGC GeoPackage Tiles
-
Dataset: <chose a filename>
- Click the ellipsis to navigate to a save location on your computer
Click OK.
In the Feature Type window that opens after, give the tile set an appropriate name:
- Tile Set Name: raster_geopackage
- Writer: <writer previously added>
Click OK.
5. Run Workspace and View Data
Connect the writer to the output port of the RasterMosaicer and click Run from the toolbar. You have now successfully transformed your GeoTIFF files into GeoPackage tiles. Preview the GeoPackage in Data Inspector.
Additional Resources
For detailed information on the standard, consult the OGC Implementation Specification documents:
To learn more about how FME handles reading and writing GeoPackage, refer to the following FME documentation:
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
This data can be accessed directly from: