Set up an extraction using FME Form (desktop)
Info
This tutorial uses the extraction plugin FME Form (Version 2) which allows unlimited parameters length, thus allowing request with precise geometries like municipalities boundary.
To follow along with this tutorial, download the sample script and data available here. Either by cloning the repo :
git clone https://github.com/asit-asso/extraction-samples.git
Or downloading a ZIP archive with the following link : https://github.com/asit-asso/extraction-samples/archive/refs/heads/main.zip
Set up the FME workspace
-
In the downloaded folder, go to the subfolder
fmeand open up thesample-script-FME2024.fmwFME workspace. -
The workspace uses a
creatoras a starting point. -
The
FME Form (Version 2)plugin sends all request parameters in aGeoJSONfile. The latter is given as a CLI argument when running the workspace where the key is--parametersFileand the value is the path of theGeoJSONfile.To tell FME to use this argument, we need to create a User Parameter :
Under
User Parameters, create a newFile/Folder/URLparameter. The identifier must beparametersFile. For convenience, you can allocate a default value$(FME_MF_DIR)\parameters.jsonto the parameter. Thus, when run inside FME, the default value is taken and a local GeoJSON file is used. But when run by Extract, theparametersFilewill be overridden by the CLI argument and the GeoJSON from Extract will be used.
-
Then we need to read the
GeoJSONfile with aFeatureReader. The format isGeoJSONand the dataset is the$(parametersFile)parameter. The feature of theGeoJSONfile is the request perimeter and can be use to extract or clip data. All other attributes are the request parameters.
-
Before reading your actual data, you can set global variables from the GeoJSON attributes like the FolderOut (to know where to save the output data), the desired Format and CRS using a
VariableSettertransformer. Thus, it will be possible to use them later after reading your business data.
-
Then you can read your business data with a
FeatureReadertransformer. In our example, we use the feature from the GeoJSON parameters file (request's perimeter) to read only the data that intersect with it.
-
Once your data are read, you can retrieve the previously set variables to know for example in which format and CRS the client wants the data.

-
Reproject the data accordingly and save them in the given format. Remember, the data must be saved in the
FolderOutparameter given in theGeoJSONfile.
Connect the workspace to Extract
-
In Extract, create a new or use an existing process (see processes).
-
Drag and drop the task plugin
Extraction FME Form (Version 2)into the process task list. -
In the field
Chemin du workspace FME, type the path where your FME workspace is. In the fieldChemin du programme FME (fme.exe), type the path where your FME executable is. In the fieldNombre de fme.exe lancés par ce workspace (défaut = 1, max = 8), type the number of FME executable needed in parallel for your workspace (for our example, only one is needed).
-
To test the extraction, you can link this process to viageo (see Connect Extract to viageo.ch). With our example, the linked resource can be orderable over the entire Switzerland in the following format :
shapefile,geopackage,GeoJSONandDXF. -
Finally, you can order the linked product on viageo, Extract will retrieve the request and run the FME workspace with all request parameters carried out in the GeoJSON parameters file.