I have a json object as such:
{
"data_type" : "trainings"
"description" : "Training in Narewa"
"district" : "Rewa"
"gps_lat" : "-18.1295977111"
"gps_lon" : "178.556147326"
"id" : 24
"location" : "Tavuya"
"program" : "Training in Nadi"
"project" : "Entrepreneurship"
"province" : "Rewa"
}
how can I turn this into a geojson object?
Please note this is example within an array 12 objects with these key value pairs so most likely I’m going to loop the solution through 12 times.
I’ll need to use frontend javascript to achieve this
2
Answers
You will most likely have to create a parser yourself. I think the best way to do this in the geojson format would be creating a feature list. I.E.
where properties acts as a way to store any custom data. So you could create a new json var doing
and then use .push to append new items that are in the geojson format above. As far as my knowledge geojson acts just as normal json files it just has a specific structure. I hope this helps :).