Support from Acquia helps fund testing for Drupal Acquia logo

Comments

proconnor15 created an issue. See original summary.

proconnor15’s picture

Assigned: proconnor15 » Unassigned
proconnor15’s picture

btopro’s picture

Newer versions of leaflet don't work w/ the widget. This makes it so that when editing a node that uses the widget it uses the built in library. The end user won't know the difference as the end result output / view / whatever that visualizes the data will use the real version of the library.
By always using the built in version you guarantee compatibility.

btopro’s picture

Status: Active » Needs review
smithmilner’s picture

Hey. I put some work into the widget a few weeks ago to get it working with new versions of leaflet. It can be found in the develop branch here https://github.com/tnightingale/Leaflet.widget

I talked with Tom and he's keen to get it into master.

IckZ’s picture

Thanks @Donny..! Thats awesome if i works :) I will try it out and give a feedbad asap

smithmilner’s picture

Try it with this patch as well. It works for me. https://www.drupal.org/node/2812687

Shiraz Dindar’s picture

Hey @Donnyboypony!! What's up old friend? Funny meeting you here!!

So I'm using the Leaflet widget for a project. It works great with Leaflet JS 0.77. But with Leaflet JS 1.02 (the now stable release) or later, it doesn't work, as in the O.P. (and the O.P. patch presents a new error (L.Marker.addInitHook), so I reverted that).

Regardless if I update Leaflet.widget JS to your develop release or leave it on master, I get the same error in the widget -- MultiPolyline function is not found, which makes sense because it's there in Leaflet JS 0.77 but it's not there in Leaflet JS 1.02.

Thirdly, if I revert Leaflet JS to 0.77 and switch Leaflet.widget to your develop release, I do in fact get the new widget (as can be seen with the addition of square and circle buttons, and overall it behaves better). However, I am also using geocoder on the leaflet widget field, and if I try geocoding with your develop release, it reports something about handlers. If I then apply your patch in #8, then geocoding does work, but then most of the buttons on the widget (the ones to select the geo type) are gone, leaving me only with the Delete button and a layer-something button.

So I don't need any of this to work, but it would be nice to upgrade to both the latest Leaflet JS and your develop release of Leaflet.widget JS. As much as anything, I just wanted to let you know what my experience was...

Cheers!

Shiraz Dindar’s picture

Ignore my last message Donnyboypony! I realized that your patch to fix geocode added configurable draw handlers on the widget, which I needed to enable.

So I have everything working now (with Leaflet JS 1.03, latest Leaflet module, your develop branch of Leaflet.widget, geocoder 1.3, Leaflet.draw JS 0.4.9), though there were two other issues that I needed to patch:

1. Mentioned above, L.MultiPolyline function is called by Leaflet widget JS, but the function no longer exists in Leaflet JS, breaks the widget. I just commented the calls out with no apparent functionality loss.

2. Also from the Leaflet JS upgrade, I was getting blank icons for the points. I had to add a trailing slash to the path to icons as defined in the Leaflet widget module.

I'll attach patches here for both, more for ppl's interest sake than for inclusion, as I'm wondering why you haven't run into this yourself, but if you want me to formally submit these to the right places, lmk.

nigelw’s picture

I am having a tough time with all of the current patches floating around the issue queue. Any chance can someone who has a working version of the module and libraries post them here? If you happen to have a collection all ready to go? Any help would greatly be appreciated.

Shiraz Dindar’s picture

Nigel, this is what I am using which works for me:

- Leaflet module 1.4
- Leaflet Widget module latest dev release with the 2nd patch from comment #10 and this patch: configurable-draw-handlers-2812687-4.patch. Note, *not* using the original patch, #3, in this issue.
- Leaflet JS library 1.0.3
- Leaflet Widget JS on the develop branch, with 1st patch from comment #10
- Leaflet Draw JS latest master (0.4.x) Leaflet Draw JS included with Leaflet widget module.

Note, the above works for me on a geofield with a cardinality of 1. I actually need multi val. If you set the geofield to multival, it works, such that the leaflet widget then lets you select multiple features on a map, creating multilines, multi polygons multigeoms (though still storing with a single field), though I'm having issues with the layer editor and ability to delete individual features, which I'm currently working on.

Probably of less interest:
- geofield 2.3
- geoPHP 1.7+7-dev
- geocoder 1.3
- ip_geoloc (drupal module sits on top of leaflet module and provides extra functionality)
- leaflet fullscreen JS
- leaflet markercluster JS

nigelw’s picture

@Shiraz Dindar,

Thanks. I finally got most of it to work. The only thing that doesn't work is markers. I can place them but when I save the map, nor the marker doesn't show. Polygons show fine though.

Edit: It was leaflet marker cluster messing things up. I have tried using the latest versions but no go. I have disabled it for now and will work for the meantime.

sano’s picture

@Shiraz Dindar,

Thank you for listing the modules/versions that work for you. I followed also info in this comment of yours, made the set of modules I use to match yours and finally (after many hours) made the stuff behave. Thanks again.