Chapter 4. IP Mapping Modules

There are two supplied modules used with IP Mapping and these are described in this section. These modules are based upon the work originally published by www.comlantis.com (now defunct) written by Serdar Gokkus updated for the recent changes in the Google Maps v3 API, and Joomla 3.x..

IP Mapping Mapper Module

This module shows to the user the IP address location in a map using the Google Maps API V3 which is free for not commercial use, if you have any doubts about the use for your site please read the Google maps APIs’ licence at http://code.google.com/apis/maps/terms.html The users location is based on the http://www.ipinfodb.com/ip_location_api.php free script. Please read the Terms and conditions on their site.

Figure 4.1. Mapping Module Details

Mapping Module details image.

The module may be placed anywhere in the positions available in the site template. This may also be within an article as described in the section Inserting a module inside an article .

Figure 4.2. Mapping Module Assignment

Mapping Module Assignment image.

[Note]Note

The module assignment screen will look slightly different to the above dependant upon the specific menus available upon the specific site.

General Options

Figure 4.3. Mapping Module General Parameters

Mapping Module General Parameters image.

The module general parameter are used to specify the choice of IP addresses to be placed upon the map which will be generated by the Mapper module. This is a multiple choice option. It is not usual to display the ‘visitors’ reason alongside the other reasons, but this is possible if desired.

The frequency of map update (duration in milliseconds) is most useful when visitor information (real-time) is required. The default value of 5000 is very low (as this is specified in milliseconds, meaning a map update every 5 seconds!) The choice of value should be driven by the requirement as to how often the map should be updated. A very high value is common when the other ‘reason’ codes are being mapped. Values in the hours are common.

[Note]Note

There is a maximum value that can be specified of 2147483647, which if exceeded will be reset to the maximum. Similarly the minimum frequency update that will be accepted is 500, which equates to an update every half a second.

The start and end date are used when the reason codes other than ‘visitor’ are used. For example it may be desirable to map Spam attempts on a monthly basic and have different modules (one for each month). This is common if the module display is used in articles.

If the parameter for the to display the last 'n' days worth of data has a value greater than zero then the specified dates are silently ignored. The value is a numeric value greater than zero (0). A value of zero causes the specified date range to be used.

Release 1.3.1 changed the behaviour of the mapper module slightly. Prior to this release version once the map was displayed upon the screen it would be updated as specified by the update interval with new entries retrieved from the database. It did not however update the 'clustering'. The net result was that IF the map display was left open for longer periods of time then the map display would get cluttered with all the new location icons. The amount of time required before this was noticeable is dependant upon how many 'new' location entries are being added in the given time period. One other factor was that if entries were removed from the database, as would occur if the visitor agent was configured to remove entries older than the specified time, these would NOT be removed from the map display, or from the tabular display if it was configured to be displayed.

In release 1.3.1 this has changed and there is a new parameter to specify the map refresh interval. This is a multiple of the map update interval and is expressed in minutes. Now when new (visitor) entries are updated, the clustering of the map icons is automatically updated. The 'new' optional map refresh interval will clean out all the map markers (and cluster markers) and retrieve all the required entries from the database and add them to the 'now' empty map display. This is only refreshing the map, NOT the whole web page. This will happen asynchronously so there may be small periods of time, dependant upon the load upon the users browsing machine, while the map is updated. The default is to NOT refresh the map display.

If multiple map displays are present upon the web page, each map acts totally independently, with each having separate update and refresh intervals.

Google Closure Compiler

Since its initial release the component has made use of the Google Closure Compiler to reduce the size of the Javascript included in the web page used to display the map. The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyses it, removes dead code and rewrites and minimises what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.

The Closure Compiler has three possible three levels of compilation, which range from simple removal of whitespace and comments to aggressive code transformations.

WHITESPACE_ONLY

The WHITESPACE_ONLY compilation level removes comments from your code and also removes line breaks, unnecessary spaces, extraneous punctuation (such as parentheses and semicolons), and other whitespace. The output JavaScript is functionally identical to the source JavaScript.

This compilation level provides the least compression of the three levels.

SIMPLE_OPTIMIZATIONS

The SIMPLE_OPTIMIZATIONS compilation level performs the same whitespace and comment removal as WHITESPACE_ONLY, but it also performs optimisations within expressions and functions, including renaming local variables and function parameters to shorter names. Renaming variables to shorter names makes code significantly smaller. Because the SIMPLE_OPTIMIZATIONS level renames only symbols that are local to functions, it does not interfere with the interaction between the compiled JavaScript and other JavaScript.

Compilation with SIMPLE_OPTIMIZATIONS always preserves the functionality of syntactically valid JavaScript, provided that the code does not access local variables using string names (by using eval() statements, for example).

SIMPLE_OPTIMIZATIONS is the default compilation level.

ADVANCED_OPTIMIZATIONS

The ADVANCED_OPTIMIZATIONS compilation level performs the same transformations as SIMPLE_OPTIMIZATIONS, but adds a variety of more aggressive global transformations to achieve the highest compression of all three levels. The ADVANCED_OPTIMIZATIONS level compresses JavaScript well beyond what is possible with other tools.

The IP Mapping component makes use of the 'SIMPLE_OPTIMIZATIONS' option. Tests have revealed that using the ADVANCED_OPTIMIZATIONS may not produce code that runs efficiently.

Google Map Options

Figure 4.4. Mapping Module Google Map Parameters.

Mapping Module Google Map Parameters image.

These options reflect very closely the available settings that can be made with the Google Maps API. A lot of the following information is that as shown on the Google web site but enclosed below for the convenience of our users.

Table 4.1. Google Map Types

Constant

Description

HYBRID

This map type displays a transparent layer of major streets on satellite images.

ROADMAP

This map type displays a normal street map.

SATELLITE

This map type displays satellite images.

TERRAIN

This map type displays maps with physical features such as terrain and vegetation.


[Note]Note

Normally, one just uses either “ROADMAP” or “HYBRID“, as there are not as many use cases for “TERRAIN” and “SATELLITE“ types.

Cluster old markers: Instruction to group markers in a cluster.

Position Marker: It is possible to change the marker used on the map, Choose from one of the available types as illustrated below.

[Note]Note

Other markers may be available.

Default  Star End MarkerZ MarkerA

Arrow Black Blue Brown Gray

Green Orange Purple Red White Yellow

Map width value type: Specifies whether the values entered for the map width are in pixels or percent.

[Note]Note

In some circumstances the entered values for map width may be ignored, as in the use of the module in a side bar.

Map width: Specifies the width of the desired Google map

Map height: Specifies the height of the desired Google map

Display Maptype Control: Control switch between map types

The MapType control may be shown in one of the following style options:

  • HORIZONTAL_BAR displays the array of controls as buttons in a horizontal bar as is shown on Google Maps.

Figure 4.5. Maptype Control Format - Horizontal

Maptype Control Format - Horizontal image.

  • DROPDOWN_MENU displays a single button control allowing you to select the map type via a dropdown menu.

Figure 4.6. Maptype Control Format - Drop Down

Maptype Control Format - Drop Down

  • DEFAULT displays the "default" behaviour, which depends on screen size and may change in future versions of the API

Figure 4.7. Maptype Control Format - Default

Maptype Control Format - Default

Maptype Control Position:The position of thecontrol upon the map. The possible values are explained in more details below under ‘Zoom Control Position’.

Display Pan Control: Instructs whether the Pan control should be shown on the map.

Figure 4.8. Pan Control

Pan Control image.

Display Zoom Toolbar: Instructs whether to display the zoom controls.

Zoom Control Style: The available style settings are as shown in the table below.

Table 4.2. Google Map Zoom Control styles.

Constant

Description

DEFAULT

The default zoom control. The control which DEFAULT maps to will vary according to map size and other factors. It may change in future versions of the API. Currently SMALL

LARGE

The larger control, with the zoom slider in addition to +/- buttons.

SMALL

A small control with buttons to zoom in and out.


Figure 4.9. Zoom Control - Small

Zoom Control - Small image.

Figure 4.10. Zoom Control - Large

Zoom Control - Large image.

Zoom Control Position: Specifies the position of zoom control on the Google map.

Identifiers used to specify the placement of controls on the map. Controls are positioned relative to other controls in the same layout position. Controls that are added first are positioned closer to the edge of the map.

TL- TC -TR
LT RT
   
LC RC
   
LB RB
BL- BC -BR

Elements in the top or bottom row flow towards the middle. Elements positioned at the left or right sides flow downwards.

Table 4.3. Google Map positions

Constant

Description

BOTTOM_CENTER

Elements are positioned in the centre of the bottom row.

BOTTOM_LEFT

Elements are positioned in the bottom left and flow towards the middle. Elements are positioned to the right of the Google logo.

BOTTOM_RIGHT

Elements are positioned in the bottom right and flow towards the middle. Elements are positioned to the left of the copyrights.

LEFT_BOTTOM

Elements are positioned on the left, above bottom-left elements, and flow upwards.

LEFT_CENTER

Elements are positioned in the centre of the left side.

LEFT_TOP

Elements are positioned on the left, below top-left elements, and flow downwards.

RIGHT_BOTTOM

Elements are positioned on the right, above bottom-right elements, and flow upwards.

RIGHT_CENTER

Elements are positioned in the centre of the right side.

RIGHT_TOP

Elements are positioned on the right, below top-right elements, and flow downwards.

TOP_CENTER

Elements are positioned in the centre of the top row.

TOP_LEFT

Elements are positioned in the top left and flow towards the middle.

TOP_RIGHT

Elements are positioned in the top right and flow towards the middle.


Display Scale: Controls the display of the map scale as shown in the figure below.

Figure 4.11. Display Scale

Display Scale image.

 

Zoom Strategy:

Auto zoom to show all markers: In this zoom strategy all markers will be showed automatically. Map will decide to zoom out or zoom in itself.

Centre to the last marker and use defined zoom value: The last marker will be centred in the map. In this modus a zoom factor will be used which is configured with Zoom Value.

Zoom Value: Zoom value of map. Used only if "Centre to the last marker and use defined zoom value" is selected!

Table Options

Figure 4.12. Mapping Module Table Options

Mapping Module Table Options image.

These options are used to display a table below the map showing the data used to generate the map itself. Settings include specifying how many records should be displayed in the table.

Release 1.2.3 has added additional options to control which table columns are displayed. This is particularly useful where the module is located in a side panel and the scroll bars are considered distracting. The IP display is only possible when the country column is displayed.

If all of the columns are marked as being not required (hidden) then the table display will NOT be present even if it is requested.

Advanced Options

Figure 4.13. Mapping Module Advanced Options

Mapping Module Advanced Options image.

These options are used to control the module style and cache settings.

Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries