D 2019-05-15T07:15:49.642 L PROJ.6 P f4bc960df1f01674aea1ffe57cf0ae76ce7dd864 U sandro W 46925 back
SRID | CRS Name | proj-string (PROJ.4 style) | proj-string (PROJ.6 style) |
---|---|---|---|
3003 | Monte Mario / Italy zone 1 | +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 +no_defs | +proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 \ +ellps=intl +units=m +no_defs +type=crs |
4326 | WGS 84 | +proj=longlat +datum=WGS84 +no_defs | +proj=longlat +datum=WGS84 +no_defs +type=crs |
32632 | WGS 84 / UTM zone 32N | +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs | +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +type=crs |
SRID | 3003 | 4326 | 32632 |
---|---|---|---|
CRS Name | Monte Mario / Italy zone 1 | WGS 84 | WGS 84 / UTM zone 32N |
ISO-2018 WKT |
LENGTHUNIT["metre",1]], AREA["Italy - west of 12°E"], BBOX[36.53,5.94,47.04,12], ID["EPSG",3003]] |
Important notice: there are several dialects in the WKT notation describing CRSes. All them share the same common core and mainly differ in few minor details. PROJ.6 can understand the following dialects:
|
PROJ.6 is now able to make a distinction between different areas of use within a CRS, and can eventually apply the most appropriate transformation when the intended area-of-use is explicitly specified, thus leading to more precise results. The side figure shows the situation for the Italian peninsula. As you can notice there are two main areas (East and West of longitude 12E), but there are several smaller areas covering specific regions.
If your specific area of interest is contained within one of such sub-regions you can usefully inform PROJ.6 about the intended BBOX, and then PROJ.6 will attempt to use the most specific transformation parameters available. We'll examine in more depth this topic on following sections. |
Concepts to keep well in mind
Additional conceptThe traditional spatial_ref_sys table contained within any SpatiaLite DB noticeably changes its intended scope in PROJ.6:
|
Useful hint: PROJ.6 supports a new CLI tool (projinfo) for inspecting in full detail the internal definitions of CRSes, Transformations etc. The above pipeline is simply the output of the following command: It's the best and easiest way for fully understanding how PROJ.6 do really works. |
In order to learn more about the many interesting cool new features supported by PROJ.6 please consult the original documentation |
---|
Please remember that now in SpatiaLite-5.0.0 InitSpatialMetaDataFull represents the preferred method for creating all metadata tables required by this version. InitSpatialMetaData is still maintained so to not break historical compatibility, but shouldn't be used any longer. |
SpatiaLite / PROJ version | Connected DB | Action |
---|---|---|
SpatiaLite-5 built on PROJ.6 | DB created by SpatiaLite-5 / PROJ.6 |
libspatialite-5 when built on PROJ.6 will always ignore both the proj-strings stored in column proj4text and the WKT definitions stored in column srtext. It will instead leave PROJ.6 fully free to use the CRS definitions contained in its own private database. Note that this applies indifferently to both legacy databases created by any previous version and most modern databases created by the latest version. |
DB created by SpatiaLite-5 / PROJ.4 or by any previous version of SpatiaLite (< 5.0.0) |
||
SpatiaLite-5 built on PROJ.4 or any previous version of SpatiaLite (< 5.0.0) |
DB created by SpatiaLite-5 / PROJ.6 |
When libspatialite (any version, including 5.0.0) is not supported by PROJ.6 then the traditional approach will be always applied, and each CRS will be consequently identified by its corresponding proj-string stored in column proj4text Note that even when PROJ.6 is not supported any version of SpatiaLite (this including 5.0.0) can safely connect to any DB-file created by the most recent version with full PROJ.6 support. |
DB created by SpatiaLite-5 / PROJ.4 or by any previous version of SpatiaLite (< 5.0.0) |
SQL Function | Extended signature | Behavior under PROJ.6 | ||
---|---|---|---|---|
ST_Transform() |
ST_Transform ( geom Geometry , newSrid Integer , area Geometry ) : Geometry ST_Transform ( geom Geometry , newSrid Integer , area Geometry , proj_string_from Text ) : Geometry ST_Transform ( geom Geometry , newSrid Integer , area Geometry , proj_string_from Text , proj_string_to Text ) : Geometry |
| ||
Notes
|
Tech Note: using projinfo for discovering pipelines and areas of use |
Lesson learned:
|
SQL Function | Supported arguments | Description |
---|---|---|
HasProj6( void ) : Boolean | None | Will return 1 (TRUE) if the library has been built on PROJ.6 (or any later version), otherwise 0 (FALSE). |
PROJ_GetLastErrorMsg( void ) : String | None | Will return the most recent error message returned by PROJ (if any). NULL will be returned if there is no currently pending PROJ error. |
PROJ_GetDatabasePath( void : String) | None | Will return the currently set pathname leading to the private PROJ's SQLite database. NULL will be returned if there is no private PROJ's SQLite database currently connected. |
PROJ_SetDatabasePath ( new_path String ) : String |
|
Will change the currently set pathname leading to the private PROJ's SQLite database. NULL will be returned if the passed path is invalid, otherwise the path of the currently set private PROJ's SQLite database will be returned. |
PROJ_AsProjString ( auth_name String , auth_srid Integer ) : String |
|
Will return the WKT expression corresponding to a given CRS; the definitions will be taken directly from the private PROJ's own database. NULL will be returned on failure or on invalid arguments. |
PROJ_AsWKT ( auth_name String , auth_srid Integer ) : String PROJ_AsWKT ( auth_name String , auth_srid Integer , wkt_style String ) : String PROJ_AsWKT ( auth_name String , auth_srid Integer , wkt_style String , indented Boolean ) : String PROJ_AsWKT ( auth_name String , auth_srid Integer , wkt_style String , indented Boolean , indentation Integer ) : String |
|
Will return the WKT expression corresponding to a given CRS; the definitions will be taken directly from the private PROJ's own database. NULL will be returned on failure or on invalid arguments. |
PROJ_GuessSridFromWKT ( wkt_expr String ) : Integer |
|
Will possibly return the SRID value corresponding to a given WKT expression defining a CRS. -1 will be returned if no CRS supported by PROJ.6 matches the WKT expression. NULL will be returned on invalid argument. |
PROJ_GuessSridFromSHP ( filename String ) : Integer |
|
Will possibly return the SRID value corresponding to the CRS defined by the .PRJ member of the Shapefile. -1 will be returned if no CRS supported by PROJ.6 matches PRJ member of the Shapefile. NULL will be returned on invalid argument. Please note well: this SQL function opens the door to many potential security issues, and thus is always disabled by default. Explicitly setting the environment variable SPATIALITE_SECURITY=relaxed is absolutely required in order to enable this function. |
Note: all the above SQL Functions will be available only when Spatialite-5.0.0 has been built against PROJ.6 (or any subsequent version). If SpatiaLite-5.0.0 has been built instead against any previous version (as e.g. PROJ.4) any attempt to call one of these SQL Functions will simply return a no such function SQL error. |
Important notice for Windows users |
---|
PROJ.6 critically depends on its own private SQLite database (proj.db) containing all relevant definitions about Ellipsoids, Prime Meridians, CRSes, Transformations and alike. 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.
This isn't usually a big issue on Linux and Unix-like platforms, where a rational and very clear filesystem layout exists. On these operating systems the package manager (or make install) will automatically take care to install proj.db on the most appropriate directory (usually as /usr/share/proj/proj.db or as /usr/local/share/proj/proj.db) and that's all. Things are unhappily a little bit more difficult on Windows platforms. The user itself is responsible for properly installing proj.db So it becomes critical understanding the basic rules adopted by libspatialite in order to properly locate proj.db on Windows. |
Where proj.db is expected to be found on Windows |
An useful diagnostic check
|
Using the environment variable PROJ_LIB |
---|
PROJ_LIB is a standard environment variable supported by PROJ itself. When PROJ_LIB is set, then PROJ.6 will directly search its own private database into the directory referenced by the variable. Such a capability is supported on both Windows and Linux (and on any other platform). Linux example:
Windows example:
|
The GUI tool just introduces a single new feature intended to make as easy as possible using PROJ.6 The main menu now contains an External variable PROJ_LIB item. After activating the corresponding option a standard File Selection Dialog will show on the screen, thus enabling the user to locate on the file-system the private proj.db database of PROJ.6. Once that proj.db will be correctly located then spatialite_gui will automatically set the PROJ_LIB variable. And that's not all; spatialite_gui will persistently store the current value of PROJ_LIB, so as to able to set it automatically for each subsequent invocation. |
|
There is a further enhancement available when spatialite_gui is backed up by PROJ.6 It's a very little evident innovation, but it will probably be highly appreciated by many users. When loading some Shapefile now the appropriate SRID value will be automatically determined by examining the content of the companion .prj memebr (if supplied). |