I would like to just have the option to create a single point, and if a new point is created it deletes the previous one. At the same time if you click on the point you just added, I would like it to be dragable.

So essential a node only has 1 point.

Sorry if this is something obvious but I've been looking for days to try to find this. I was able to do this with Gmap module.

CommentFileSizeAuthor
#4 limit_to_single_point-1630836-3.patch5.04 KBbatje
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

majovdh’s picture

Hello,

Just want to point out this is an important issue. I'm discussing this on the following site where they suggest a solution. However this is nog working for me (yet).

http://drupal.stackexchange.com/questions/24327/how-to-limit-number-of-p...

Majo

Iztok’s picture

This is really weird since I have tested this week or two before and I could only put one point there but now as you say, we can put unlimited points on the map.

Has someone found any solution to force one point?

LaFabrik’s picture

It seems that's what i'm describing here : http://drupal.org/node/1632168#comment-6112288 except that your are under D7 and me D6, but i think it's the same problem

batje’s picture

Attached is a patch that fixes

- a typo
- an error that you dont see but that stops drawing other behaviours if you do not provide an element id
- the limit issue mentioned here.

batje’s picture

Status: Active » Needs review
majovdh’s picture

i suppose this patch will be added to the next release of open layers? Or do we have to put this in a queu somewhere?

Majo

batje’s picture

You can install this patch see if it works and provide feedback. If that feedback is all good, you can change the status of the issue to "reviewed and tested by the community"

It takes a maintainer to commit the patch to the module, and then make a new release.

To answer your question, this is the queue

Pol’s picture

Status: Needs review » Reviewed & tested by the community

Just tested right now and it's working good !

Thanks for this interesting patch !

majovdh’s picture

Patricia_W’s picture

subscribe

Pol’s picture

Patricia,

There is no need to subscribe anymore to get update, you can use the top right button "follow" to do that without alerting all the people subscribed to the thread.

Thanks.

steinmb’s picture

Any chance that we aloc could get a backport to 6.x-2.x?

Pol’s picture

Status: Reviewed & tested by the community » Needs review

nod_ and/or Jeffshuller, would you please review the patch too ?

As we are not supposed to add new functionnalities to 7.x-2.x, I'm still willing to put this is.

Thanks

friedjoff’s picture

Looks good to me. Seems more like a bugfix than a new feature, so RTBC from my point of view.

Pol’s picture

Status: Needs review » Closed (fixed)

I modified the patch to remove some withespaces and committed it.

Thanks !

http://drupalcode.org/project/openlayers.git/commit/fcdab87

jfarry’s picture

Hi guys,

I'm not sure if I'm using this completely wrong, but shouldn't the limiting feature be in the "Geofield" behaviour instead of the "Draw" behaviour?

In my situation I have a content type with a map as my input. Clicking the map sets the point (must be a single point), but if I have "Draw" selected as a map behaviour, instead of "Geofield", I get an error when editing that field of the content type to say "Error: You have no compatible openlayers maps. Make sure that at least one preset has the 'GeoField' behavior enabled and that it does not have the 'Draw Features' behavior enabled (which is incompatible)."

With the "Geofield" behaviour set, I have "Store each simple feature as a separate field." selected in my field settings, as well as "Required field" checked and the "Number of values" set to 1, but the last two don't seem to be enforced. I can set as many points as I want, or I can set none and the form will still submit. Is there something stupid that I'm missing? I swear I know all the behaviours off by heart now lol.

Cheers :)
Josh

jfarry’s picture

Status: Closed (fixed) » Active
roma4ke’s picture

I took files from the last commit. Can't select openlayer map in my node type
( The "Draw Features" bahavior is incompatible - presets with this behavior are not shown.).
Or i made something wrong ?

batje’s picture

@roma4ke could you create a new issue for that?

cavla’s picture

In my case when i apply the patch i get a HTTP Error 500 (Internal Server Error) probably related to the clone of the original map widget.
This error come when i want to edit a content that comes with an openlayers map...

Anyone else having this issue?

batje’s picture

@cavla, can you create a new issue for this, and post whatever is happening in your apache error.log file into that issue?

cavla’s picture

Hi batje,

Thanks for your reply.

I did get rid of the server issue but after applying the patch i still have unlimited points... ;(
Do i need to do smthg after the patching?
Thanks

batje’s picture

The patch was committed to the 7.x-2.x-dev version. So, 2 things:

- Install that version. This issue is closed, as the code has been commited.
- If you still find the issue, describe what you are doing to get there in a new issue.

cavla’s picture

Thanks batje,

I got it Fixed!

I used Xi's solution posted here: drupal.org/node/1773906 and it s working!

balagan’s picture

I think this is a geofield issue. I did some debugging, and in 7.x-1.1 version, in the geofield.widgets.inc file the geofield_widget_openlayers_afterbuild function cannot get the $settings variable, so the data_storage defaults to 'collection'. This part is missing from the .dev version, so I hope it is working there.
This is a duplicate of http://drupal.org/node/1647416

Pol’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Dave Cohen’s picture

Status: Closed (fixed) » Fixed

This thread is marked fixed, but can someone tell me how it is fixed?

Is it the patch early in this thread?

Is it the link by calva in #24?

Is it the link by balagan in #25?

I'm using 7.x-2.x and would like this fixed on my site. Thanks.

Pol’s picture

Hello,

I'm quite busy with other stuff right now, patches are welcome.

Thanks.

balagan’s picture

This should be marked as a duplicate of http://drupal.org/node/1647416

I am using patch http://drupal.org/node/1647416#comment-6845920
but Mr.bailey's patch http://drupal.org/node/1647416#comment-7114722 is a nicer solution that should be reviewed by the community in order to fix it. Maybe you just use that and give us a feedback. Just checked, it is already reviewed, so just have to apply it.

Pol’s picture

It's mainly for GeoField then ?

balagan’s picture

Ah, sorry, you are right. I have meddled with it some time ago and forgot to check it now.

Dave Cohen’s picture

Hmmm.. doesnt' work for me. Even with that patch, user can click any number of points on the map.

balagan’s picture

Maybe you should post it there. Are you sure you are using geofield v2? Don't know if this bug exists in 1.x version at all.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.