Hi have you tried the json templater transformer?
Looks like GeoJSON, so try the GeoJSON writer.
Hi @gefo, looks like it's the GeoJSON format. Does the GeoJSON writer help you?
I did use the GeoJSON writer but the structure is not the same. is there a option in FME to change the structure in a GeoJSON file?
I did use the GeoJSON writer but the structure is not the same. is there a option in FME to change the structure in a GeoJSON file?
Yes i know i can remove Attributes in the writer, but what i need is the same stucture, first the attributes and at lest the geo information.
Yes i know i can remove Attributes in the writer, but what i need is the same stucture, first the attributes and at lest the geo information.
Are you sure this is a problem?
I have tried to re-order the original file, and yes its a problem the data wil not load in the webmap, so i need to chance the order. but the question is how can i do that in FME?
the json templater gives you total control on the schema.
I have tried to re-order the original file, and yes its a problem the data wil not load in the webmap, so i need to chance the order. but the question is how can i do that in FME?
I have tried to re-order the original file, and yes its a problem the data wil not load in the webmap, so i need to chance the order. but the question is how can i do that in FME?
But yes, the JsonTemplater is the next step.
I have tried to re-order the original file, and yes its a problem the data wil not load in the webmap, so i need to chance the order. but the question is how can i do that in FME?
For so far thanks for all the answers, it seems the webmap did not accept using another order in the geojson file, so i will look if i can change the order with the json templater.
The webmap was created with Qgis and Qgis2Web, you can find it here :
All the data in it comes from a postgisDB so its a litle hard to update it with Qgis, in FME it must be easyer, just read the DB and write it to a JSON file in.
Hi @gefo, if the source point features are read from a PostGIS database, you can convert them to a required JSON document directly with some transformers including the JSONTemplater. e.g.
After extracting feature geometry as an attribute (e.g. "_geometry") in GeoJSON format with the GeometryExtractor, send one feature to the Root port of the JSONTemplater and set the Root template:
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"features": fme:process-features("SUB")
}
add a SUB template:{
"type": "Feature",
"properties": {
"id": fme:get-attribute("id")
},
"geometry": fme:get-json-attribute("_geometry")
}
then, send all features to the SUB port.If there are multiple feature types which should be converted to different JSON documents for each, set feature type identifier attribute to both the "Group By" parameter in the Sampler and the "Group Sub-Features By" parameter in the JSONTemplater
Thanks For the answer i am close to the solution of my problem, the only thing is now how to change the order, it seems the templater does not change the order of the features.
Looks like you are trying to write GeoJSON. However, due to a problem with our GeoJSON writer at the moment, our output has some slight differences, particularly when multiple feature types are written. The workaround for now is to use one feature type per dataset, or use dataset fanout. A more comprehensive solution is planned for 2018.1. For more info see: https://knowledge.safe.com/articles/40806/workarounds-to-known-issues-in-fme-20170.html
Hi @gefo, looks like it's the GeoJSON format. Does the GeoJSON writer help you?
I have a case where the GeoJSON format is not compatible with the output needed (Mapbox GL with each polygon independently colored). I am struggling to figure out how to do JSON Templater or a way to "fix" the GeoJSON output to become compatible.
Goal: output as embedded JSON in a Mapbox html page.
I have a case where the GeoJSON format is not compatible with the output needed (Mapbox GL with each polygon independently colored). I am struggling to figure out how to do JSON Templater or a way to "fix" the GeoJSON output to become compatible.
Goal: output as embedded JSON in a Mapbox html page.
Hi @jnotter,
As this original thread is quite a few years old, would you be open to posting a new question to the Forums? This will increase the visibility of your question and encourage more helpful answers for you from the Community. It would also be helpful to include any screenshots or examples of what you've got currently and what your ideal output would look like. Thanks!