[Qgis-developer] Qgis2threejs suggestions...
Minoru Akagi
akaginch at gmail.com
Fri Jan 3 04:07:40 PST 2014
Hi gene,
I'm sorry for the inconvenience, and thank you for your concrete report.
I've changed the plugin code to do DEM warp with gdal.ReprojectImage
instead of gdalwarp program to store warped DEM data in memory raster,
so it may work in also Mac OS X, I guess. I will also fix the other
issue. Feel free to comment about the plugin.
Thanks,
Minoru
2014/1/3 gene <martin.laloux at gmail.com>:
> Hi Minoru,
>
> First of all, many thanks for your plugin.
>
> As I use Mac OS X and the QGIS version of Kyngchaos, the path of gdalwarp is
> /Library/Frameworks/GDAL.framework/Versions/1.10/Programs/gdalwarp but this
> QGIS version does not recognize the PATHs defined in the UNIX environment
> of MAC OS X ie:
>
> export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH
> which gdalwarp
> /Library/Frameworks/GDAL.framework/Programs/gdalwarp
>
> So I had to make some changes in your qgis2threejs.py script to run on Mac
> OS X with this version of QGIS.
> I know that you can not change your script for a specific case but I hope
> that this will help Mac users who want to use your plugin.
>
> General:
> ----------
> The os.system() works but it is marked as deprecated in the doc , so I use
> the Python module subprocess to make the job (as in Processing or the old
> Sextante) and it works:
>
> original line 185
> os.system(cmd.encode(fsenc))
> my solution:
> proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
> stdin=subprocess.PIPE,stderr=subprocess.STDOUT)
> proc.stdout.read()
>
> (subprocess.check_call(cmd,shell=True) does not work )
>
> Specific to Mac OS X:
> -------------------------
> - I change the line 182
> "cmd = "gdalwarp " + u" ".join(options)"
> in
> "cmd = "/Library/Frameworks/GDAL.framework/Versions/1.10/Programs/gdalwarp"
> + u" ".join(options)"
>
> - and I have removed the conditional statement
> #if not os.path.exists(demfilename):
> #....
>
> - the same with line 160 which becomes:
>
> #options.append("--config GDAL_FILENAME_IS_UTF8 NO")
>
> - a final command which works is, for example:
>
> "/Library/Frameworks/GDAL.framework/Versions/1.10/Programs/gdalwarp -r
> bilinear -te 201132.706856 87080.384980 206579.284551 91865.013464 -ts 214
> 188 -t_srs EPSG:31370 "/Users/Shared/Dropbox/my.asc"
> "/var/folders/vu/vu099NovH-KZpE5TEa83BU+++TI/-Tmp-/dem20140101164100.tif"
>
> Cosmetic
> -----------
> As I still use Snow Leopard version (witch uses Python 2.6, I know, I know,
> it is old, but...), the line 48
> locale= localePath = os.path.join(plugin_dir, 'i18n',
> 'qgis2threejs_{}.qm'
> becomes
> localePath = os.path.join(self.plugin_dir, 'i18n',
> 'qgis2threejs_{0}.qm'.format(locale))
>
> (working with Python 2.6.x and 2.7.x versions)
More information about the Qgis-developer
mailing list