September 2015
  • Drupal
  • GIS and Web Gis 2.0

The Leaflet Map of the latest Web Visitors of your site, in Drupal.

The use of IP Geolocation Views module for access geocoding.

Visitors Map

 

I have always liked to work with maps, and  extract value and meanings from various types of information using my preferred javascript mapping libraries: Google Maps Api and Leaflet Js.

By working with Drupal you have the best chance of integrating the CMS functionalities and its different content types with these mapping libraries. 

Basically, it would be possible to integrate mapping capacity simply by using the techniques and functions of Drupal JavaScript-injection (eg: drupal_add_js ()).

But Drupal, through its community, has several specific modules to supplement the data model with “Geocoding" capabilities (Address Field, Geofield, GeoPHP, Geocoder) and advanced Mapping and Map Rendering, usually through improved integration with the Views module.

 

At present the module that I prefer for my digital cartography applications in Drupal is IP Geolocation Views, developed by Rick de Boer (@RdeBoer), founder of Flink (an Australian Drupal web agency, located in Melbourne).

It is characterized by a great number of features, high configurability, and a strong integration with the Leaflet and Leaflet Markecluster modules, and the other most used Drupal mapping modules themselves.

In particular (unique among the others) it is characterized by its ability to locate users' visits,  from the acquired / geocoded IP addresses and HTML5 Geolocation functions of the specific hardware used (desktop, tablet, phone ...).

For IP Geocoding, the module integrates with modules Smart IP (or Geo IP API), and implements internal functions of "Reverse Geocoding" (definition of the address) by the acquired coordinates.

Based on these features you have the ability to produce a Visitors Map of the site, using the data acquired (in the access log) from the Statistics module (present in the Drupal core) and being able to retrieve the location of visitors even before the IP Geolocation Views module installation, since the launch date of the site.

 

A Live example of this is available from the following link, that shows an experimental Leaflet map of the most recent visitors of my website: www.italomairo.com.

 

The map shows the location of the visits made by non-administrators, grouped by IP address, hostname, extended address (Street City, Country), date of the last visit, and total pages visited. It is possible to dynamically change the amount of time (from "Now") for which to request the results.

 

Note: Through the functions of IP address "reverse lookup" and a bit of custom Drupal code, you can make lists of hostnames on which to filter the results of the map view, and to refine the map so as to exclude from the results the visits allegedly made by Web crawlers and spiders from the major search engines (google, yahoo, baidu, etc.).

 

  • Drupal
  • Gis & Cartography
  • Leaflet