Skip to content

GeoBadPointFilter

roosit edited this page Nov 15, 2026 · 1 revision

GeoBadPointFilter

Up | Previous | Next | Русский

Full source with short explanations

Below is the full source of the class in documentation form. The comments inside the block explain the purpose of the parts of the class, but they are not stored in the working file GeoBadPointFilter.java: the production code stays clean and the explanations live in the wiki.

package com.velitask.plugin.official.processing.filters;

import com.velitask.sdk.data.GeoSensorAtom;
import org.abricos.geo.GeoUtils;

/* Bad GPS points: checks of coordinates, the (0, 0) marker and a position jump. */
public final class GeoBadPointFilter extends BadPointFilter<GeoSensorAtom> {

    /* Stable step name in import plans and saved settings. */
    public static final String NAME = "geoBadPoint";

    private static final double MAX_LAT = 90;
    private static final double MAX_LON = 180;
    private static final double METERS_PER_KM = 1000d;

    public GeoBadPointFilter() {
        /* Step version 1; the sensor atom is GeoSensorAtom. */
        super(NAME, 1, GeoSensorAtom.class);
    }

    @Override
    /* For the spike window the latitude (degrees) is taken. */
    protected double value(GeoSensorAtom atom) {
        return atom.lat;
    }

    @Override
    /* The distance between points in kilometres: the jump speed comes out in km/h. */
    protected double delta(GeoSensorAtom from, GeoSensorAtom to) {
        return GeoUtils.distance(from.lat, to.lat, from.lon, to.lon) / METERS_PER_KM;
    }

    @Override
    /* The valid latitude and longitude are set in the code; the min and max parameters are not used. */
    protected boolean outOfRange(GeoSensorAtom atom, GeoSensorAtom previous) {
        return Math.abs(atom.lat) > MAX_LAT || Math.abs(atom.lon) > MAX_LON;
    }

    @Override
    /* The GPS "no data" marker: the coordinates are exactly (0, 0). */
    protected boolean isMarker(GeoSensorAtom atom) {
        return atom.lat == 0 && atom.lon == 0;
    }
}

Purpose

GeoBadPointFilter is the "Bad GPS points" filter for the coordinate sensor (GeoSensorAtom). It rejects points right after satellite acquisition, with invalid or zero coordinates and with a too fast position jump. The general algorithm and the ten parameters are described in BadPointFilter; here is only what the class overrides.

How it works

  • Name and version: geoBadPoint, version 1.
  • delta is the distance between two points GeoUtils.distance(lat1, lat2, lon1, lon2) (metres) divided by 1000: kilometres. So for GPS the "Rate of change limit" is the speed of movement in km/h.
  • outOfRange is |lat| > 90 or |lon| > 180. The limits are hard-coded, the min and max parameters have no effect on GPS (the description of the "Check the limits" parameter says so too).
  • isMarker is lat == 0 && lon == 0: this is how the device marks the absence of a position. The check works when the "Reject the "no data" marker" checkbox is on.
  • value is the latitude in degrees. The base algorithm uses it only for the spike check.

Where it is used. The import plans put the step first in the GPS sensor scenario:

  • FitImportPlan: maxRate = 120, rateResetSec = 30 (a jump faster than 120 km/h is not accepted if no more than 30 s have passed since the last accepted point);
  • GoproImportPlan: settleSec = 8, maxRate = 200, rateResetSec = 30, useMarker = true;
  • DjiImportPlan and DjiSrtImportPlan: useRange = true.

Features and limitations

  • For the spike check (windowSec, deviation, floor) only the latitude in degrees is used; the longitude is not taken into account, and the deviation is measured in degrees, not in metres. No built-in plan turns spikes on for GPS.
  • The latitude of the southern hemisphere is negative, so with floor = 0 such points are not checked for spikes.
  • The "no data" marker is only exactly (0, 0): a point with one zero coordinate is not considered a marker.
  • A jump is counted from the last accepted point; after a GPS failure the points are rejected until the speed of movement from the last accepted one is above the limit or until rateResetSec expires.

Clone this wiki locally