在创建

时间:2015-08-19 10:04:47

标签: javascript openlayers-3

如何在创建时设置ol.Feature ID。

到目前为止的示例和结果:

    // attempt 1
    var fea = new ol.Feature({  id : 123 });
    console.log(fea);

    // attempt 2                
    var fea = new ol.Feature();
    fea.id = 123;
    console.log(fea);

    // attempt 3
    var fea = new ol.Feature();
    fea.id = "123";
    console.log(fea);

结果:

尝试1:

attempt 1

尝试2:

enter image description here

尝试3:

enter image description here

1 个答案:

答案 0 :(得分:1)