OpenLayers 3: How to check if vector source is ready?

المشرف العام

Administrator
طاقم الإدارة
ol.source.getState() doesn't seem to be reliable. When I call it on a vector source it returns ready, but the features are not available yet. Code looks like this:

var vectorSource = new ol.source.Vector({ url: 'world.topo.json', format: new ol.format.TopoJSON() }); // ... init map with vectorSource console.log(vectorSource.getState()); // returns "ready" console.log(vectorSource.getFeatureById("US")); // returns null Any other way to see if a vector source is ready?



أكثر...
 
أعلى