Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
102 lines (74 sloc) 2.48 KB

[![Build Status] (] (

PostgreSQL extension to translate PostGIS geometries using the FINELTRA algorithm

Development was funded by Canton Solothurn (Switzerland).

Code is released as free software under the terms of the [GPL license] (COPYING), version 3 or later.


Fineltra is a PostgreSQL extension, compatible with version 9.1 and later.

The code depends on the liblwgeom library shipped with PostGIS. The library needs to be linked statically to avoid clashes with different versions of it included in the PostGIS module itself, which is dlopened by the PostgreSQL backend.

Once statically linked to liblwgeom (2.2.0+) the code is also compatible with older PostGIS version (tested with 1.5 upward).


Building and installing should be as simple as:



  sudo make install


Only post-install checks are supported at the moment. Run:

  make installcheck


Make sure to have the extension loaded in the database:


The extension provides a ST_Fineltra function that takes a PostGIS Geometry object in EWKB form, the identifier of a table containing reference triangles and the name of the columns containing the source and the target triangles. It returns a PostGIS Geometry in EWKB form representing the input geometry translated using the appropriate triangle from the reference set.

Example usage:

  SELECT ST_Fineltra(

The reference triangle columns need be of type POLYGON where each polygon has exactly 4 vertices. Order of the vertices in the source and the target column polygons must match.

The SRID of the source triangles must match the SRID of the input geometry. The output geometry will have the SRID of the target triangles.

It is highly recommended to create a GiST index on the source triangle column as it will be queried for each call to the ST_Fineltra function. Example of creating such an index:

CREATE INDEX ON chenyx06_triangles USING GiST (geom_lv03);