Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Python wrapper for DGGRID

Project description

Build Status Documentation Status Build status PyPI version


A wrapper for DGGRID in python. Currently based on last DGGRID from Kevin Sahr.



  • 0.0.16

  • <input type="checkbox" checked="" disabled="" />

    DGGRID is updated to version 7.3

  • <input type="checkbox" checked="" disabled="" />

    Some bugs fixed

  • <input type="checkbox" checked="" disabled="" />

    Richard Barnes's dglib class is decomposed in order to upgrade DGGRID

  • 0.0.15

  • <input type="checkbox" checked="" disabled="" />

    Not released

  • <input type="checkbox" checked="" disabled="" />

    DGGRID is updated to version 7.1 (

  • <input type="checkbox" checked="" disabled="" />

    Removed Boost Geometry suppert to use GDAL support since main DGGRID library started to use GDAL library

  • <input type="checkbox" checked="" disabled="" />

    Added VCPKG support for windows version

  • <input type="checkbox" checked="" disabled="" />

    Cleaned up setup process

  • 0.0.14

  • <input type="checkbox" checked="" disabled="" />

    Added different system build environments


Note: The main DGGRID library needs 'GDAL' library to compile. so make sure you have installed GDAL C++ library before installing. To installing GDAL on linux is pretty straightforward. For windows you can use vcpkg to compile and install it. The process of installing and using vcpkg on windows can be found on its github (

  • Install GDAL on linux
sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev
  • Install GDAL on windows


Windows 10, 8.1, 7, Linux, or MacOS
Visual Studio 2015 Update 3 or newer (on Windows)

To get started:

> git clone
> cd vcpkg

PS> .\bootstrap-vcpkg.bat


PS> .\vcpkg integrate install

Install GDAL packages with

PS> .\vcpkg install gdal:x64-windows shapelib::x64-windows

NOTE: The GDAL version must match with your python compiled version. So if you have a x86 python use vcpkg install gdal:x86-windows, othewise use vcpkg install gdal:x64-windows

Then simply use pip to install this library

pip install pydggrid

Build From source

On Unix (Linux, OS X)

  • install GDAL, shapelib
  • clone this repository
  • pip install ./pydggrid

or you can easily call

  • python install

On Windows

  • You need Build Tools for Visual Studio to be able to compile it from source. so Install it from this link
  • install GDAL, shapelib
  • clone this repository
  • pip install ./pydggrid

or you can easily call

  • python install

How To Use In order to use this library use following example. (more updates are comming on documentations section)

#import librarry
import pydggrid as m
#Construct a dggs object
#getting Q2di index for a (lat,long) point
#[4, 71, 211]
#getting Q2dd index for a (lat,long) point
#[4.0, -0.1427860170187444, 0.7514696738643607]
#getting ProjTri index for a (lat,long) point
#[3.0, 0.5793988192307712, 0.4993911549756102]`


  • [ ]Supporting All DGGRID functions
  • [ ]Adding GDAL export Geometry Support
  • [ ]Support GridGeneration using DGGRID

Building the documentation

Documentation for the project is generated using Sphinx. Sphinx has the ability to automatically inspect the signatures and documentation strings in the extension module to generate beautiful documentation in a variety formats. The following command generates HTML-based reference documentation; for other formats please refer to the Sphinx manual:

  • cd pydggrid/docs
  • make html

Run tests

To run all tests for the package call folowing command in package directory

python3 -m unittest discover


By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

Based on Kevin Sahr's DGGRID library (

Developed on top of the R package which was developed by Richard Barnes (

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pydggrid, version 0.0.16
Filename, size File type Python version Upload date Hashes
Filename, size pydggrid-0.0.16-cp36-cp36m-win32.whl (9.7 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pydggrid-0.0.16-cp37-cp37m-win32.whl (9.7 MB) File type Wheel Python version cp37 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page