Hello All, i am working to achieve following, <br>1. Click to add a vector feature with custom icon and label at the point of click (Completed)<br>2. Click to select any drawn feature and delete it (Completed)<br>3. Click to select any drawn feature and Modify it. ( By deleting and re-creating the a new feature at the same place with new icon and label) (Completed)<br>
the code is posted below. Now the only problem i am facing it is as follows:<br><br>When ever i activate the dragFeature  control, the icons (Vector features) become drag-able, but i cannot select them any more. My desired functionality is heavily dependent on the select feature, as only after selection i can modify and delete the features. How can i work around this problem? Any suggestions are welcome. <br>
<br>Also, is it a good practice to Edit a feature as in point 3? , is there a better way? <br><br>Thanks in advance.<br><br>--------------------------------My Code is as follows-------------------------------------<br>&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&quot;&gt;<br>
    &lt;head&gt;<br>        &lt;title&gt;OpenLayers Click Event Example&lt;/title&gt;<br>        <br>        &lt;link rel=&quot;stylesheet&quot; href=&quot;../theme/default/style.css&quot; type=&quot;text/css&quot; /&gt;<br>
        &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot; /&gt;<br>        &lt;script src=&quot;../lib/OpenLayers.js&quot;&gt;&lt;/script&gt;<br>        &lt;script type=&quot;text/javascript&quot;&gt;<br>
   <br>        var SHADOW_Z_INDEX = 10;<br>        var MARKER_Z_INDEX = 11;<br>        var DIAMETER = 200;<br>        var NUMBER_OF_FEATURES = 15;<br>      <br>        var selectedFeatureID = &quot;None&quot;;<br><br>            var map,layer2, layer, selectedFeature;<br>
            function init(){<br>                map = new OpenLayers.Map(&#39;map&#39;);<br>                var ol_wms = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,<br>                    &quot;<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>?&quot;, {layers: &#39;basic&#39;} );<br>
<br>                var jpl_wms = new OpenLayers.Layer.WMS( &quot;NASA Global Mosaic&quot;,<br>                &quot;<a href="http://t1.hypercube.telascience.org/cgi-bin/landsat7">http://t1.hypercube.telascience.org/cgi-bin/landsat7</a>&quot;, <br>
                {layers: &quot;landsat7&quot;});<br><br>                jpl_wms.setVisibility(false);<br>                map.addLayers([ol_wms, jpl_wms]);<br>                map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
                map.zoomToMaxExtent();<br><br>         layer = new OpenLayers.Layer.Vector(&quot;Vector Layer 1&quot;, {<br>                styleMap: new OpenLayers.StyleMap({<br>                    &quot;default&quot;: new OpenLayers.Style(OpenLayers.Util.applyDefaults({<br>
                        externalGraphic: &quot;${icon}&quot;,<br>                  label : &quot;${name}&quot;,<br>                        graphicOpacity: 1,<br>                  backgroundGraphic: &quot;./marker_shadow.png&quot;,<br>
                  graphicYOffset: -25, // shift graphic up 28 pixels<br>                        // Makes sure the background graphic is placed correctly relative<br>                        // to the external graphic.<br>                        backgroundXOffset: -2,<br>
                        backgroundYOffset: -20,<br>                        // Set the z-indexes of both graphics to make sure the background<br>                        // graphics stay in the background (shadows on top of markers looks<br>
                        // odd; let&#39;s not do that).<br>                        graphicZIndex: MARKER_Z_INDEX,<br>                        backgroundGraphicZIndex: SHADOW_Z_INDEX,<br>                        pointRadius: 10<br>
                    }, OpenLayers.Feature.Vector.style[&quot;default&quot;])),<br>                    &quot;select&quot;: new OpenLayers.Style({<br>                        //externalGraphic: &quot;../img/marker-blue.png&quot;,<br>
                  pointRadius: 15,<br>                  graphicYOffset: -35, <br>                  backgroundXOffset: -2,<br>                        backgroundYOffset: -30<br>                    })<br>                })<br>
            });<br> <br>            map.addLayers([layer]);<br>           <br>            // Add a drag feature control to move features around.<br>            var dragFeature = new OpenLayers.Control.DragFeature(layer);<br>
            map.addControl(dragFeature);<br>            //dragFeature.activate();        <br><br>           <br>                var click = new OpenLayers.Control.Click();<br>                map.addControl(click);<br>                click.activate();<br>
<br>        selectControl = new OpenLayers.Control.SelectFeature(<br>                [layer],<br>                {<br>                    clickout: true, toggle: false,<br>                    multiple: false, hover: false,<br>
                    toggleKey: &quot;ctrlKey&quot;, // ctrl key removes from selection<br>                    multipleKey: &quot;shiftKey&quot; // shift key adds to selection<br>                }<br>            );<br><br>
            map.addControl(selectControl);<br>            selectControl.activate();<br>         layer.events.on({<br>                &quot;featureselected&quot;: function(e) {<br>               var lonlat = map.getLonLatFromViewPortPx(e.xy);<br>
                    showSelectedStatus(e.feature);<br>                },<br>                &quot;featureunselected&quot;: function(e) {<br>                    showUnSelectedStatus(e.feature);<br>                }<br>            });<br>
           }<br><br>         OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                <br>                defaultHandlerOptions: {<br>                    &#39;single&#39;: true,<br>                    &#39;double&#39;: false,<br>
                    &#39;pixelTolerance&#39;: 0,<br>                    &#39;stopSingle&#39;: false,<br>                    &#39;stopDouble&#39;: false<br>                },<br><br>                initialize: function(options) {<br>
                    this.handlerOptions = OpenLayers.Util.extend(<br>                        {}, this.defaultHandlerOptions<br>                    );<br>                    OpenLayers.Control.prototype.initialize.apply(<br>
                        this, arguments<br>                    ); <br>                    this.handler = new OpenLayers.Handler.Click(<br>                        this, {<br>                            &#39;click&#39;: this.trigger<br>
                        }, this.handlerOptions<br>                    );<br>                }, <br><br>                trigger: function(e) {<br>                    var lonlat = map.getLonLatFromViewPortPx(e.xy);<br>                    //alert(&quot;You clicked near &quot; + lonlat.lat + &quot; N, &quot; +lonlat.lon + &quot; E&quot;);<br>
                <br>                //layer.removeFeatures(layer.features);<br>                var features = [];<br>                    var myMarker = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonlat.lon , lonlat.lat)); <br>
                var MarkerLabel= document.getElementById(&quot;Marker Label&quot;).value;<br>                var MarkerIcon= document.getElementById(&quot;Icon&quot;).value;<br>                myMarker.attributes = {<br>                                        name: MarkerLabel,<br>
                                icon: &quot;../img/&quot; + MarkerIcon + &quot;.png&quot;,<br>                                radius:10<br>                                };<br>                features.push(myMarker);<br>
                layer.addFeatures(features);<br>                }<br>            });<br><br>      function showSelectedStatus(feature) {<br>         selectedFeature = feature;<br>             document.getElementById(&quot;status&quot;).innerHTML = &quot;selected feature &quot;+feature.geometry.getBounds().getCenterLonLat() +&quot; on Vector Layer 1&quot;;            <br>
        }<br><br>    function showUnSelectedStatus(feature) {<br>            document.getElementById(&quot;status&quot;).innerHTML = &quot;Un selected feature &quot;+<a href="http://feature.id">feature.id</a>+&quot; on Vector Layer 1&quot;;            <br>
        selectedFeature = &quot;None&quot;;<br>           }<br><br>    function DelMarker()<br>{<br> layer.removeFeatures(layer.selectedFeatures);<br>}<br>    <br>    function EditMarker()<br>    {        <br>            if ( selectedFeature != &quot;None&quot;)<br>
                {<br>            layer.removeFeatures(layer.selectedFeatures);<br>                var features = [];<br>                    var myMarker = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(selectedFeature.geometry.getBounds().getCenterLonLat().lon , selectedFeature.geometry.getBounds().getCenterLonLat().lat)); <br>
                var MarkerLabel= document.getElementById(&quot;Marker Label&quot;).value;<br>                var MarkerIcon= document.getElementById(&quot;Icon&quot;).value;<br>                myMarker.attributes = {<br>                                        name: MarkerLabel,<br>
                                icon: &quot;../img/&quot; + MarkerIcon + &quot;.png&quot;,<br>                                radius:10<br>                                };<br>                features.push(myMarker);<br>
                layer.addFeatures(features);<br>                }<br>    }  <br><br>        &lt;/script&gt;<br>    &lt;/head&gt;<br>    &lt;body onload=&quot;init()&quot;&gt;<br>        &lt;h1 id=&quot;title&quot;&gt;Click Event Example with Custom Marker&lt;/h1&gt;<br>
        &lt;div id=&quot;tags&quot;&gt;<br>        &lt;/div&gt;<br>        &lt;p id=&quot;shortdesc&quot;&gt;<br>            This example shows the use of the click handler and getLonLatFromViewPortPx functions to trigger events on mouse click.It also shows how to add a custom marker with custom Icon <br>
        &lt;/p&gt;<br>        &lt;div id=&quot;map&quot; class=&quot;smallmap&quot;&gt;&lt;/div&gt;<br>  <br>        &lt;div id=&quot;docs&quot;&gt;<br>            &lt;label for=&quot;Marker Label&quot;&gt; -Label&lt;/label&gt;<br>
                &lt;input id=&quot;Marker Label&quot; type=&quot;text&quot; size=&quot;5&quot; maxlength=&quot;5&quot;<br>                       name=&quot;Marker Label&quot; value=&quot;label&quot; onchange=&quot;update()&quot; /&gt;<br>
<br>        &lt;label for=&quot;Icon&quot;&gt;Icon&lt;/label&gt;<br>            &lt;select name=&quot;Icon&quot; id=&quot;Icon&quot;&gt;<br>                &lt;option value=&quot;marker&quot; selected=&quot;selected&quot;&gt;marker-red&lt;/option&gt;<br>
                &lt;option value=&quot;marker-blue&quot;&gt;marker-blue&lt;/option&gt;<br>                &lt;option value=&quot;marker-gold&quot;&gt;marker-gold&lt;/option&gt;<br>                &lt;option value=&quot;marker-green&quot;&gt;marker-green&lt;/option&gt;<br>
            &lt;/select&gt;<br>        &lt;button onclick=&quot;DelMarker();&quot;&gt;Delete Selected Marker&lt;/button&gt;&lt;br /&gt;<br>        &lt;button onclick=&quot;EditMarker();&quot;&gt;Edit Selected Marker&lt;/button&gt;&lt;br /&gt;<br>
        &lt;/div&gt;<br>    &lt;div id=&quot;status&quot;&gt;&lt;/div&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;<br>------------------------------------------------------------------------------------------------------------------------<br>