The DataVirtualizationGeoJSON is a custom FME transformer designed to generate valid GeoJSON responses for FME's Data Virtualization feature. It transforms incoming spatial features into a GeoJSON FeatureCollection, embedding geometry and selected attributes as properties, and sets the appropriate HTTP response attributes.
Parameters
Feature Collection Name
Type: Text
Description: Sets the value for the name field in the GeoJSON FeatureCollection.
Attributes to Include
Type: Attribute Selector
Description: Selects the attributes from incoming features to include under the properties object of each GeoJSON feature.
Output Attributes
The transformer sets the following attributes on the output features:
response.status_code: Set to 200, indicating a successful HTTP response.
response.body.content: Contains the GeoJSON-formatted string representing the feature collection.
response.body.content_type: Set to application/geo+json, specifying the MIME type of the response.
Example
Given three input features with valid geometries and the following attributes:
CODE_DEPT
NOM_DEPT
CODE_REG
NOM_REG
POP_2020
39
JURA
27
BOURGOGNE-FRANCHE-COMTE
257849
42
LOIRE
84
AUVERGNE-RHONE-ALPES
764737
76
SEINE-MARITIME
28
NORMANDIE
1243788
And the transformer parameters set as:
Feature Collection Name: exemple
Attributes to Include: CODE_DEPT, NOM_DEPT, CODE_REG, NOM_REG, POP_2020
The resulting response.body.content would be:
{
"type": "FeatureCollection",
"name": "exemple",
"features": [
{
"type": "Feature",
"geometry": { /* geometry from the input feature */ },
"properties": {
"CODE_DEPT": "39",
"NOM_DEPT": "JURA",
"CODE_REG": "27",
"NOM_REG": "BOURGOGNE-FRANCHE-COMTE",
"POP_2020": "257849"
}
},
{
"type": "Feature",
"geometry": { /* geometry from the input feature */ },
"properties": {
"CODE_DEPT": "42",
"NOM_DEPT": "LOIRE",
"CODE_REG": "84",
"NOM_REG": "AUVERGNE-RHONE-ALPES",
"POP_2020": "764737"
}
},
{
"type": "Feature",
"geometry": { /* geometry from the input feature */ },
"properties": {
"CODE_DEPT": "76",
"NOM_DEPT": "SEINE-MARITIME",
"CODE_REG": "28",
"NOM_REG": "NORMANDIE",
"POP_2020": "1243788"
}
}
]
}
Notes
Input features must contain valid geometry to be included in the GeoJSON output.
Attributes not selected in Attributes to Include will be excluded from the properties section.
Geometry types supported include Point, LineString, Polygon, MultiPolygon, etc.
See Also
GeoJSON Format Specification
Would you like to know more? Click here to find out more details!