TerraME / terrame

TerraME is a programming environment for spatial dynamical modelling
www.terrame.org
GNU Lesser General Public License v3.0
36 stars 13 forks source link

Unknown output message from terralib #2330

Open avancinirodrigo opened 4 years ago

avancinirodrigo commented 4 years ago

TerraLib is outputting too many messages, mainly when handling tif. It seems the messages come from Proj4 3rdparty:

proj_create_from_database: prime meridian not found
proj_uom_get_info_from_database: unit of measure not found
avancinirodrigo commented 4 years ago

That seems an exception em Proj: https://github.com/OSGeo/PROJ/blob/71e6438ba2173ee7c05ade1c395bd5949023cadc/src/iso19111/factory.cpp

avancinirodrigo commented 4 years ago

The error message raises when terralib is not identifying the projection.

The method on terralib that the error happens: terralib/gdal/Utils.cpp

te::rst::Grid* te::gdal::GetGrid(GDALDataset* gds, const int multiResLevel)
...
   const char* projRef = gds->GetProjectionRef(); // <-- right here
...

Comming from: terralib/gdal/Transactor.cpp

std::unique_ptr<te::da::DataSetType> te::gdal::Transactor::getType(const std::string& dsfullname)

An example of the return of GetProjectionRef() when the projection is not identified:

PROJCS["unnamed",GEOGCS["SAD69",DATUM["South_American_Datum_1969",SPHEROID["GRS
 1967",6378160,298.249988368249,AUTHORITY["EPSG","7036"]],AUTHORITY["EPSG","6618"]],PRIMEM
["Greenwich",0],UNIT["unknown",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER
["latitude_of_origin",0],PARAMETER["central_meridian",-57],PARAMETER["scale_factor",0.9996]
,PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY
["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]]  

A valid one:

GEOGCS["SAD69",DATUM["South_American_Datum_1969",SPHEROID["GRS 1967 Modified",6378160,298.25,
AUTHORITY["EPSG","7050"]],TOWGS84[-66.87,4.37,-38.52,0,0,0,0],
AUTHORITY["EPSG","6618"]],PRIMEM["Greenw
ich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],
AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4618"]]

A temporary solution is to reproject data. Another solution is not to allow unrecognized projection.