Class Veery

countLocationHistory(int format, Long since, Long unti)

Count Historical data of Geolocations observed during a given period of time.

The format parameter defines the type of data to count

Parameters

Param name Type Possible Values / Usage
format int Veery.HISTORY_RAW will return the amount of geolocation measured
HISTORY_ROUTEMATCH will return the amount of trips computed
since Long Represent the time of the beginning of the historical period required. Format is the EPOCH in millis as returned by Calendar.getTimeInMillis()
null could be used for "since the beginning"
until Long Represent the time of the end of the historical period required. Format is the EPOCH in millis as returned by Calendar.getTimeInMillis()
null could be used for "until the end"

Returns

int

  • HISTORY_RAW will return the amount of geolocation measured
  • HISTORY_ROUTEMATCH will return the amount of trips computed

Usage / Example

The following example prints the geolocation history to a mMap Google Maps object

Calendar calendar = Calendar.getInstance(); // now
Long until = calendar.getTimeInMillis();
calendar.add(Calendar.HOUR, -3); // three hours ago
Long since = calendar.getTimeInMillis();

if (countLocationHistory(Veery.HISTORY_RAW,  since,  until) > 0){
    Veery.Locations locations =  veery.getLocationHistory(Veery.HISTORY_RAW, since, until);

    JSONObject geoJsonData1 = locations.toGeoJSON(veery.GEOJSON_MULTIPOINT);

    if (geoJsonData1 != null) {
        GeoJsonLayer layer = new GeoJsonLayer(mMap, geoJsonData1); // see Google Maps API
        setGeoJsonStyle(layer);
        layer.addLayerToMap();
        LatLngBounds latLngBounds = Veery.getBoundingBox(layer);
        if (latLngBounds != null && bMapReady)
            mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds,100));
    }
}

Info

GeoJsonLayer classes are available on Google Maps API

User interaction

none

See also

getLocationHistory

Get the historical geolocation data for the mentioned period.

countLocationHistory

Count Historical data of Geolocations observed during a given period of time.

requestRouteMatch

Request for a callback event when a new trip is routematched by the Veery Backend.

Locations.toArray

Return an array of Location object.

Locations.toGeoJSON

Return a GeoJSON containing the set of locations (Point or MultiLineString).

Locations.toGeoJSONArray

Return an array of GeoJSON.

Locations.getBoundingBox

Get the bounding box which envelopes all locations in the set.

RouteMatch.onRouteMatch

Callback triggered every time a trip is computed by the Veery backend.