Geo Distance

The perimeter search finds records that lie within a perimeter. To also know how far the data points are from the reference address, the “Geo distance” attribute must additionally be installed. This “virtual attribute” is solely responsible for calculating the corresponding distance during a perimeter search filter and passing it to the records. The default value of the attribute is -1. The output is in km.

Create Attribute

The attribute settings are analogous to those of the filter rule — note the “GET parameter for address” field, whose value must be identical to the “URL parameter” value of the perimeter search filter rule.

  • GET parameter for address: URL parameter of the perimeter search filter rule

  • Data mode: Multi mode (currently only multi mode available)

  • Attributes for latitude and longitude: select the corresponding attributes

  • Country preset: specify whether and if so which country to add to the address for the lookup search (e.g. preset with “Germany”)

  • LookUp services: choose whether Google Maps, OpenStreetMap, or direct coordinates — multiple services can be configured and are processed in sequence

Notes

To sort results in the MM list by geo distance after a perimeter search, select the geo distance attribute in the “Sort by” option along with Ascending (ASC).

If the list should normally be sorted by another attribute like name etc. and only switch to geo distance sorting during a perimeter search, this must be configured accordingly. First, the “Allow override of sorting” checkbox must be activated. This allows the sorting to be dynamically adjusted.

For example, in the MM list template, an automatic redirect can be set up — whether the perimeter search is active can be determined via filterParams with the URL parameter address:

1<?php
2if(\array_key_exists('address', $this->filterParams)) {
3    // redirect sorting: geo distance (with parameter)...
4} else {
5    // redirect sorting: default sorting (without parameter)...
6}

More on sorting parameters here.