Skip to content
/ pgh3 Public
forked from dlr-eoc/pgh3

PostgreSQL extension for the H3 hierarchical geospatial indexing system

License

Notifications You must be signed in to change notification settings

nmandery/pgh3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgreSQL extension for the H3 hierarchical geospatial indexing system

This extension integrates with the PostGIS geometry type. Namely Point, Polygon and MultiPolygon geometries are supported.

To see the functions implemented in this extension please refer to the SQL API.

Installation

Compile H3 as a shared library. The source is available on github, there are als o detailed instructions for building H3 available in that repository, but to make H3 work with this extension there are additional build flags required. There are essentialy two ways to compile H3 which allow building the pgh3 extension later.

Compile H3 as a static library. This allows statically linking H3 to the pgh3 extension.

cmake -DCMAKE_C_FLAGS=-fPIC .
make
sudo make install

Or compile H3 as a shared library. This creates a dynamically loaded library which may also be used by other programs. When you update the H3 library, all programms using it will automatically use the new version (PostgreSQL needs to be restarted for that).

cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr .
make
sudo make install

In case you have set up your LD_LIBRARY_PATH for PostgreSQL to also look in /usr/local for libraries, you can ommit the -DCMAKE_INSTALL_PREFIX:PATH=/usr switch.

Compile the pgh3 extension:

make
sudo make install

Run the tests (this is an optional step):

make installcheck

Usage

Before using this extension, it needs to be added to the databases using postgresqls CREATE EXTENSION command:

create extension postgis; -- dependency of pgh3, must be created first
create extension pgh3;

For usage examples see the unittests in the sql/*_test.sql files.

TODO

  • Implement more parts of the H3 API
  • Use the numeric-type for H3 indexes?

Legal an Licensing

This software is licensed under the Apache 2.0 License.

(c) 2018 German Aerospace Center (DLR); German Remote Sensing Data Center; Department: Geo-Risks and Civil Security

UKIS

About

PostgreSQL extension for the H3 hierarchical geospatial indexing system

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 70.6%
  • PLpgSQL 26.1%
  • Makefile 3.3%