DistanceFilter¶
Distance filter allows to filter map points points by radius. Map points kept in the database needs to contain latitude and longitude to use this filter.
Configuration for distance filter looks a little bit different than for other build-in filter. Because distance filter is not based on single field it should not contain properties
definition. Instead of that it is needed to specify which model properties contain latitude and longitude in arguments
. Moreover, as properties
is not defined, parameterName
is required. Beside default values in arguments
, distance filter accepts also:
latProperty
(string
) - Name of the property which holds latitudelngProperty
(string
) - name of the property which holds longitudeunit
(ENUM: “mi”, “km”; default “km”) - Unit of the radiusradius
(float/int
; default100
) - Radius to filter in; ifallowClientRadius
is set totrue
, then used as default value.allowClientRadius
(bool
; defaultfalse
) - Set totrue
allow to change the radius from GET parameter.
use SourceBroker\T3api\Filter\DistanceFilter;
/**
* @T3api\ApiFilter(
* DistanceFilter::class,
* arguments={
* "parameterName"="position",
* "latProperty"="gpsLatitude",
* "lngProperty"="gpsLongitude",
* "radius"="100",
* "unit"="km",
* }
* )
*/
class Item extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
}