<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr">Dear all<br><br>Following the recommendations we received at the PostGIS Dev meeting this August 20, 2021, we were able to include the liblwgeom source files from PostGIS 3.1.3 inside MobilityDB. The build, which works for both PostGIS 2.5.5 and 3.1, is in the branch<br><a href="https://github.com/MobilityDB/MobilityDB/commits/towards-postgis3">https://github.com/MobilityDB/MobilityDB/commits/towards-postgis3</a><br>The tests on Github Actions were done with version 3.1.1 (which is the one packaged for Linux with PostgreSQL 13), while we did the tests on our machines with version 3.1.3.<br><br>The source files of the PostGIS directories liblwgeom, libpgcommon, and ryu, in addition to the two files postgis_config.h and postgis_revision.h were copied into the directory MobilityDB/postgis. Minimal changes were done to these files, basically removing static keywords for the functions getSRSbySRID, getSRIDbySRS, and circ_tree_distance_tree_internal so that they can be called by MobilityDB. Furthermore, we replicated some of the configuration PostGIS performs in order to produce the right postgis_config.h according to the machine characteristics at hand, for example for setting the machine endian or the version of the required libraries such as GEOS.<br><br>The basic idea of the build is that if a PostGIS version less than 3.0 is found, then library liblwgeom.so is loaded. Otherwise, the directory MobilityDB/postgis is added to the build.<br><br>We needed to modify the MobilityDB regression tests to cope with changes in PostGIS from versions 2.5.5 to 3.1.3. There are mainly two types of modifications. The first one concerns a very small floating point precision difference across versions, as shown in the following extract of diff file<br><br> SELECT ST_AsText(trajectory(tnpoint 'Npoint(1, 0.5)@2000-01-01'));<br>-                 st_astext                  <br>---------------------------------------------<br>- POINT(48.71866291282778 77.76407051015086)<br>+                st_astext                <br>+------------------------------------------<br>+ POINT(48.7186629128278 77.7640705101509)<br> (1 row)<br><br>The reason is that PostGIS 3 started using the ryu library to output coordinate values. We had similar differences between PostgreSQL version 12 and 13 and we solved those problem with the setPrecision functions<br><a href="https://docs.mobilitydb.com/MobilityDB/develop/ch04s05.html#box_setPrecision">https://docs.mobilitydb.com/MobilityDB/develop/ch04s05.html#box_setPrecision</a><br><a href="https://docs.mobilitydb.com/MobilityDB/develop/ch05s06.html#tpoint_setPrecision">https://docs.mobilitydb.com/MobilityDB/develop/ch05s06.html#tpoint_setPrecision</a><br>We extended the setPrecision function for geometry/geography so that for example, the test above<br><br>SELECT ST_AsText(trajectory(tnpoint 'Npoint(1, 0.5)@2000-01-01'));<br><br>was replaced by <br><br>SELECT ST_AsText(setPrecision(trajectory(tnpoint 'Npoint(1, 0.5)@2000-01-01'), 6));<br><br>We are aware that functions ST_AsText and ST_AsEWKT have an optional parameter specifying the number of decimals to be output, but this is available only since PostGIS version 3 and we needed a solution that also works for PostGIS 2.5.<br><br>Another type of difference concerns discrepancies in the result of some PostGIS functions from version 2.5.5 to version 3.1. In order to solve the discrepancies we "commented out" the results of some tests, while keeping their execution for testing robustness and keeping coverage values. <br><br>More precisely, since the result of the function lwgeom_hash for geographies (which is used for B-Tree comparison of temporal values) changed in PostGIS 3, we replaced the tests such as<br><br>SELECT tgeogpoint 'Point(1.5 1.5)@2000-01-01' < tgeogpoint 'Point(2.5 2.5)@2000-01-01';<br><br>by<br><br>SELECT 1 WHERE tgeogpoint 'Point(1.5 1.5)@2000-01-01' < tgeogpoint 'Point(2.5 2.5)@2000-01-01' IS NOT NULL;<br><br>Similarly, since the result of the ST_Azimuth function changed in PostGIS 3, we replaced the tests such as<br><br>SELECT round(degrees(azimuth(tgeogpoint '[Point(1.5 1.5)@2000-01-01, Point(2.5 2.5)@2000-01-02]')), 6);<br><br>by <br><br>SELECT 1 WHERE round(degrees(azimuth(tgeogpoint '[Point(1.5 1.5)@2000-01-01, Point(2.5 2.5)@2000-01-02]')), 6) IS NOT NULL;<br><br>We are ready to release a new MobilityDB beta version with these changes but before that we need to discuss with the PostGIS development team about the license implications. The current license for MobilityDB is as follows<br><br>/*****************************************************************************<br> *<br> * This MobilityDB code is provided under The PostgreSQL License.<br> *<br> * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB<br> * contributors<br> *<br> * MobilityDB includes portions of PostGIS version 3 source code<br> * released under the GNU General Public License (GPLv2 or later).<br> * Copyright (c) 2001-2021, PosGIS contributors<br> *<br> * Permission to use, copy, modify, and distribute this software and its<br> * documentation for any purpose, without fee, and without a written<br> * agreement is hereby granted, provided that the above copyright notice and<br> * this paragraph and the following two paragraphs appear in all copies.<br> *<br> * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR<br> * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING<br> * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,<br> * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY<br> * OF SUCH DAMAGE.<br> *<br> * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,<br> * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY<br> * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON<br> * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO<br> * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. <br> *<br> *****************************************************************************/<br><br>We propose to modify this license as follows<br><br>/*****************************************************************************<br> *<br> * This MobilityDB code is provided under The PostgreSQL License.<br> *<br> * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB<br> * contributors<br> *<br> * MobilityDB includes portions of PostGIS version 3 source code released<br> * under the GNU General Public License (GPLv2 or later).<br> * Copyright (c) 2001-2021, PostGIS contributors<br> *<br> * Permission to use, copy, modify, and distribute this software and its<br> * documentation for any purpose, without fee, and without a written<br> * [...]<br> *<br> *****************************************************************************/<br><br>Could you please confirm that everything is OK with this license modification ?<br><br>Many thanks again to Vicky Vergara and Regina Obe who made this possible.<br><br>Regards<br><br>Esteban<br><br></div>