<a
<h1>Introduction</h1>
<b>PROJ</b> is a well-known library for performing conversions between cartographic projections.<br>
It's universally supported by almost all open source GIS-oriented applications and packages, so there is no need to waste time in futher presentations.<br>
We just need a bit of history to fully understand the current state-of-the-art:<br><br>
Timeline:
<ul>
<li>Very few users and developers do really realize how ancient is PROJ, and how far in time it started moving its first steps.</li>
<li>in <b>1980</b> (about 40 years ago) Gerald Evenden started working on the very first PROJ version, and at the time it was a Ratfor program.</li>
<li>in <b>1985</b> the code was completely rewritten in C to run on UNIX systems, and it was named
<li>in <b>1990</b> was released an updated version named <b>PROJ.3</li>
<li>in <b>1994</b> a more advanced version was released, and it was obviously named
<li>in <b>1995</b> Evenden stopped any further development activity and the project become inactive for several years.</li>
<li>in <b>2000</b> Frank Warmerdam bacame the new maintainer and released version
<li>After this reborn the revitalized project continued to be regularly maintained, but no further relevant improvements were introduced.<br>
PROJ.4 just continued its very placid evolution in a substantially conservative way.</li>
</ul><br>
<b><u>Short the fourth version of PROJ (aka <b>PROJ.4</b>) lasted for about two decades, a very uncommon situation.<br>
And a full generation of developers and users become sincerly convinced that PROJ.4 was the real name of the library.
<h3>The revolution comes</h3>
Timeline:
<ul>
<li>in <b>2018</b> Even Rouault, Kristian Evers and others start developing a revolutionized PROJ supporting many relevant innovations.<br>
<b>PROJ.5</b> is intended to be the first preliminary step of a more complex evolution schema.</li>
<li>on <b>March 2019</b> a more mature version is released, and it's
<li>Next year (2020) <b>PROJ.7</b> is expected to be released, and it will fully complete the transition between the old and new architectures.</li>
</ul>
<br>
the whole transition implies many relevant changes, so that a deeply revised API will be required.
In other words, the old <b>PROJ.4</b> and the new <b>PROJ.7</b> will support two different APIs, thus abruptly breaking cross-version compatibility.<br>
This is an umpleasant new, because it practically means that all software modules depending on PROJ (this including SpatiaLite) will require a not at all trivial rewrite in order to fulfill the new API requirements.<br>
But when you consider that's the first time in its very long life that PROJ requires an extra effrot in order to introduce so many useful innovations, this unexpected API breakage looks fully justified and absolutely reasonable.<br><br>
<b><u>More details about the API
<ul>
<li><b>PROJ.5</b> started introducing the new API, but was still able to support the old traditional API without any complaint.</li>
<li><b>PROJ.6</b> have depreceted the old traditional API.<br>
It still continues to be reluctanctly supported, but the library requires to be compiled by explicitly defining a <b>-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1</b> directive in order to effectively enable this option.</li>
<li>and finally the next-to-come <b>PROJ.7</b> will completely get rid of the old API.</li>
</ul>
<br>
<hr>
<h1>What's new in PROJ.6</h1>
<h3>Fully supporting ISO-19111:2019 WKT</h3>
Old versions of PROJ (including <b>PROJ.4</b>) required to define each <b>CRS</b> (<i>Coordinate Reference System</i>) by a corresponding <b>proj-string</b>.
The following table exemplifies the case of few CRSes:<br><br>
<table cellspacing="8" cellpadding="8" bgcolor="#e8ffe8" border="1">
<tr><th bgcolor="#ffb03e">SRID</th><th bgcolor="#ffb03e">CRS Name</th><th
<tr><td align="right">3003</td><td>Monte Mario / Italy zone 1</td>
<td>+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m
<tr><td align="right">4326</td><td>WGS 84</td>
<td>+proj=longlat +datum=WGS84
<tr><td align="right">32632</td><td>WGS 84 / UTM zone 32N</td>
<td>+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs</td>
</table>
<br>
New versions of PROJ (starting since <b>PROJ.6</b>) still continue to support the old <b>proj-strings</b>, but the preferred notation for defining any CRS is now conformant to the <b>ISO-19111:2019</b> international standard<br>
(<i>OGC Abstract Specification Topic 2: “Referencing By Coordinates”</i>).<br>
The following table exemplifies the same CRSes as above in the ISO WKT notation:
<br><br>
<table cellspacing="8" cellpadding="8" bgcolor="#e8ffe8" border="1">
<tr><th
<tr><th bgcolor="#ffb03e">CRS Name</th><td>Monte Mario / Italy zone 84</td><td>WGS 84 / UTM zone
<tr><th bgcolor="#ffb03e">ISO-2018 WKT</th>
<td valign="top"><verbatim>
PROJCRS["Monte Mario / Italy zone 1",
    BASEGEODCRS["Monte Mario",
        DATUM["Monte Mario",<br>
            ELLIPSOID["International 1924",6378388,297,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]]],
    CONVERSION["Italy zone 1",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",1500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting (X)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing (Y)",north,
            ORDER[2],<br>
            LENGTHUNIT["metre",1]],
    AREA["Italy - west of 12°E"],
    BBOX[36.53,5.94,47.04,12],
    ID["EPSG",3003]]

<td valign="top"><verbatim>
GEODCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    AREA["World"],
    BBOX[-90,-180,90,180],
    ID["EPSG",4326]]

<td valign="top"><verbatim>
PROJCRS["WGS 84 / UTM zone 32N",
    BASEGEODCRS["WGS 84",
        DATUM["World Geodetic System 1984",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]]],
    CONVERSION["UTM zone 32N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    AREA["World - N hemisphere - 6°E to 12°E - by country"],
    BBOX[0,6,84,12],
    ID["EPSG",32632]]

</tr>
</table>
<br>
As you can easily notice, the two notations are profoundly different.
The old <b>proj-string</b> notation is extremely concise and rough, whilst the new <b>ISO-WKT</b> is verbose but exhaustive, detailed and precise.<br>
There is no possible match: ISO-KWT is clearly superior and more sophisticated under any possible aspect.<br>
Not at all surprisingly, coordinate transformations based on ISO-WKT definitions (instead of proj-strings) are usually expected to be more accurate.<br><br>
And that's not all; the old <b>proj-strings</b> weren't formally defined by any standard, and only PROJ, GDAL and few other FLOSS / GFOSS implementations can understand them.<br>
At the opposite, the new <b>ISO-WKT</b> is formally defined by an international standard, and many free and proprietary implementations can understand it.<br><br>
<table cellspacing="8" cellpadding="16" bgcolor="#ffffe9">
<tr><td>
<b><u>Important there are several dialects in the WKT notation describing CRSes.<br>
All them share the same core and mainly differ in few minor details.<br>
PROJ.6 can understand the following dialects:
<ol>
<li><b>ESRI WKT</b>: a dialect widely adopted by ESRI proprietary software.</li>
<li><b>GDAL WKT1</b>: a dialect historically supported by the open source GDAL library.</li>
<li><b>WKT2:2015</b>: as defined by <b>ISO 19162:2015</b> standard specifications.</li>
<li><b>WKT2:2018</b>: as defined by <b>ISO 19162:2018</b> standard specifications.</li>
</ol>

</table><br>
<h3>Transformation pipelines</h3>
There is a second astonishing improvement supported by PROJ.6, that are <b>transformation pipelines</b>.<br>
When using a <b>pipeline</b> you can freely define any complex geodetic transformation by chaining together many elementary steps such as conversion, transformation, projection, axis swap and so on.<br>
A pipeline is conceptually similar to a UNIX shell script, with a dataflow regularly proceding forward from step to step until producing the final result.<br>
The following is a practial example of a pipeline corresponding to a transformation from <b>NAD27</b> to <b>NAD83</b>,
<verbatim>
+proj=pipeline
+step +proj=axisswap +order=2,1
+step +proj=unitconvert +xy_in=deg +xy_out=rad
+step +proj=hgridshift +grids=conus
+step +proj=unitconvert +xy_in=rad +xy_out=deg
+step +proj=axisswap +order=2,1
</verbatim>
<h3>The private SQLite database supporting PROJ.6</h3>
Starting since <b>PROJ.6</b> the PROJ library requires an external SQLite database containing all definitions about supported CRSes, Ellipsoids, Prime Meridians, Unit of Measure, Transformations and so on.<br>
Many of the new advanced PROJ's API will fail if such database is not available.
<br><br>
<table cellspacing="8" cellpadding="8" bgcolor="#ffffe9">
<tr><th>
In order to learn more about the many interesting cool new features supported by PROJ.6 please consult the <a documentation</a>

</table><br>
<hr>
<h1>SpatiaLite-5.0.0 supporting PROJ.6</h1>
<h3>Existing SQL functions affected by PROJ.6</h3>
<table cellspacing="8" cellpadding="8" bgcolor="#e8ffe8" border="1">
<tr><th bgcolor="#ffb03e">SQL Function</th><th bgcolor="#ffb03e">Extended signature</th><th bgcolor="#ffb03e">Behavior under

<td>
<b>ST_Transform</b> ( geom <i>Geometry</i> , newSrid <i>Integer</i> , area <i>Geometry</i> ) : <i>Geometry</i><hr>
<b>ST_Transform</b> ( geom <i>Geometry</i> , newSrid <i>Integer</i> , area <i>Geometry</i> , method <i>Text</i> ) : <i>Geometry</i><hr>
<b>ST_Transform</b> ( geom <i>Geometry</i> , newSrid <i>Integer</i> , area <i>Geometry</i> , method <i>Text</i> , proj_string <i>Text</i> ) : <i>Geometry</i>
</td>
<td>
<table cellspacing="4" cellpadding="4" bgcolor="#ffffd0">
<tr><td>
all these <b><i>extended are supported only when <b>libspatialite-5.0</b> has been built on the top of <b>PROJ.6</b><br>
If the library has been built instead on earlier versions of PROJ any attempt to call these extended signatures will just return a <b>wrong number of arguments to function ST_Transform()</b> error.
</td><tr>
</table><br>
<table cellspacing="4" cellpadding="4" bgcolor="#ffdfd0">
<tr><td>
Any invalid argument passed to <b>ST_Transform()</b> (<b><i>extended will raise an <b>SQL Exception</b>.
</td><tr>
</table><br>
<ul>
<li>the optional argument <b>area</b> may be <b>NULL</b> (<i>default setting</i>).<br>
Otherwise it's expected to contain a valid Geometry in <b>SRID=4326
When an <b><i>area of is explicitly supplied, then <b>PROJ.6</b> may eventually use the corresponding <b>BBOX</b> for finely tuning the more accurate transformation.</li>
<li>the optional argument <b>method</b> is expected to contain one the following values (<b>proj4text</b> will be always assumed as the <i>default
<ul>
<li><b>proj4text</b>: both CRSes (origin and destination) will be defined by passing to PROJ.6 the traditionals <b>proj-string</b> definitions for the corresponding SRIDs retrieved from column <b>proj4text</b> in Table <b>spatial_ref_sys</b><br>
This exactly corresponds to the well extablished traditional behavior of all previous versions of <b>libspatialite</b> and still continues to be supported mainly for historical compatibility, but <b><u><i>isn't any longer the best way for taking full profit of the more advanced capabilities of
<li><b>srtext</b>: both CRSes (origin and destination) will be defined by passing to PROJ.6 the <b>WKT</b> definitions for the corresponding SRIDs retrieved from column <b>srtext</b> in Table <b>spatial_ref_sys</b><br>
this method could effectively take full profit of the more advanced capabilities of PROJ.6, but only if the underlaying spatialite database has been created with PROJ.6 support.<br>
But it could easily be inadequate when the underlaying spatialite database was created by some earlier version of spatialite lacking PROJ.6 support.</li>
<li><b>auth_name:auth_srid</b>: both CRSes (origin and destination) will be defined by ignoring the definitions stored in <b>spatial_ref_sys</b> and leaving PROJ.6 free to retrieve their corresponding definitions from its own private SQLite database.<br>
this method will always take full profit of the more advanced capabilities of PROJ.6</li>
<li><b>proj_string</b>: an <b><u><i>user-defined (may be one definining a <b><u><i>transformation will be passed to PROJ.6; this is an advanced option reserved to skilled power users.</li>

<li>the optional argument <b>proj_string</b> may be <b>NULL</b> (<i>default setting</i>).<br>
Otherwise it's expected to contain a valid <b>PROJ.6 transformation string</b>, may well be defining an <b>user-defined transformation pipeline</b>.<br>
Meaningful only in the case of
</ul>

<tr><td><b>InitSpatialMetaData()</b><hr>
<b>InitSpatialMetaDataFull()</b><hr>
<b>InsertEpsgSRID()</td><td
<td>
All these SQL Functions doesn't change their signatures, but behave in a significantly different way when <b>PROJ.6</b> support is available.
<ul>
<li>traditional behavior on old <b>PROJ.4</b>: the <b>spatial_ref_sys</b> metadata Table will be populated by using the CRSes definitions internally inlined within the code of
<li>new behavior on <b>PROJ.6</b>: the <b>spatial_ref_sys</b> metadata Table will be populated by inserting the CRSes definitions extracted from the SQLite private database currently connected to PROJ.6; more precisely, column <b>proj4text</b> will be populated by inserting the new <b>proj-strings</b> as supported by PROJ.6, whilst column <b>srtext</b> will be populated by inserting the <b>ISO-2018 WKT</b> definitions as supported by PROJ.6<br>
<u><b><i>Important if there is no database currently connected to PROJ.6 the initialization of <b>spatial_ref_sys</b> will fail.</li>
</ul>

</table><br>
Few practical SQL examples:
<verbatim>
SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003)); -- SRID=3003 - default settings; using proj-strings from spatial_ref_sys.proj4text
-------------------------------------
POINT(1732832.444892 4816350.146246)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003, NULL, 'srtext')); -- SRID=3003 - NULL area of use, using ISO-2018 WKT definitions from spatial_ref_sys.srtext
-------------------------------------
POINT(1732852.942717 4816277.617691)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003, NULL, 'auth_name:auth_srid')); -- SRID=3003 - NULL area of use, ignoring spatialite_ref_sys and using the PROJ.6 own private database
-------------------------------------
POINT(1732852.942717 4816277.617691)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632)); -- SRID=32632 - default settings; using proj-strings from spatial_ref_sys.proj4text
-------------------------------------
POINT(732821.718475 4816262.631245)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632, NULL, 'srtext')); -- SRID=32632 - NULL area of use, using ISO-2018 WKT definitions from spatial_ref_sys.srtext
-------------------------------------
POINT(732821.718475 4816262.631245)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632, NULL, 'auth_name:auth_srid')); -- SRID=32632 - NULL area of use, ignoring spatialite_ref_sys and using the PROJ.6 own private database
-------------------------------------
POINT(732821.718475 4816262.631245)
</verbatim>
This first test is based on a new SpatiaLite dabase created with full PROJ.6 support. As you can easily notice:
<ul>
<li>the first transformation from SRID=4326 to SRID=3003 based on traditional <b>proj-strings</b> retrieved from <b>spatial_ref_sys.proj4text</b> rather surprisingly significantly differs from the other two results.</li>
<li>but all transformations from SRID=4326 to SRID=32632 return identical results.</li>
<li>this is a direct confirmation that still continuing to use the traditional approach of transformations driven by proj-strings <b><u><i>definitely isn't the optimal method for using
</ul><br>
<verbatim>
SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003)); -- SRID=3003 - default settings; using proj-strings from spatial_ref_sys.proj4text
-------------------------------------
POINT(1732852.942717 4816277.617691)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003, NULL, 'srtext')); -- SRID=3003 - NULL area of use, using ISO-2018 WKT definitions from spatial_ref_sys.srtext
-------------------------------------
POINT(1732852.942717 4816277.617691)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 3003, NULL, 'auth_name:auth_srid')); -- SRID=3003 - NULL area of use, ignoring spatialite_ref_sys and using the PROJ.6 own private database
-------------------------------------
POINT(1732852.942717 4816277.617691)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632)); -- SRID=32632 - default settings; using proj-strings from spatial_ref_sys.proj4text
-------------------------------------
POINT(732821.718475 4816262.631245)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632, NULL, 'srtext')); -- SRID=32632 - NULL area of use, using ISO-2018 WKT definitions from spatial_ref_sys.srtext
-------------------------------------
POINT(732821.718475 4816262.631245)

SELECT ST_AsText ( ST_Transform( MakePoint( 11.878056 , 43.463056, 4326 ), 32632, NULL, 'auth_name:auth_srid')); -- SRID=32632 - NULL area of use, ignoring spatialite_ref_sys and using the PROJ.6 own private database
-------------------------------------
POINT(732821.718475 4816262.631245)
</verbatim>
This second test is based instead on a legacy SpatiaLite database created by some earlier version lacking PROJ.6 support.<br>
In this specific case there is no difference in the results returned by different methods.<br><br>
<b><u>Mistery just a quick glance to the old and new <b>proj-strings</b>:
<ul>
<li>SRID=3003 proj-string as defined by old PROJ.4:
<ul>
<li><b>+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +towgs84=-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68 +units=m

<li>SRID=3003 proj-string as defined by new PROJ.6:
<ul>
<li><b>+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +units=m +no_defs

As you can easily notice, there is no <b>+towgs84</b> term defined in new PROJ.6, and this fully explains all.
</ul>
<h3>New auxiliary SQL functions specifically supporting PROJ.6</h3>
<table cellspacing="8" cellpadding="8" bgcolor="#e8ffe8" border="1">
<tr><th bgcolor="#ffb03e">SQL Function</th><th bgcolor="#ffb03e">Supported arguments</th><th
<tr><td><b>HasProj6</b>( <i>void</i> ) :
<td>None</td>
<td>Will return <b>1</b> (<b>TRUE</b>) if the library has been built on <b>PROJ.6</b> (or any later version), otherwise <b>0</b>
<tr><td><b>PROJ_GetLastErrorMsg</b>( <i>void</i> ) :
<td>None</td>
<td>Will return the most recent error message returned by PROJ (if any).<br>
<b>NULL</b> will be returned if there is no curently pending PROJ
<tr><td><b>PROJ_GetDatabasePath</b>( <i>void</i> :
<td>None</td>
<td>Will return the currently set pathname leading to the private PROJ's SQLite database.<br>
<b>NULL</b> will be returned if there is no private PROJ's SQLite database currently
<tr><td><b>PROJ_SetDatabasePath</b> ( new_path <i>String</i> ) :
<td>
<ul>
<li><b>new_path</b>: a relative or absolute pathname leading to a valid PROJ's SQLite database.</li>

<td>Will change the currently set pathname leading to the private PROJ's SQLite database.<br>
<b>NULL</b> will be returned if the passed path is invalid, otherwise the path of the currently set private PROJ's SQLite database will be
<tr><td><b>PROJ_AsWKT</b> ( auth_name <i>String</i> , auth_srid <i>Integer</i> ) : <i>String</i><hr>
<b>PROJ_AsWKT</b> ( auth_name <i>String</i> , auth_srid <i>Integer</i> , wkt_style <i>String</i> ) : <i>String</i><hr>
<b>PROJ_AsWKT</b> ( auth_name <i>String</i> , auth_srid <i>Integer</i> , wkt_style <i>String</i> , indented <i>Boolean</i> ) : <i>String</i><hr>
<b>PROJ_AsWKT</b> ( auth_name <i>String</i> , auth_srid <i>Integer</i> , wkt_style <i>String</i> , indented <i>Boolean</i> , indentation <i>Integer</i> ) :
<td><ul>
<li><b>auth_name</b> and <b>auth_srid</b> identify the intended CRS.<br>
<b>auth_name</b> can be <b>NULL</b>, and in this case <b>EPSG</b> will be assumed.</li>
<li>the optional argument <b>style</b> determines which specific WKT format should be adopted, and must be one between <b>GDAL</b>, <b>ESRI</b>, <b>ISO-2015</b> or <b>ISO-2018</b> (this latter being the default setting).</li>
<li>the optional argument <b>indented</b> if set to <b>TRUE</b> will nicely format a multiline WKT expression, otherwise a single monolithic line lacking any white-space or new-line will be printed (the default is
<li>the optional argument <b>indentation</b> determines how many white-spaces are to be used for indenting (only meaningful if the default values is

<td>Will return the WKT expression corresponding to a given CRS; the definitions will be taken directly from the private PROJ's own database.<br>
<b>NULL</b> will be returned on failure or on invalid
<tr><td><b>PROJ_GuessSridFromWKT</b> ( wkt_expr <i>String</i> ) :
<td><ul>
<li><b>wkt_expr</b>: the WKT expression to be evaluated.</li>

<td>
Will possibly return the <b>SRID value</b> corresponding to a given WKT expression defining a CRS.<br>
<b>-1</b> will be returned if no CRS supported by PROJ.6 matches the WKT expression.<br>
<b>NULL</b> will be returned on invalid argument.

<tr><td><b>PROJ_GuessSridFromSHP</b> ( filename <i>String</i> ) :
<td><ul>
<li><b>filename</b>: the absolute or relative path leading to some Shapefile.<br>
Note: exactley as required by must omit any <b>.shp</b>, <b>.shx</b>, <b>.dbf</b> or <b>.prj</b> suffix.</li>

<td>
Will possibly return the <b>SRID value</b> corresponding to the CRS defined by the .PRJ member of the Shapefile.<br>
<b>-1</b> will be returned if no CRS supported by PROJ.6 matches PRJ member of the Shapefile.<br>
<b>NULL</b> will be returned on invalid argument.<hr>
<u>Please note well</u>: this SQL function opend the door to many potential security issues, and thus is always <i>disabled by default</i>.<br>
Explicitly setting the environment variable <b>SPATIALITE_SECURITY=relaxed</b> is absolutely required in order to enable this function.

</table><br>
<table cellspacing="8" cellpadding="16" bgcolor="#ffffe9">
<tr><td>
all the above SQL Functions will be available only when Spatialite-5.0.0 has been built against <b>PROJ.6</b> (or any subsequent version).<br>
If SpatiaLite-5.0.0 has been built instead against any previosus version (as e.g. <b>PROJ.4</b>) any attempt to call one of these SQL Functions will simply return a <b><i><u>no such SQL error.

</table><br>
<b>Practical examples:</b>
<verbatim>
SELECT PROJ_GetDatabasePath();  -- retrieving the currently set PROJ's own database
------------------------------


SELECT -- non existing database
------------------------------
NULL

SELECT PROJ_GetLastErrorMsg(); -- retrieving the failure cause
------------------------------
proj_context_set_database_path: Open of failed

SELECT -- valid database
------------------------------


SELECT PROJ_AsWKT('EPSG', 4326); -- default settings: ISO-2018 style, indented with indentation 4
------------------------------
GEODCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    AREA["World"],
    BBOX[-90,-180,90,180],
    ID["EPSG",4326]]

SELECT PROJ_AsWKT('EPSG', 4326, 'ESRI', 0, 0); -- ESRI style, monolithic line
------------------------------
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

SELECT PROJ_GuessSridFromWKT('GEOGCS["GCS_Monte_Mario_Rome",DATUM["D_Monte_Mario",SPHEROID["International_1924",6378388.0,297.0]],PRIMEM["Rome",12.4523333333333],UNIT["Degree",0.0174532925199433]]');
------------------------------
4806

SELECT -- remember: requires to explicitly set SPATIALITE_SECURITY=relaxed
------------------------------
3003
</verbatim>
<br>
<hr><br>
<table cellspacing="8" cellpadding="8" bgcolor="#ffe0e9" width="100%">
<tr><th>
<h1>Important notice for Windows users</h1>

<tr><td>
<b>PROJ.6</b> critically depends on its own private SQLite database (<b>proj.db</b>) containing all relevant definitions about Ellipsoids, Prime Meridians, CRSes, Transformations and alike.<br>
If PROJ.6 is unable to correctly establish a connection to this database it will be severely limited and will not be able to correctly behave as expected.<br><br>
<ul>
<li><b><u><i>Short installing the software alone is not enough.<br>
The PROJ.6 private database <b>proj.db</b> must be properly installed as well, in order to ensure that anything runs smoothly.</li>
</ul><br>
This isn't usually a big issue on Linux and Unix-like platforms, where a rational and very clear filesystem layout exists.<br>
On these operating systems the package manager (or <b>make install</b>) will automatically take care to install <b>proj.db</b> on the most appropriate directory (usually as or as and that's all.<br><br>
Things are unhappily a little bit more difficults on Windows platforms.
The user itself is responsible for properly installing <b>proj.db</b>
So it becomes critical understanding the basic rules adopted by <b>libspatialite</b> in order to properly locate <b>proj.db</b> on Windows.

<tr><th>
<h2>Where proj.db is expected to be found on Windows</h2>

<tr><td>
<ol>
<li>the first place where <b>proj.db</b> will be searched is the same folder form where the <b>EXE</b> binary was initially loaded.<br>
assuming that you are currently executing
<ul>
<li>then an attempt will be made to connect

<li>a second attempt will be made on behalf of the <b>Public</b> folder.<br>
an attempt will be made to connect
<li>a third (and last) attempt will be made on behalf of the <b>User</b> folder.<br>
an attempt will be made to connect
</ol>
<h3>An useful diagnostic check</h3>
<verbatim>
SELECT PROJ_GetDatabasePath();
</verbatim>
<ul>
<li>if <b>NULL</b> is returned, then PROJ.6 is definitely unable to connect to its own private SQLite database <b>proj.db</b><br>
You have to carefully verifiy that it's really installed on one of the expected standard locations.</li>
<li>otherwise the path leading to the currently connected <b>proj.db</b> will be returned.</li>
</ul><br>

</table><br><br>
<table cellspacing="8" cellpadding="8" bgcolor="#c9fff0" width="100%">
<tr><th>
<h2>Using the environment variable SPATIALITE_PROJ_DB_PATH</h2>

<tr><td>
If the environment variable <b>SPATIALITE_PROJ_DB_PATH</b> is set, then <b>libspatialite</b> will simply attempt to connect the database pointed by this variable.<br>
Such a capability is supported not only on Windows but also on Linux (and on any other platform).<br><br>
<i><u>Linux
<ul>
<li><b>export
echo $SPATIALITE_PROJ_DB_PATH<br>
spatialite<b></li>
</ul><br><br>
<i><u>Windows
<ul>
<li><b>SET
echo %SPATIALITE_PROJ_DB_PATH%<br>
spatialite_gui<b></li>
</ul><br><br>

</table><br>
<hr><br>
<a