# Reading UTM geotiff DEM

**URL:** <https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536>\
**Category:** Q&A\
**Created:** [December 12, 2022, 1:16pm UTC](https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536 "2022-12-12T13:16:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwwjohnson](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bwwjohnson](https://forum.generic-mapping-tools.org/u/bwwjohnson)\
**Post date:** [December 12, 2022, 1:16pm UTC](https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536/1 "2022-12-12T13:16:50Z")

</div>

Hi there, sorry if this ends up being super basic. I’m trying to display this DEM (downsampled from original for upload) in order to do some swath profiling of fault scarps, in a similar way to example 33.

I’m currently unable to load my DEM, and get this output. The geographic ranges look good  
grdimage [INFORMATION]: File dem-DEM\_aligned\_30m.tif reads with GDAL driver GTiff  
grdimage [INFORMATION]: Read header from file dem-DEM\_aligned\_30m.tif  
grdimage [INFORMATION]: File dem-DEM\_aligned\_30m.tif reads with GDAL driver GTiff  
grdimage [INFORMATION]: gmt\_map\_setup perimeter search region: 70.65900000010298/71.03100000019242/39.05132776178719/39.36768301479938.  
grdimage [INFORMATION]: Map scale is 0.730022 km per cm or 1:73002.2.  
grdimage [INFORMATION]: Allocate and read data from file dem-DEM\_aligned\_30m.tif  
grdimage (gmtapi\_import\_grid): Subset x range \<= 0.0  
[Session gmt (0)]: Error returned from GMT API: GMT\_RUNTIME\_ERROR (79)  
[Session gmt (0)]: Error returned from GMT API: GMT\_RUNTIME\_ERROR (79)  
[Session gmt (0)]: Error returned from GMT API: GMT\_RUNTIME\_ERROR (79)  
psconvert [ERROR]: Unable to decode BoundingBox file /home/bwwj/.gmt/sessions/gmt\_session.7279/psconvert\_7344c.bb (maybe no non-white features were plotted?)

Here’s the file: [dem-DEM\_aligned\_30m.tif](https://forum.generic-mapping-tools.org/uploads/short-url/nLAo1Yi5FUEFfNwmO998ar3qSyx.tif) (434.7 KB)

Here’s the code:  
_#!/bin/bash_  
_gmt gmtset FORMAT\_GEO\_MAP D:mm_

_echo “testing loading tif in gmt”_

_im=“dem-DEM\_aligned\_30m”_  
_proj=“-JU42/20c”_  
_bounds=“-R70.759/39.154/70.931/39.265+r”_

_# downsample_  
_# gdalwarp -r average -tr 30 30 -multi -wo NUM\_THREADS=ALL\_CPUS -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co TILED=YES -co NUM\_THREADS=ALL\_CPUS -co COMPRESS=LZW dem-DEM\_aligned.tif dem-DEM\_aligned\_30m.tif_

_gmt begin test_

- gmt makecpt -Cdem1 -T1000/3000/50 -Z\*
- gmt grdimage ${im}.tif $bounds proj -V #-I{im}.int -Bxa0.05f0.01 -Bya0.05f0.01\*  
_gmt end show_

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [December 12, 2022, 1:45pm UTC](https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536/2 "2022-12-12T13:45:37Z")

</div>

I’m getting this info from your grid file:

```auto
$ gmt grdinfo dem-DEM_aligned_30m.tif 
dem-DEM_aligned_30m.tif: Title: Grid imported via GDAL
dem-DEM_aligned_30m.tif: Command: 
dem-DEM_aligned_30m.tif: Remark: 
dem-DEM_aligned_30m.tif: Pixel node registration used [Cartesian grid]
dem-DEM_aligned_30m.tif: Grid file format: gd = Import/export through GDAL
dem-DEM_aligned_30m.tif: x_min: 652200.75 x_max: 665580.75 x_inc: 30 name: x n_columns: 446
dem-DEM_aligned_30m.tif: y_min: 4336968.75 y_max: 4347978.75 y_inc: 30 name: y n_rows: 367
dem-DEM_aligned_30m.tif: v_min: 1539.35083008 v_max: 2945.37670898 name: z
dem-DEM_aligned_30m.tif: scale_factor: 1 add_offset: 0
dem-DEM_aligned_30m.tif: Default CPT: 
+proj=utm +zone=42 +datum=WGS84 +units=m +no_defs

```

This is already projected (UTM42), so plot it with `-Jx` or `-JX`.  
Not sure what the problem is. I’m getting this image from this command:

```auto
$ gmt grdimage dem-DEM_aligned_30m.tif -Jx1:100000 -png test

```

 ![test](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/0/09048349474b4a73cc7e8440f1447c2df2ce31e8.png)

---

<div class="post-metadata">

**Author:** ![bwwjohnson](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@bwwjohnson](https://forum.generic-mapping-tools.org/u/bwwjohnson)\
**Post date:** [December 12, 2022, 4:11pm UTC](https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536/3 "2022-12-12T16:11:50Z")

</div>

Thanks for your reply, Andreas. The -Jx option worked!

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [December 12, 2022, 5:00pm UTC](https://forum.generic-mapping-tools.org/t/reading-utm-geotiff-dem/3536/4 "2022-12-12T17:00:51Z")

</div>

You’re welcome!
