Skip to main content

I have created a geojson file from nine features drawn from a postgis database. I have tried all the examples from the community pages with no success. Can anybody point me in the right direction?

Hi @jurgenmack 

 

Do you have the geoson created? If yes, could you share us?

 

 

Thanks


I should have said I’m trying the create a geojson. It writes out but this geometry template doesn’t do anything.   
 

jurgen


I should have said I’m trying the create a geojson. It writes out but this geometry template doesn’t do anything.   
 

jurgen

Hi Jurgen, thanks your answer.

 

Please, could you share your workspace template.


I am trying but for some reason it will not let me upload the file.

 

Jurgen


Here is a screenshot of my JSONTemplater settings.


Finally, here is the workbench. Can someone have a look and see what i am doing wrong. I am trying to include the geometry in the output geojsn file but none of the examples i have tried when configuring the geometry template in the JSONTemplater have worked.


@danilo_fme I have posted the workbench template. 

 

Thanks Jurgen


Is there a reason you want/need to use the Templator as opposed to just the GeoJSON Writer? Does FME not create the correct structure from your featuers?


I have a dataset that has multiple features and I was hoping to generate one json file instead of one for each feature. 


You can do this with a simple PostGIS to GeoJSON workspace, with the GeoJSON writer option ‘File Structure’ set to ‘Array of FeatureCollection objects - one per feature type’.

 


Adding modified workspace to illustrate


@daveatsafe I had no idea it was that simple. I’m always looking for the most complicated workflows. I’m going to have to change the way i develop workbenches. Start with the simplest solution first. (Reader 2 Writer nothing between)

Thanks Dave,  

PS. For future reference is there anything wrong with the way i am setting up the Geometry Template?

 

 

Jurgen


Working with the geometry template can be quite complex. You can see more information on it at https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Transformers/XQuery/XQuery_functions.htm. It would be a lot easier to use the GeometryExtractor to extract the geometry as GeoJSON, then insert that attribute into the template using:

"geometry" :fme:get-json-attribute("_geometry")


Reply