Is there a way to dynamically create a data object with key-value pairs? Within this object, can we include an array named features, which contains elements like geometry and coordinates?
In the feature array, how do we add properties such as title and content dynamically along with values in the coordinates array?
Any suggestions on adding data in the coordinates array within the "geometry":{"coordinates":[]} structure?
data = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"title": "Day 1",
"content": "This is where some people moved to."
},
"geometry": {
"type": "Point",
"coordinates": [
-73.7949,
40.7282,
1
]
}
}, ...
var data = {
features: []
};
for (piece in pieces){
data.features.push({
type: "Feature",
properties: {title: '{piece.title}' , content: '{piece.content}' },
geometry: {type: "Point"},
});
}