Skip to content Skip to sidebar Skip to footer

Why Doesn't Show Feature On Map

this is fiddle Link.Feature doesn't show on map when it has been like this code : var featureVectorLayer = new ol.layer.Vector({ source: featureClusterSource, style: new

Solution 1:

But i change source - featureClusterSource to featureVectorSource.it works well but in this time i don't get feature when i click feature on map .

When clicked on features which are intersecting, change forEachFeatureAtPixel method to add them to an array. Here's a working fiddle

    map.on("singleclick", singleClickCB);
    function singleClickCB(event) {
        var features = [];
        map.forEachFeatureAtPixel(event.pixel, function(feature, layer) {
          features.push(feature);
        });
        if (features) {
           var i;
           for (i = 0; i < features.length; ++i) {
              alert(features[i].get('title'));
            }
         }
   } ;

Post a Comment for "Why Doesn't Show Feature On Map"