I have created data object and features array in it. i am trying to add data through nunjucks variables but it shows Template render error.
mydata = {
"type": "collection",
"features" : []
};
{% for piece in data.pieces %}
mydata.features.push({
type: "Feature",
properties: {
title: '{{ piece.title }}',
startDate: '{{ piece.startDate }}',
endDate: '{{ piece.endDate }}'
},
geometry: {
type: "Point",
coordinates: "abc"
}
});
{% endfor %}
My result should be like this.
mydata = {
"type": "collection",
"features": [
{
"type": "Feature", "properties": {"title": "", "startDate": "", "endDate": ""
},
"geometry": {
"type": "Point","coordinates": [ ]
}
]
}