Skip to main content
added 513 characters in body
Source Link

I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help, please?

 if(this._map){
    const selectClick = new Select({
      condition: doubleClick,
       layers: [this._vectorLayer]
    });
  
  this._selectInteraction = selectClick;
  this._map.addInteraction(selectClick);
  
  selectClick.on('select', function (e) {
       console.log(e.selected[0].getStyle());
   });
  }

returns

ƒ (feature) {
        if (!feature.getGeometry()) {
            return null;
        }
        return styles[feature.getGeometry().getType()];
    }

I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help, please?

I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help, please?

 if(this._map){
    const selectClick = new Select({
      condition: doubleClick,
       layers: [this._vectorLayer]
    });
  
  this._selectInteraction = selectClick;
  this._map.addInteraction(selectClick);
  
  selectClick.on('select', function (e) {
       console.log(e.selected[0].getStyle());
   });
  }

returns

ƒ (feature) {
        if (!feature.getGeometry()) {
            return null;
        }
        return styles[feature.getGeometry().getType()];
    }
added 5 characters in body; edited tags
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

how to get Get style of selected feature in select interaction openlayersOpenLayers

I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStylegetStyle does not return the style of the selected feature. Can anyone help, please?

how to get style of selected feature in select interaction openlayers

I'm trying to add a select interaction on vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help please?

Get style of selected feature in select interaction OpenLayers

I'm trying to add a select interaction on a vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help, please?

Source Link

how to get style of selected feature in select interaction openlayers

I'm trying to add a select interaction on vector layer and get the stroke color of the selected feature returned. I am able to set the style for the selected feature, but getStyle does not return the style of the selected feature. Can anyone help please?