Tutorial : configure the Geocode Factory profile plugin (google map API v3) |
IntroductionThis plugin allows you to add a map into the user profile, and to geocode based on the profile address. There are 2 versions of this plugin depending on the profile manager you use:
For each profile manager there are 2 versions of the plugin, a new one, described in this document, that uses Geocode Factory map (google maps api v3) and, an old version that works with a standalone map (google maps api v2). You will find a tutorial for the old plugin with google maps api v2 release here. The new version also offers an option to see a stand alone map, but a static map (image map), can be an advantage in page loading's performance. This tutorial is both for Community Builder and Jomsocial, the plugins have similar features and configurations, and where there is a difference we will indicate it with a "CB" or a "JS". You find both plugin versions in the Geocode Factory package you have already unzipped to install the component. InstallationCB : install the plugin trough the Community builder plugin interface. JS : install the plugin trought the joomla installer. ConfigurationOnce the installation is done, you will need to publish the plugin just like any Joomla! plugin. You can open the plugin configuration and edit the settings. You will find more info about publishing the plugin in the CB or JS documentation. Field assignmentsFirst we need to map the fields to link the profile location fields with the plugin. For example, if we have a field named 'country' in the CB/JS component, we need to write this in the plugin field : 'country field name'. Because the plugin supports 3 addresses per profile (like home/work/vacancy) there are 3 field assignment areas. In the following example we use 2 addresses, primary and secondary. For both we have used the same country field, and different cities field.
CB : Custom CB fields usually start with cb_ ... as cb_office_zipcode JS : Custom Jomsocial fields usually start with FIELD_ ... as FIELD_OFFICE_ZIPCODE Coordinates fieldsCB : the coordinates fields are always created by the plugin, and are named 'cb_plug_lat', 'cb_plug_lng', 'cb_plug_lat2', ... and all field are created even you use only one address per profile. JS : since version 2.0, Jomsocial use internal coordinates fields. You can use them by selecting the 'Use Jomsocial internal fields', this is used for the primary address only. If you use the secondary and tertiary addresses, you need to create the corresponding custom fields in JS (FIELD_LATITUDE_2, ...) and enter the field names appropriately. Here is an example :
Interface options
Note : The plugin must get it's map configuration information (map type, map size, ...) from a Geocode Factory map so for either a dynamic or static map, you must still specify a Geocode Factory map ID. Geocode optionsThe geocoding feature gets the profile coordinates based on the field assignment. Settings options are :
Note : Jomsocial does this automatically (see JS component settings) since version 2, but can be useful if you use custom coordinate fields. Community Builder only features
Example of resultsThese are some examples of the plugin with detailled explanation. This view shows the current user's CB profile. This user has 2 addresses. The zoom and centering is set to center the map over both markers :
CB : Due an incompatibly between CB tabs and Google maps api v3, the map must be placed in the first tab. The map needs to be visible on the page when loading. You can also place the map in a non tab position like in myjoom CB profiles page :
You must do the same thing in Jomsocial, with connections lines (because on this map we have not only the profiles markerset ...) :
This last screenshot, shows the markers linked by a line (markerset option), feature from the markerset :
Static map in users profile :
If you place the map in a non visible tab you need to reload it (due the incompatibility we have spoken before), then use the Reset map button, only available in the edit profile mode.
|
| Last Updated on Sunday, 04 March 2012 08:38 |










