1
var features = new ol.format.GeoJSON().readFeatures(geojsonObject,{featureProjection:'EPSG:4326'});
   console.log("I_got_features[0]_as_<point>_:"+features[0].getGeometry().getType());
 console.log("features.length_as_<132>:"+features.length);
/*
var featurething = new ol.Feature({name: "point",geometry: features[0]});
*/
 var vectorSource = new ol.source.Vector({
 //for_all_feature-----But i want Only 1 feature
 //features: features
 //so i tried all this below but failed
 //features: featurething
 //features: features[0].getGeometry()
   features: features[0]
 });
 var vectorLayer = new ol.layer.Vector({
 source: vectorSource,
 });
 map.addLayer(vectorLayer); 

How can i convert my features[0] as a features......

1

you want to create a layer with a single feature so you must use:

features: [features[0]]

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.