# Working with DEMs: which should I do first calculate slope or reproject?

I have some 10 m digital elevation model rasters in UTM, and I need to generate 30 m resolution slope rasters in Albers.

Which should I do first: reproject the rasters, or calculate slope?

In case it matters, I am planning to use gdalwarp and gdaldem to do this.

• i would reproject first – ziggy Dec 22 '16 at 18:52
• What is the rationale? – user1521655 Dec 22 '16 at 20:08
• as a general rule you should always have the correct datums and coordinates systems for your layers before you proceed with any type of geoprocessing – ziggy Dec 23 '16 at 4:22
• I posted a discussion of this issue at gis.stackexchange.com/a/40464/664. Although it focuses on global projections, the points it makes apply to computing slopes for any raster data. If you are working in a small region and use a conformal projection designed for that region (which includes the UTM coordinate system when used appropriately), then you will be perfectly fine computing the slopes without further ado. Otherwise you need to be more careful and follow the procedures I outlined. – whuber Dec 23 '16 at 23:03
• For "completeness" you could do both and then measure the difference between them. You could then propagate these statistics into your overall error estimation. It may not be practical to do this every time you wish to reproject a DEM and I understand you're looking for the "most widely applicable" method, but in your specific case it may tell you if it makes a significant difference or not – Nathan Thomas Sep 16 '20 at 23:18

I am providing a word of caution for the other answer here by way of demonstration. I was given a DEM to perform some analysis on, and this DEM had a custom projection in feet. The next figure shows the difference in the computed slope without reprojection (left) and with reprojection (right).

You can see striping artifacts on the reprojected DEM's slope which don't appear in the original. I used a bilinear resampling scheme; perhaps cubic or higher order would reduce these effects. The scale bar is the same for both images too, showing that slopes are greatly overpredicted for the projected DEM. Note that you may have to provide a z-factor (or scaling factor) for computing slope if using WGS84.

I have also seen similar behavior with the National Elevation Dataset (10 m US DEM). I don't have a figure to show for slopes, but in that case I was trying to hydrologically process the DEM. Here's a before-after example for the drainage network (thresholded at some value):

It is likely these effects could be reduced by choosing better resampling schemes or projections, but it's important to be aware of them.

My approach has generally tended toward keeping the DEM in its original CRS and grid, performing needed analyses, then reprojecting the final result to the desired CRS. Sometimes this isn't possible, and it can definitely add more work, but I feel more confident that I'm avoiding the introduction of resampling/reprojection artifacts.

Reproject should be the first operation.

This will convert the data, and probably resize the pixels, so that any geometric operations that you would then do, would have values in reference to that Coordinate System.

If you ran Slope First, those value would be in the context of the source Coordinate System, and would not match with the values in the target Coordinate System.

• As stated in such an unqualified manner, this answer looks incorrect. It is likely that UTM already is one of the best possible coordinate systems for computing slopes, assuming this raster does not lie outside its UTM zone. If the reprojection is into some other projection--especially a nonconformal one--then anybody following your advice will be getting worse results than otherwise. – whuber Dec 23 '16 at 23:07
• @whuber, I'm interested in hearing more of your thoughts on this. One thing I was wondering about in posing my question is what relevant data might be lost through the resampling or interpolation necessary for reprojection. Is this considered to be an issue at all? I'd be interested in an answer that addresses both this issue and the conformal/nonconformal issue you mention here. You're more than welcome to provide an answer. – user1521655 Dec 28 '16 at 20:04
• Resampling can be an issue. A thorough answer would take a long time to formulate. Maybe it would suffice here to remark that one should aim to minimize reprojections, but that usually a reprojection into a coordinate system that is suitable for one's analysis should be preferred. For instance, if your data were originally in a noticeably non-conformal projection (which you nevertheless needed to employ for other analyses), it would be wise to reproject to a conformal system, compute slopes, and project the results back. In your present case, it looks like no reprojection is needed. – whuber Dec 28 '16 at 20:11