Home
Tutorial : configure the Geocode Factory profile plugin (google map API v3)

Tutorial : configure the Geocode Factory profile plugin (google map API v3)

Introduction

This 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.

Installation

CB : install the plugin trough the Community builder plugin interface.

JS : install the plugin trought the joomla installer.

Configuration

Once 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 assignments

First 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.

profile_plugin_001

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 fields

CB : 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 :

profile_plugin_002

Interface options

profile_plugin_003

  • Number of addresses : Define here how many addresses the plugin will use and geocode for this application.
  • Id of the Geocode Factory map to use : Here you need to set the id of the Geocode Factory map to use. First, create a simple map in the component (don't use clustering, center on broswer or other advanced features like radius, ...). Second, create a markerset that include the whole community with no filters. This is very important to be sure that at least the current profile owner is visible. See this article if needed to learn how to create Geocode Factory maps and markersets.
  • Static map (profile view) : This can be used to draw a static, image-based map instead the regular Geocode factory map. This will increase the loading performances as there is no javascript, only an image.
  • Zoom for static map : for the Geocode Factory's map, the zoom is calculated automatically to be centered on the current profile marker. If you are using multiple addresses, the zoom is calculated to see each profiles marker. For the static map, we cannot calculate the zoom factor to include the 3 markers. So you will need to enter the zoom factor manually.

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 options

The geocoding feature gets the profile coordinates based on the field assignment.

Settings options are :

  • Auto geocode during registration : Run the geocode when user just create a profile.
  • Auto geocode during edit : Run the geocode when user just saved an existing profile.

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

  • Show map tab during registration : Allow user to pick a point on a map during the registration. You need to publish the corresponding (primary, secondary, ...) coordinates fields in registration form (see CB custom fields manager).
  • Auto geocode before profile edit : Run the geocode before user edits an existing profile.
  • Add geocode button : add a geocode button that will place the marker on the map dynamically based on the entered address. The user can then drag the marker to get a more precise location.

profile_plugin_005

  • Text for the no fetch checkbox : Text displayed in the 'No fetch checkbox'. This option is important if the user take more than 1 hour to place the marker in a custom position and you have set the 'geocode at edit' option. If this option is not set under those conditions than the custom position will be overwritten by the automatically geocoded position. If the user checks this box, the auto-geocode function is not executed.
  • Checked by default : define the default state, or hide this option.

Example of results

These 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 :

profile_plugin_004

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 :

profile_plugin_006

You must do the same thing in Jomsocial, with connections lines (because on this map we have not only the profiles markerset ...) :

profile_plugin_007

This last screenshot, shows the markers linked by a line (markerset option), feature from the markerset :

profile_plugin_008

Static map in users profile :

profile_plugin_009

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.

profile_plugin_010

Last Updated on Sunday, 04 March 2012 08:38