API Reference
Body

Body

Various types and structs referenced in the endpoints section that are part of the http request body.

Data Structs, Type Aliases, and Enums

pub type PointArray<T = f64> = [T; 2]; // [lat, lon]
pub type SingleVec<T = f64> = Vec<PointArray<T>>;
pub type MultiVec<T = f64> = Vec<Vec<PointArray<T>>>;
 
pub struct PointStruct<T: Float = f64> {
    pub lat: T,
    pub lon: T,
}
pub type SingleStruct<T = f64> = Vec<PointStruct<T>>;
pub type MultiStruct<T = f64> = Vec<Vec<PointStruct<T>>>;
 
pub struct BoundsArg {
    pub min_lat: f64,
    pub min_lon: f64,
    pub max_lat: f64,
    pub max_lon: f64,
}
 
// Accepted Area Inputs and Outputs:
pub enum GeoFormats {
    Bounds(BoundsArg),
    Text(String),
    // can be either:
      // lat,lon\nlat,lon
      // or lat lon,lat lon
    SingleArray(SingleVec),
    MultiArray(MultiVec),
    SingleStruct(SingleStruct),
    MultiStruct(MultiStruct),
    Feature(Feature),
    FeatureVec(Vec<Feature>),
    FeatureCollection(FeatureCollection),
    Poracle(Poracle),
}
 
// Return Types:
pub enum ReturnType {
  AltText,            // lat lon,lat lon
  Text,               // lat,lon\nlat,lon
  SingleArray,        // [[lat, lon]]
  MultiArray,         // [[[lat, lon]]]
  SingleStruct,       // [{lat: lat, lon: lon}]
  MultiStruct,        // [[{lat: lat, lon: lon}]]
  Feature,            // GeoJSON Feature ([lon, lat])
  FeatureVec,         // [Feature]
  FeatureCollection,  // GeoJSON FeatureCollection
  Poracle             // Poracle Geo Format ([lat, lon])
}
 
// Sort by types, only valid when clustering in non-fast mode:
pub enum SortBy {
    GeoHash,      // default, sorts by geohash, fastest alternative to okay routing
    ClusterCount, // sorts by the number of data points in each cluster
    Random,       // randomizes the order of the clusters
}
 
// Data Input Types:
pub enum DataPointsArg {
    Array(SingleVec),
    Struct(SingleStruct),
    Feature(Feature),
    FeatureCollection(FeatureCollection),
}
 
// Spawnpoint Args:
pub enum SpawnpointTth {
  All,      // All spawnpoints
  Known,    // Only spawnpoints with known TTH
  Unknown,  // Only spawnpoints with unknown TTH
}

API Args

pub struct Args {
    /// The area input to be used for data point collection.
    ///
    /// Accepts an optional [GeoFormats]
    ///
    /// Default: `None`
    pub area: Option<GeoFormats>,
    /// Only returns stats from the API
    ///
    /// Default: `false`
    pub benchmark_mode: Option<bool>,
    /// Bootstrap mode selection
    ///
    /// Accepts [BootStrapMode]
    ///
    /// Default: `0`
    pub calculation_mode: Option<CalculationMode>,
    /// Data points to cluster or reroute.
    /// Overrides any inputted area.
    ///
    /// Accepts [DataPointsArg]
    pub data_points: Option<DataPointsArg>,
    /// Number of devices to use in VRP routing
    ///
    /// Default: `1`
    ///
    /// Deprecated
    pub devices: Option<usize>,
    /// Whether to use the fast or slow clustering algorithm
    ///
    /// Default: `true`
    pub fast: Option<bool>,
    /// Number of times to run through a clustering algorithm
    ///
    /// Default: `0`
    ///
    /// Deprecated
    pub generations: Option<usize>,
    /// Geometry type used during conversions
    ///
    /// Currently unstable and will likely change how it's used
    pub geometry_type: Option<String>,
    /// Name used for geofence lookup.
    /// Tries the Kōji database first.
    /// Then checks the scanner database if it doesn't find one.
    pub instance: Option<String>,
    /// Last seen date timestamp for filtering data points from the database.
    ///
    /// Default: `0`
    pub last_seen: Option<u32>,
    /// Internally used, unstable
    pub mode: Option<String>,
    /// Minimum number of points to use in the clustering algorithms
    ///
    /// Default: `1`
    pub min_points: Option<usize>,
    /// The ID or name of the parent property, this will search the database for any properties that have their `parent` property set to this value.
    ///
    /// Default: `None`
    pub parent: Option<UnknownId>,
    /// Radius of the circle to be used in clustering/routing,
    /// in meters
    ///
    /// Default: `70`
    pub radius: Option<Precision>,
    /// The return type for the data
    ///
    /// Accepts [ReturnTypeArg]
    ///
    /// Default: `SingleVec`
    pub return_type: Option<String>,
    /// Manual chunking to split TSP routing.
    ///
    /// Default: 1
    ///
    /// Deprecated
    pub route_chunk_size: Option<usize>,
    /// Geohash precision level for splitting up routing into multiple threads
    ///
    /// Recommend using 4 for Gyms, 5 for Pokestops, and 6 for Spawnpoints
    ///
    /// Default: `1`
    pub route_split_level: Option<usize>,
    /// Amount of time for the TSP solver to run
    ///
    /// Default: `0` (auto)
    ///
    /// Deprecated
    pub routing_time: Option<i64>,
    /// S2 Level to use for calculation mode
    ///
    /// Accepts 10-20
    ///
    /// Default: `15`
    pub s2_level: Option<u8>,
    /// S2 cell size selection, how many S2 cells to use in a square grid
    ///
    /// Accepts [BootStrapMode]
    ///
    /// Default: `9`
    pub s2_size: Option<u8>,
    /// Saves the calculated route to the Kōji database
    ///
    /// Default: `false`
    pub save_to_db: Option<bool>,
    /// Saves the calculated route to the scanner database
    ///
    /// Default: `false`
    pub save_to_scanner: Option<bool>,
    /// Simplifies Polygons and MultiPolygons when converting them
    ///
    /// Default: `false`
    pub simplify: Option<bool>,
    /// Sorts *clustering* results, not routing results.
    /// This is just intended to do some simple clustering adjustments,
    /// when you don't need a full TSP solver
    ///
    /// Accepts [SortBy] - case sensitive
    ///
    /// Default: `GeoHash`
    pub sort_by: Option<SortBy>,
    /// Filter spawnpoints by confirmed, unconfirmed, or all
    ///
    /// Accepts [SpawnpointTth] - case sensitive
    ///
    /// Default: `All`
    pub tth: Option<SpawnpointTth>,
}

Return Structs

// Standard Response Struct (what you will receive!)
  pub struct Response {
      pub message: String,
      pub status: String,
      pub status_code: u16,
      pub data: GeoFormats,
      pub stats: Stats,
  }
 
// Benchmark/Stats
  pub struct Stats {
      pub best_clusters: SingleVec,
      pub best_cluster_point_count: usize,
      pub cluster_time: f32,
      pub total_points: usize,
      pub points_covered: usize,
      pub total_clusters: usize,
      pub total_distance: f64,
      pub longest_distance: f64,
  }