Closed (fixed)
Project:
Leaflet
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Sep 2011 at 11:09 UTC
Updated:
5 Jul 2020 at 11:59 UTC
I failed to find the way to use leaflet map as input widget for geofield. Is it planned?
Comments
Comment #1
levelos commentedAt some point, definitely. No timeline available at this point.
Comment #2
pribeh commentedI'm going to see if I can get someone to look at building this soonish.
Comment #3
pribeh commentedAlso, this may be of interest to anyone checking out this issue queue: http://drupal.org/node/1393246#comment-5699892
Comment #4
mgiffordI brought this up elsewhere and it was marked as a duplicate #1734594: Geofield widget type
Comment #5
danielbeeke2 commentedI have started working on an input widget see the duplicate issue -> http://drupal.org/node/1734594
Comment #6
chi commentedHere is our solution. I think we should collaborate and maintain it as part of the Leaflet module.
http://drupal.org/sandbox/Chi/1796796
Comment #7
pvhee commentedNice work! It would be good if the sandbox by danielbeeke (https://drupal.org/sandbox/GoalGorilla/1792420) and that of Chi (http://drupal.org/sandbox/Chi/1796796) could be merged, and promoted to a full project that relies on Leaflet.
I believe this is better than having it part of Leaflet, so we don't bloat the module for people that do not need the widget and make maintenance easier.
Comment #8
pvhee commentedAn issue to look at is #1627940: Add optional geocoding to map input widget. Geocoding in combination with a map widget would definitely make sense, and I would love to see this working out-of-the-box with Leaflet (in a Leaflet Widget/Geocoder/Geofield combination).
Comment #9
danielbeeke2 commentedI think we should fix this by creating/contributing to two leaflet plugins. Leaflet.draw is a good one for the input elements and for geocoding I have seen a bing version. I personnaly like google geocoding a lot more.
I will work on some spec ideas and post them here
Comment #10
chi commentedLeaflet formatter is a part of the Leaflet so I still think it's not a good idea to keep input widget out of the Leaflet module.
I've added @pvhee and @danielbeeke to the list of Leaflet widget maintainers.
Comment #11
pvhee commentedChi, I understand that it might make sense to have them integrated, but I believe the strength of Leaflet when compared to the much more feature-rich OpenLayers in Drupal is the fact it is slim. It does one thing - displaying the map - and does it well, either using formatters, either using Views.
Adding to that the part of actually interacting with the mapping by adding new vectors (points, polygons, etc) is a completely different thing and requires a neat UX experience. Keeping the maintenance of these two things separate will allow it to evolve much faster. Then, at some point these could be merged I guess, but after they've had critical review from the community as a separate project. Does that make sense?
Comment #12
chi commentedOk, let's start a separate project.
Comment #13
levelos commentedThanks for the moving this important feature forward. FWIW, I support the separate module approach in order to keep Leaflet true to it's design goals of being a lightweight base to build mapping solutions with. Not every use case requires an input widget. Would make sense to move this ticket into the new project when it's created.
Comment #14
danielbeeke2 commentedLeaflet input formatter
I think we should make something like the following specs:
Widget requirements (in order of importance):
Default widget settings:
You can add ideas to the google docs document,
https://docs.google.com/document/d/1zCVZ_SISAdKBDUjQjJgz_4JJN__mw41THpoh...
Comment #15
hawkbreeze commentedNow it looks like we have 3.
Has a new project been created or are the creators of these sandboxes still doing there own thing? I noticed Daniel's last commit had "onwards..." in the commit message that was dated on the 3rd Oct.
Thanks
Comment #16
danielbeeke2 commentedI will work further on it next week,
Had a busy week.
I pulled the new widget from tnightingale and some things a different, will look into it and see if we can work together.
Comment #17
tnightingale commentedHey guys, yeah I recently committed some work I've done on a Leaflet.draw based widget to my sandbox. However most of my work has been going on here https://github.com/thegreat/Leaflet.widget.
My plan is to provide a Drupal-independent handler that binds to a html element (
<input>/<textarea>/etc) and reads/writes GeoJSON to the element. Leaflet has excellent support for loading GeoJSON via the L.GeoJSON layer. My widget code extends this by converting markers, polylines, polygons (currently without holes) and their multi-equivalents back into GeoJSON.Right now I am working on a 'select' tool to go alongside the other Leaflet.draw provided controls. Selected features will have actions performed on them. I'm currently working on a 'remove' action but I could also see the possibility for 'grouping' (creating multi-* geometries or GeometryCollections) or 'moving' features.
The idea for the Geofield integration is to minimize redundant parsing & generation of WKT/GeoJSON on both the client and the server. The widget only needs to expose a hidden input field (already handled by Geofield/FAPI) and have it bound it to a new Leaflet.widget handler. Upon form submission, the Leaflet.widget handler outputs it's features to GeoJSON and writes them into the input field, much like how the wysiwyg modules work. The data is then processed by Geofield's existing GeoJSON support.
I have been actively working on this as we need these features for some upcoming client work though I am open to collaborating with others who share similar interests and/or needs.
Comment #18
danielbeeke2 commentedIt is exactly the same in functionality, could you pull my sandbox and check it out?
We should merge the module and apply for a full version soon.
Comment #19
tnightingale commentedI have had a read though the code in your sandbox. It looks like it currently only supports POINT geometries. You're right though, there is overlap on the Drupal side of things. As I mentioned above, my focus is on stabilizing the Leaflet plugin which has full support for all primitive geometry types and partial support for complex ones.
My suggestion is that we merge the Drupal code (FAPI widget declaration, widget settings form; base layer, default center & zoom, & other settings) and adapt it to work with Leaflet.widget. You can view a functional demo here http://dl.dropbox.com/u/48433/Leaflet.widget/example/Leaflet.widget.html.
EDIT: I've updated the demo mentioned above and the README associated with the Leaflet.widget repository. Select and remove buttons are now working ...mostly ;).
Comment #20
ajmartin commentedJust thought I'd throw in my 2 cents worth... In whatever form this project progresses, I think it would be nice to have:
Thanks for your work on this project!
Comment #22
tnightingale commentedFor those still following along, I've promoted my sandbox to a full release: http://drupal.org/project/leaflet_widget. Feedback welcome/wanted! :)
Comment #23
hawkbreeze commentedGreat! I'll test it and submit feedback on the project page. Thanks.