The incoming csv-file has the following schema:
latitude;longtitude
90.232;24.244
I need to generate flow file, by updating incoming schema with new field "json".
Expected outcoming schema is:
latitude;longtitude;json
90.232;24.244;"{\"type\":\"Point\",\"coordinates\":[90.232,24.244]}"
So I need to extract latitude and longtitude values and put them into json (represented as string value).
For this aim I used UpdateRecord with Properties:
/json value is:
{"type":"Point","coordinates":[${\latitude},${\longtitude}]}
Also I tried:
{"type":"Point","coordinates":[${latitude},${longtitude}]}
But the output is:
latitude;longtitude;json
90.232;24.244;"{\"type\":\"Point\",\"coordinates\":[,]}"
So nothing is put to coordinates "placeholders".
Can anybody help me?
Use a QueryRecord
:
;
);
)SELECT latitude, longtitude,
'{"type":"Point","coordinates":[' || latitude || ',' || longtitude || ']}' AS json
FROM FLOWFILE
input
latitude;longtitude
90.232;24.244
output
latitude;longtitude;json
90.232;24.244;"{\"type\":\"Point\",\"coordinates\":[90.232,24.244]}"