Skip to main content

Hi all,

I'm having issues configuring the JSONTemplater to output my data.

I currently have 7 rows, with 2 unique IncidentIDs. I'd like to aggregate the postcode data and geometry for these 2 IncidentIDs so that the json can be used on a webmap showing all the postcodes associated with an incident:

 

imageI've configured my ROOT and SUB templates but the JSONTemplater fails at the root. Can anyone see what I am doing wrong?

imageROOT:

{ "type":"FeatureCollection",

"features":

fme-process-features("SUB")

]

}

 

 

SUB:

 

{

    "type":"Feature",

"properties":{"Postcode":fme:get-attribute("POSTCODE")},

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

}

 

Thanks in advance

N

With these settings it works for me:

ROOT

{
"type": "FeatureCollection",
"features": ufme:process-features("SUB")]
}

SUB

{
"type": "Feature",
"properties": {
"Postcode": fme:get-attribute("POSTCODE")
},
"geometry": fme:get-attribute("_geometry")
}

 


Hi @nedwaterman​ ,

The reason for the error in the Root expression is a typo in the function name.

wrong: fme-process-features("SUB")

correct: fme:process-features("SUB")

 

However, if you intend to aggregate Polygons to form a MultiPolygon for each Incident_ID, I don't think JSONTemplater works as expected.

In that case, I think you can create polygon geometry from the "_geometry" attribute value with GeometryRelacer, aggregate the polygons with Aggregator grouping by Incident_ID, then write the features with GeoJSON writer.

 


Hi @nedwaterman​ ,

The reason for the error in the Root expression is a typo in the function name.

wrong: fme-process-features("SUB")

correct: fme:process-features("SUB")

 

However, if you intend to aggregate Polygons to form a MultiPolygon for each Incident_ID, I don't think JSONTemplater works as expected.

In that case, I think you can create polygon geometry from the "_geometry" attribute value with GeometryRelacer, aggregate the polygons with Aggregator grouping by Incident_ID, then write the features with GeoJSON writer.

 

Thanks both for your help - much appreciated!


Reply