[Qgis-developer] SAGA kernel missing CRS?

Victor Olaya volayaf at gmail.com
Fri Jul 10 03:56:03 PDT 2015


Paolo

After much thinking, i think this should be solved now with this:

https://github.com/qgis/QGIS/commit/519d3dc3b769e8aa6b0d849f4c58521833a90816

Basically the problem is that when a CRS is assigned to a layer, QGIS
uses the qpj file to store that, not the prj file. External apps like
SAGA use the prj file, which usually doesn't thave the authority info,
and ignore the qpj file, which is a QGIS-only thing.

What I am doing is, once the SAGA algorithm is run, I replace the prj
files of the resulting layers with the algorithm output crs
definition, taken from the toWkt() method (which, if there's authority
info in the input layers, should write it in the WKT definition as
well). This will work fine since SAGA only generates sdat and shp
files (which use prj files when loaded by QGIS), and there are no SAGA
algorithms that perform any reprojections.

As you can see the solution is trivial and just a few lines of code...
Sometimes it is like that for problems that appear to be the toughest
ones :-)

I did some testing for the case that you mention with the kernel
desnsity surface, and it seems to be working. This also solves a
problem that could appear when creating an output in a format other
than sdat (the conversion from sdat to another format, internally
performed by Processing using gdal, is also now more robust with this
change, as user-defined CRSs are not likely to appear now unless they
are real user-define ones)

Also, this should fix the issues with CRSs that appeared with vector
layers as well.

Please, test and let me know if there are other issues.

Thanks!

2015-07-08 16:31 GMT+02:00 Paolo Cavallini <cavallini at faunalia.it>:
> Il 08/07/2015 16:10, Victor Olaya ha scritto:
>> hmm, not sure that it is related to that change, but I don't know how
>> CRS are handled in the sdat format (hadn't thought about that...) so I
>> will check it. If the issue is there, deffinitely it should be fixed,
>> since it is a regression
>
> Thanks, now opened:
>
> http://hub.qgis.org/issues/13093
>
> All the best.
> --
> Paolo Cavallini - www.faunalia.eu
> QGIS & PostGIS courses: http://www.faunalia.eu/training.html


More information about the Qgis-developer mailing list