Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using the map widget to insert location information. Setting and dragging markers works. How do i remove markers from the map?
Comment | File | Size | Author |
---|---|---|---|
#20 | geofield-delete_feature_fix-1350320-20.patch | 764 bytes | m.stenta |
#19 | howto-edit-feature.png | 126.11 KB | boabjohn |
#13 | geofield-delete_feature_fix-1350320-13.patch | 2.02 KB | Ericmaster |
Comments
Comment #1
nod_click the edit feature (the leftmost button), select your feature and hit delete :)
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThis closes the overlay (Chrome on Mac).
Comment #3
nod_Looks like you found a bug in overlay. Try another browser. Works for me in FF & Chrome windows.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedBackspace != Del
It works as described.
Thanks
Comment #5
Leander Bindewald CreditAttribution: Leander Bindewald commentedto save others the 20 embarrassing min it took me to figure it out:
delete on mac = fn+backspace
cheers
Comment #6
Patroclas CreditAttribution: Patroclas commentedThis does not work for me in FF or Chrome - it just exits the edit screen.
Comment #7
phayes CreditAttribution: phayes commentedRe-opening as it sounds like there are some lingering issues. Assigning to me so I can investigate.
Comment #8
nod_@patroclas can, you be more specific about the version of browser you're using ? Works for me on win and nux.
Comment #9
Patroclas CreditAttribution: Patroclas commentedI am working from the dev version now and it does work OK with the DEL key on Windows 7. Not sure if it was my settings or not.
Comment #10
phayes CreditAttribution: phayes commentedThanks for the follow-up @Patroclas. Closing this ticket. Feel free to re-open if there are remaining issues.
Comment #11
AaronBaumanGeofield 7.x-1.x-dev and geofield 7.x-2.x-dev
OpenLayers 7.x-2.x-dev
none of these keys or key combos work on osx 10.8.4 with the following browsers
Safari 6.0.5
Chrome 29.0.1547
Firefox 22
Firefox 23:
del
backspace
command-del
command-backspace
opt-del
opt-backspace
ctrl-del
ctrl-backspace
shift-del
shift-backspace
pressing "del", along with any modifier key, results in the following javascript error (or similar) on the console:
i do not have a "fn" key.
Comment #12
thtas CreditAttribution: thtas commentedI fixed this by forcing openlayers.module to use openlayers 2.12.
The update to 2.13 means the selectControl method doesn't exist on that class anymore.
See https://github.com/openlayers/openlayers/blob/master/notes/2.13.md#contr...
So the behaviour js needs updating to be compatible with the latest openlayers.
Comment #13
Ericmaster CreditAttribution: Ericmaster commentedHere is a patch I just created to fix this if you still want to use version 2.13.
Comment #14
Ericmaster CreditAttribution: Ericmaster commentedComment #15
garbo CreditAttribution: garbo commentedThanks EricMaster,
Your patch works halfway. The point are removed after saving the node. But they display visible while editing until the savebutton is hit.
Comment #16
gregoryshearer CreditAttribution: gregoryshearer commentedIs there going to be any additional followup on this issue? I can also confirm the issue described in #11. I get a similar javascript error in the console upon pressing the delete key. I can also confirm downgrading the OpenLayers library to 2.12 fixes this issue. (I installed it locally under sites/all/libraries and changed the settings for OpenLayers module in the gui.)
I can also confirm that the recent patch works for the most part. You can select the item and hit Delete it does disappear from the display in the edit screen, but if you then click a different point (say you want to delete two points) the one you just deleted reappears. It cannot be selected or deleted again, I think because it is actually gone. When you save the node it is gone from the display and if you edit the node again it is gone.
Thanks for the module and the patch!
Geofield 7.x-2.1 and OpenLayers 7.x-2.0-beta9
Comment #17
tdurocher CreditAttribution: tdurocher commentedI have the same problem. All my modules and layers have been downloaded in the last few weeks. This may be a duplicate of https://www.drupal.org/node/2320353, which was also just reported recently. I actually think this issue here is about two different problems that sound similar - the first from 3 years ago, the second since OL 2.13.
Comment #18
tdurocher CreditAttribution: tdurocher commentedActually I have now succeeded in doing this. The trick, for me anyway, is to click on the marker first to select it. It will not give any indication that it is selected but when you hit the delete key fn-delete on mac. I'm not using the line or polygon so not sure if that works, but the points to (usually). I know - I wasted a lot of time on this too. Kind of frustrating for such a simple problem.
Comment #19
boabjohn CreditAttribution: boabjohn commentedG'Day all,
After yet another hour of reading threads on this issue it seems like I have no idea how it is "supposed to work" on either Mac or PC.
The basic problem seems to be the lack of a clear [edit] mode that is signalled to the user through the UI.
People are confused:
https://www.drupal.org/node/2320353
https://www.drupal.org/node/1586442
https://www.drupal.org/node/1773906
There is the complexity of people who need the map to allow only one feature (respect limits defined in the field config); there is the problem of how to edit a point (drag) vs delete vs edit/delete a vertice in a polygon.
And there is the confusion of storing each feature as a separate field vs storing them as a collection (eg, it seems possible to set Store as a collection=true AND limit features to 1...does that mean 1 collection of multiple points is allowed?)
Anyway, those are some of the twisty bits I've found in the general area of HOW TO EDIT MARKERS.
Now specifically, I just don't get the interface. In the screenshot, you see the point and poly tools are black (means "selected", or not?) and the pan cursor is grey (means inactive? No idea...yet)
USECASE: Delete the polygon. What do I do?
1: Simply "click on the feature and hit delete"
2: Choose the pan button, then click on the feature and hit delete
3: Choose the polygon tool, click on the feature
4: Add new point, try to delete
Acck.
My system: Win7/FFox latest. Widget is set to allow shape modification, store each feature as separate field, and unlimited values. Geofield 7.x-2.3 (I didn't want to hijack this issue version), and OpenLayers 7.x-2.0 beta11 on top of OL2.13 from external source)
I'm quite happy to accept that I don't "get it"...but it would be much easier to figure out if there were a clear "How-to edit features" so at least I would know if this is a collection of bugs, poor UI, or just my ignorance.
As a proposition, if someone would be so kind as to just explain what is supposed to happen that would be great. I'll make a screencast and some notes to go with the docos.
Thanks in advance!
Comment #20
m.stenta@amorsent and I spent some time digging into this issue today.
It is definitely the issue described in #12: The new version of Openlayers (2.13) removed the selectControl method from the ModifyFeature class.
The release notes for Openlayers 2.13 explain how to fix it:
It seems that is what @Ericmaster was doing in his patch in #13. However, I think the release notes are a little misleading in this case, and it isn't necessary to do all of that.
Attached is a patch that simply changes
this.selectControl.unselectAll();
tothis.unselectFeature();
.The unselectFeature() actually seems like a better choice than what was there originally... because it isn't unselecting everything... just the feature in the current layer. In practice, this is probably always the same thing, but using this.unselectFeature() feels more specific, and therefore cleaner.
Note: there does still seem to be a minor issue, but I'm not sure if it's related to this one. After creating a feature, I need to click on the Modify button twice before I'm able to select the feature. But it does work. If you don't click twice, though, it seems like it doesn't work. It took me a little while to realize this, and the ability to select seemed very buggy...
@boabjohn: Digging into the geofield behavior JS shined some light on the way this is meant to work. The behavior adds the four buttons: Polygon, Point, Line, and Modify. The Modify button uses the pan icon, which is confusing, but looking at the icon set that the OpenLayers module includes, it makes sense why it was chosen... there aren't many choices (http://cgit.drupalcode.org/openlayers/plain/themes/default_dark/img/edit...). Perhaps a new icon should be added that is a little more clear that it is for modifying features. "Panning" is done simply by clicking and dragging maps, regardless of which button control is selected, so using a "pan" icon is misleading.
Simple fix! Please test and change to "Reviewed and Tested by the Community" so it can be committed!
Comment #21
m.stentaOh yea, this needs to be a Bug Request... and it's pretty important, I would say... and it's in the latest 7.x-2.x branch.
Comment #22
m.stentaChanging title to reflect the issue that everyone here is referring to, as far as I can tell.
Comment #23
boabjohn CreditAttribution: boabjohn commentedFantastic! I will be testing this shortly...thank you indeed.
And: did you mean to imply that we could propose a new icon for use instead of the pan tool? I think even the pencil (without the +) would be a great UI improvement. The pencil could also be mirrored right-left to give it a bit more distinction from the current Add Feature pencil.
Comment #24
m.stentaYea, that's what I was thinking: add a new icon for "modify feature" button. A pencil would work, but I don't think there should be two pencils in the icon set... even with a "+" on one of them for distinction, I think it would be confusing. The current "pencil w/ plus" icon is used for adding POINTS to the map. Maybe there's a better icon for that? Other than a pencil with a plus? Perhaps just a dot?
If this solves the issue for you, please mark as "Reviewed and Tested by the Community" so we can get it committed!
Comment #25
caspervoogt CreditAttribution: caspervoogt commented@boabjohn, your step-by-step is a useful illustration of the issue. I found that I could not move / select a point except following this order;
1. click the 'add point' tool (looks like a pencil)
2. click the pan tool
3. click a point. Now I can drag it.
4. click Delete. Nothing happens. Well, this happened though: "Uncaught TypeError: Cannot read property 'unselectAll' of undefined".
I applied the patch from #20 and that solved it. Now the pan tool starts off looking activated, which led me to think I should be able to directly select a point and hit Delete. Not the case;
Now all I need to do is:
1. click the 'add point' tool
2. click the pan tool
3. click a point (now I can drag it)
4. click Delete
So basically the Pan tool starts off looking active, but to get the Delete function active I have to click Pencil then Pan, on Chrome/Windows 7 anyway.
Good fix!
Comment #26
m.stenta@plethoradesign: I created a separate issue for the clicking issue: #2397361: Selecting features requires clicking the Modify button multiple times
Can you read through that and confirm? Let's continue work in that issue thread.
I think this one is good to go, if you confirm that the delete bug is fixed by my patch. Want to set this to "Reviewed and tested ny the community"? It would be nice to get it committed...
Comment #27
SidneyGijzen CreditAttribution: SidneyGijzen commentedConfirming that the patch from #20 works with Geofield 7.x-2.3 and OpenLayer 7.x-2.0-beta11 (OL 2.13). Thanks m.stenta!
Comment #28
rutzmoser CreditAttribution: rutzmoser commentedAlso confirming that #20 works using slightly older versions of Geofield 7.x-1.2 and Openlayers 7.x-2.0-beta9 (OL 2.13)
Comment #29
fonant CreditAttribution: fonant at Fonant Ltd commentedConfiming that patch #20 works here to allow polygons to be deleted.
Geofield 7.x-2.3
Openlayers 7.x-2.0-beta11
Openlayers library version 2.13