[Qgis-developer] Qgis2threejs suggestions...

gene martin.laloux at gmail.com
Fri Jan 3 02:32:48 PST 2014

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

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.

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
my solution:
     proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
   (subprocess.check_call(cmd,shell=True) does not work )

Specific to Mac OS X:
- I change the line 182 
"cmd = "gdalwarp " + u" ".join(options)"
"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"

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',
      localePath = os.path.join(self.plugin_dir, 'i18n',

(working with Python 2.6.x and 2.7.x versions)

View this message in context: http://osgeo-org.1560.x6.nabble.com/Qgis2threejs-suggestions-tp5095871p5096206.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.

More information about the Qgis-developer mailing list