About Leaflet Map Marker
Field that stores an address with latitude and longitude coordinates and has built-in geocoding capability with Leaflet Maps API.
|Category 1||Field Types|
Fieldtype modules that represent a data type used by fields.
|Category 2||Input Fields|
Inputfield modules that provide a UI input widget in the ProcessWire admin.
Should be safe for use in production environments. *
|Compatibility||2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0|
|Date Added||March 5, 2016|
|Last Updated||December 6, 2018|
Leaflet version of the FieldtypeMapMarker module.
This module's files should be placed in /site/modules/FieldtypeLeafletMapMarker/
How to install or uninstall modules
This is a port of the Map Marker Fieldtype by Ryan Cramer. Instead of Google maps it uses Leaflet maps.
Google maps geocoding is still used for geocoding default lat/lng values under field settings but the geocoding on page editing uses Per Liedmans [leaflet-control-geocoder] (https://github.com/perliedman/leaflet-control-geocoder)
This Fieldtype for ProcessWire holds an address or location name, and automatically geocodes the address to latitude/longitude using leaflet-control-geocoder. The resulting values may be used to populate any kind of map (whether Leaflet Maps or another).
Support for per-marker customisation of visuals and popup content is included.
Copy all of the files for this module into /site/modules/FieldtypeLeafletMapMarker/
In your admin, go to the Modules screen and "check for new modules." Under the 'Fieldtype' section, install the 'Leaflet Map Marker' module (FieldtypeLeadletMapMarker)
Under the 'Inputfield' section, install the 'Leaflet Map Marker' module (InputfieldLeafletMapMarker) if it is not already installed.
Under the 'Markup' section, install the 'Leaflet Map' module (MarkupLeafletMap) and the 'Inline Scripts' module (MarkupAddInlineScript)
In your admin, go to Setup > Fields > Add New Field. Choose LeafletMapMarker as the type. If you are not sure what to name your field, simply "map" is a good one! Once created, configure the settings on the input tab.
Add your new "map" field to one or more templates, as you would any other field.
Create or edit a page using one of the templates you added the "map" field to.
The geocoding also works in reverse. You may drag the map marker wherever you want and it will populate the address field for you. You may also populate the latitude, longitude and zoom fields manually if you like. Unchecking the box between address and latitude disables the geocoder.
If the geocoding does not work, please ensure that your browser is not blocking the execution of any scripts.
In your template files, you can utilize this data for your own Leaflet Maps (or anything else that you might need latitude/longitude for).
Lets assume that your field is called 'map'. Here is how you would access the components of it from the API:
- Admin Helpers
- Core Modules
- Development Tools
- Field Types
- Input Fields
- Language Modules
- Language Packs
- Markup Generation
- Premium Modules
- Process Modules
- Proof of Concept
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.