Leaflet Widget for Geofield
Leaflet Widget for Geofield is a widget that provides a Leaflet based widget for adding and removing geometries (point, lineString, polygon) to a leaflet map and then have geofield store it.
Requirements
Installation
Users that already have a geofield setup that is working can jump to (Install the widget).
- Install goefield and geoPHP (see requirements).
- Add a geofield to the content type you what to tag with geo-data. Choose WKT as a input widget and Geofield in the field display settings.
Dispaly settings
You should now be able to add geo-realated data to your nodes. Make sure that this is working by example creating a new node and paste this WKT for the city of Paris, France into the field:
GEOMETRYCOLLECTION (POINT (2.382317 48.849129))
Viewing the node should now display a map of Paris. If not. Please go back to the geofield documentation and troubleshoot.
Install the widget
We expect that your geofield is added to your content type and you are sure it is working correctly.
- Download Leaflet Widget and place it in your libraries directory (sites/all/libraries). Make sure you rename the directory to Leaflet.widget (case sensitive).
- Download and install Leaflet Widget for Geofield (this module).
- You are now ready to use the this new widget. Go to your geofield setting and the new widget should show up in your widget list. Enable it and it should show up when you edit/create new nodes.
Troubleshooting
Check your Drupal logs (admin/reports/dblog). If the widget is having problem loading the js there will be entries in there trying to tell you what is going on.
Enable your favorite browser debugging tool (example Firebug) and load the node/[nid]/edit that is not showing the widget, watch for js errors.
Attachment | Size |
---|---|
Display settings.png | 27.83 KB |
Field settings.png | 15.21 KB |
New widget.png | 19.64 KB |
working widget.png | 585.53 KB |