1

I have the following interfaces:

export interface Feature<T extends GeometryObject> extends GeoJsonObject
{
    type: 'Feature'
    geometry: T;
    properties: any;
    id?: string;
}

export interface FeatureCollection<T extends GeometryObject> extends GeoJsonObject
{
    type: 'FeatureCollection'
    features: Feature<T>[];
}

The I tried to append the following objects:

let geoJsonFeatureCollection:FeatureCollection<any> = { type: 'FeatureCollection',

features: [] 
};

console.log(geoJsonFeatureCollection);

for (var key in data){
    if (data[key].Volume>0){
        let Feature:Feature<any>;
        Feature['type'] = 'Feature';
        Feature['geometry'] = {'type': 'Point',
        'coordinates': [data[key].YO, data[key].XO],
    };
    Feature['properties'] =  {'origin_city': data[key].Origin,
    'origin_lat' : data[key].YO,
    'origin_lon' : data[key].XO,
    'destination_city' : data[key].Destination,
    'destination_lat' : data[key].Y,
    'destination_lon' : data[key].X,
    'volume' : data[key].Volume

};
    geoJsonFeatureCollection['Features'].push(Feature);
}
}

but looks like its not working ..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.