I downloaded Mars HiRise DTM .IMG files and they load fine and generate contours fine. When I try to create an STL using DEMto3D to print it on the 3D printer I can't export it because I cannot put any value in the height field... I get an error if I put in any positive value that that says:

Height of the base must be lower than DEM highest point. 

Well the highest point is a NEGATIVE altitude. The DTM goes from -3190 up to -2050... As soon as you put a negative sign in the height field it generates a "ValueError:could not convert string to float"

There is no good documentation at all on the DEMto3D plugin so I have to ask here if I can somehow fool the data to get an STL out of this?


Because Mars doesn't have any water to form a sea level the Martian datum is an arbitrary atmospheric pressure (610.5 Pa) so most heights are negative.

To produce a useful 3D print I would suggest you add a constant value to your heights to give a series of positive values for the printer. I would use gdal_calc but I expect that almost any good GIS can do thi


Considering you are interested in creating a 3D printed model and not in the analysis of the data, you could recalculate the raster cells with a factor of "+ Minimum Raster Cell Value" (in your case +3190). This way the proportions of the model are still in tact, but the problem of the negative values is removed.

You may find that you have to add 3191 to each value to not get any 0 values either (don't know the plugin well enough to comment on that). I've downloaded a sample of the data you used to test this theory and given my original values were between -3022.2 and -1997.6 decided to add 3023 to all values in my case.

Using GDAL/OGR -> Miscellaneous -> Raster Calculator with the GDAL transformation code generated equating to

gdal_calc --calc "A+3023" --format GTiff --type Float32 --NoDataValue -9999 -A D:/Downloads/DTEED_008884_1845_020000_1845_A01.IMG --A_band 1 --outfile "[temporary file]"

results in a value range of 0.79 and 1025.3.

Original and recalculated raster values

Subsequently running the DEMto3D plugin works fine. As I've not worked with this one before I don't know whether the remaining values are realistic, but the height is accepted and appears to be processed correctly. The Model height as far as I can tell is correct given the scale of the model.

DEMto3D plugin settings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.