Skip to content
Switch branches/tags


Failed to load latest commit information.

 cuSpatial - GPU-Accelerated Spatial and Trajectory Data Management and Analytics Library

Build Status

NOTE: cuSpatial depends on cuDF and RMM from RAPIDS.


cuSpatial supports the following operations on spatial and trajectory data:

  1. Spatial window query
  2. Point-in-polygon test
  3. Haversine distance
  4. Hausdorff distance
  5. Deriving trajectories from point location data
  6. Computing distance/speed of trajectories
  7. Computing spatial bounding boxes of trajectories
  8. Quadtree-based indexing for large-scale point data
  9. Quadtree-based point-in-polygon spatial join
  10. Quadtree-based point-to-polyline nearest neighbor distance

Future support is planned for the following operations:

  1. Temporal window query
  2. Temporal point query (year+month+day+hour+minute+second+millisecond)
  3. Grid-based indexing for points and polygons
  4. R-Tree-based indexing for Polygons/Polylines

Install from Conda

To install via conda:

conda install -c conda-forge -c rapidsai-nightly cuspatial

Install from Source

To build and install cuSpatial from source:

Install dependencies

Currently, building cuSpatial requires a source installation of cuDF. Install cuDF by following the instructions

The rest of steps assume the environment variable CUDF_HOME points to the root directory of your clone of the cuDF repo, and that the cudf_dev Anaconda environment created in step 3 is active.

Clone, build and install cuSpatial

  1. export CUSPATIAL_HOME=$(pwd)/cuspatial

  2. clone the cuSpatial repo

    git clone --recurse-submodules $CUSPATIAL_HOME
  3. Compile and install

    Similar to cuDF (version 0.20), simply run diectly under $CUSPATIAL_HOME.

    Note that a "build" dir is created automatically under $CUSPATIAL_HOME/cpp.

  4. Run C++/Python test code

    Some tests using inline data can be run directly, e.g.:

    python python/cuspatial/cuspatial/tests/legacy/
    python python/cuspatial/cuspatial/tests/

    Some other tests involve I/O from data files under $CUSPATIAL_HOME/test_fixtures. For example, $CUSPATIAL_HOME/cpp/build/gtests/SHAPEFILE_READER_TEST requires three pre-generated polygon shapefiles that contain 0, 1 and 2 polygons, respectively. They are available at $CUSPATIAL_HOME/test_fixtures/shapefiles

NOTE: Currently, cuSpatial supports reading point/polyine/polygon data using Structure of Array (SoA) format and a shapefile reader to read polygon data from a shapefile. Alternatively, python users can read any point/polyine/polygon data using existing python packages, e.g., Shapely and Fiona,to generate numpy arrays and feed them to cuSpatial python APIs.