PreEmptive Analytics Workbench User Guide

Geolocation Plugin

The Workbench is configured by default with a Plugin that provides geolocation information as a pivot key for queries. This product includes GeoLite data created by MaxMind, available from www.maxmind.com.

However, due to licensing restrictions, PreEmptive can only distribute MaxMind® geolocation with basic IP lookup as part of the core installation. Premium versions of the MaxMind® IP database may be purchased and used instead of the provided file. The Plugin currently does not support GeoIP2/GeoLite2 databases.

Alternatively, the default geolocation Plugin may be completely replaced with a custom Plugin that implements the following interface:

// The IGeoLocation interface is in the "Common.Constructs" namespace; reference the
// PreEmptive.Analytics.Server.Common.dll for the definition.
//
// Likewise, the GeoLocation class is in the
// "PreEmptive.Components.Messaging.Schema.Internal" namespace; reference the
// PreEmptive.Components.Messaging.Schema.dll for the definition.
public interface IGeoLocation
{
    void SetLocationInformation(string ip, GeoLocation location);
}

An implementation using the GeoLite MaxMind® database and API demonstrates the simplicity of the interface:

public void SetLocationInformation(string ip, GeoLocation location)
{
    // Add City location info
    if (cityLoc != null)
    {
        var cityResult = cityLoc.getLocation(ip);
        if (cityResult != null)
        {
            location.Latitude = Convert.ToDecimal(cityResult.latitude);
            location.Longitude = Convert.ToDecimal(cityResult.longitude);
            location.City = cityResult.city;
            location.Region = cityResult.regionName;
            location.CountryCode = cityResult.countryName;
            location.ZipCode = cityResult.postalCode;
        }
    }
    // Add ISP location info
    if (ispLoc != null)
    {
        var ispResult = ispLoc.getOrg(ip);
        location.ISP = ispResult;
    }
    // Add Domain location info
    if (domainLoc != null)
    {
        var domainResult = domainLoc.getOrg(ip);
        location.Domain = domainResult;
    }
}

Once the implementation has been created, copy the DLL into the Plugins folder (<Installation Folder>\config\Plugins) and copy any associated DLLs in the Dependencies folder.

To avoid unpredictable results, there should be only one geolocation plugin active at a time, so remove the default plugin (by default, located in <Installation Folder>\Plugins\preemptive\Geoloc) before restarting the Workbench services.



Workbench Version 1.2.0. Copyright © 2016 PreEmptive Solutions, LLC