Skip to content

CUDA-accelerated GIS and spatiotemporal algorithms

License

Notifications You must be signed in to change notification settings

zhangjianting/cuspatial

 
 

Repository files navigation

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

Build Status

NOTE: cuSpatial depends on cuDF and RMM from RAPIDS.

Implemented operations in 0.11:

With both C++ and Python APIs and tests

  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

Implemented operations ready for tests

Quadtree indexing and Point-in-Polygon test based spatial join
C++ APIs and tests only; Python APIs and tests to be developed

  1. construct quadtree on large-scale point data
  2. compute polygon bounding boxes using parallel primitives
  3. quadtree-polygon pairing for spatial filtering
  4. spatial refinement to pair up points and polygons based on point-in-polygon test

Future support is planned for the following operations.

  1. Point-to-polyline nearest neighbor distance
  2. Grid-based indexing for points and polygons
  3. R-Tree-based indexing for Polygons/Polylines

Install from Conda

To install via conda [(0.12 and prior)]:(https://anaconda.org/rapidsai/cuspatial)

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 https://github.com/zhangjianting/cuspatial/ $CUSPATIAL_HOME
  1. Compile and install Similar to cuDF, simplely run 'build.sh' diectly under $CUSPATIAL_HOME
    Note that a "build" dir is created automatically under $CUSPATIAL_HOME/cpp

  2. Run C++/Python test code

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

$CUSPATIAL_HOME/cpp/build/gtests/HAUSDORFF_TEST
$CUSPATIAL_HOME/cpp/build/gtests/POINT_IN_POLYGON_TEST
python python/cuspatial/cuspatial/tests/test_hausdorff_distance.py
python python/cuspatial/cuspatial/tests/test_pip.py

Some other tests involve I/O from data files under $CUSPATIAL_HOME/test_fixtures. For example, $CUSPATIAL_HOME/cpp/build/gtests/SHAPEFILE_POLYGON_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

Run tests on NYC taxi trip data with multiple polygon datasets

URLs to polygon datasets are embedded in code.
Point data can be downloaded here
Moidify 2009.cat used in the test code to include data of any months
Or, create your own .cat file (one line per month data file) and use it in the test code.

To run the test:

cd $CUSPATIAL_HOME/cpp/build/
./gtest/SPATIAL_JOIN_NYCTAXIE_TEST

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.

About

CUDA-accelerated GIS and spatiotemporal algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cuda 61.4%
  • Python 21.1%
  • C++ 11.7%
  • CMake 3.8%
  • Shell 2.0%