SRS comparison in SampleSelection is faulty
Description
Even when receiving input vector and image with the same projref, the SampleSelection application (and possibly other applications of the classification framework) may decide to reproject the input vector data.
Steps to reproduce
The problem comes from the weak comparison between projref done here :
If the projref string is not identicaly formated, for instance :
PROJCS["RGF93 / Lambert-93",
GEOGCS["RGF93",
DATUM["Reseau_Geodesique_Francais_1993",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6171"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4171"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",49],
PARAMETER["standard_parallel_2",44],
PARAMETER["latitude_of_origin",46.5],
PARAMETER["central_meridian",3],
PARAMETER["false_easting",700000],
PARAMETER["false_northing",6600000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["X",EAST],
AXIS["Y",NORTH],
AUTHORITY["EPSG","2154"]]
versus
PROJCS["RGF93 / Lambert-93",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2154"]]
The string comparison will fail and result in input vector file to be reprojected.
This in turn is an issue because it copies vector file in memory, which may cause memory issue, and we also may loose some properties of the input vector file (such as spatial indexing).
Possible fix would be :
- Use a robust SRS comparison tool (such as http://www.gdal.org/classOGRSpatialReference.html#a17fd82b2f58a976a30358b076a2fc966 )
- Make input vector re-projection optional through application parameters
SampleExtraction and PolygonClassStatistics should also be checked for this bug.
Configuration information
Tested on latest develop branch.