About Map Marker (Google Maps)
This Fieldtype for ProcessWire 2.1+ holds an address or location name, and automatically geocodes the address to latitude/longitude using Google 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.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0|
|Date Added||July 24, 2012|
|Last Updated||September 28, 2016|
This Fieldtype was created to serve as an example of creating a custom Fieldtype and Inputfield that contains multiple pieces of data.
To use, install FieldtypeMapMarker. Then create a new field that uses it. Add that field to a template and edit a page using that template. Enter an address, place or location of any sort into the 'Address' field, for example, Google Maps will geocode any of these:
- 125 E. Court Square, Decatur, GA 30030
- Atlanta, GA
- Disney World
On the front end, you can utilize this data for your own Google Maps (or anything else that you might need latitude/longitude for).
Lets assume that your field is called 'marker'. Here is how you would access the components of it from the API:
This Fieldtype for ProcessWire holds an address or location name, and automatically geocodes the address to latitude/longitude using Google Maps API. The resulting values may be used to populate any kind of map (whether Google Maps or another).
This Fieldtype was created to serve as an example of creating a custom Fieldtype and Inputfield that contains multiple pieces of data. Though the Fieldtype has now gone far beyond that and is relatively full featured. As a result, it may no longer be the simplest example of how to implement a Fieldtype/Inputfield, though it is very effective and useful.
MapMarker also has a corresponding Inputfield and Markup module, named InputfieldMapMarker and MarkupGoogleMap. When you install FieldtypeMapMarker, the Inputfield will also be installed and used for input on the admin side. Installation of MarkupGoogleMap is optional. It provides a simple way to render Google maps with the data managed by FieldtypeMapMarker.
This Fieldtype has a support forum
Copy all of the files for this module into /site/modules/FieldtypeMapMarker/
In your admin, go to the Modules screen and "check for new modules." Click install for the Map Marker Fieldtype.
In your admin, go to Setup > Fields > Add New Field. Choose MapMarker 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.
In your template files, you can utilize this data for your own Google 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.