Export Clean Heightmaps from QGIS(Fix!)

One reader of this blog reached out to point that the method to export clean heightmaps using the very first post of this blog (https://www.marciofontenelle3d.com/blog/exporting-clean-heightmaps-from-qgis) with the Heightmap Export plugin doesn't work anymore.

I made another post(https://www.marciofontenelle3d.com/blog/exporting-clean-heightmaps-from-qgis-redux) describing an alternative way to export heightmaps from QGIS which you can try, but in case in really need to use the old plugin, you can fix it manually, let me show you how.

The error comes not from the plugin code, but from Python itself. Upon trying to load the plugin with a more recent version of QGIS/Python you will see in the application console something along the lines of:

ImportError: cannot import name 'MutableSequence' from 'collections'

This happened because in more recent Python versions, the location of that “MutableSequence” library changed within Python itself, breaking the user-space. Because of course Python would.

So the fix is simply open a file from the plugin and point that required library to the correct path.

The full path to the file that needs to be edited on Windows will be something like:

C:\Users\%USERPROFILE%\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\HeightmapExport\PathTracer\path

Open “path.py” and among the first lines there is a line that says:

from collections import MutableSequence

Change it to:

from collections.abc import MutableSequence

Reload QGIS and the plugin should work as usual.

The bigger issue seems to be that the original plugin is unmaintained, so this fix might be on borrowed time. If you like the plugin, your best bet would likely be to try one of the more recent forks that are maintained(I haven't tried them myself).

You can check them(along with when the last time it was updated) here: https://github.com/ClayJarCom/HeightmapExport/forks

You can also see the discussion about the issue in this blog post(and where I found the fix) here: https://github.com/ClayJarCom/HeightmapExport/issues/16

If you want to use a fork keep in mind you won't be able to use the plugin window inside QGIS to install it, as it still points to the original plugin. My guess is that replacing the files from the fork in the same path as the original plugin would suffice.

See you next mission.

Next
Next

SSHFS on Windows