2

I am trying to evaluate an equation in the raster calculator and I need latitude values. I have the DEM for the region and am wondering if it is possible to create a latitude raster based on the DEM?

Thanks a lot!

  • 2
    What software... ArcGIS? Is your DEM projected? – user2856 Aug 11 '11 at 12:14
3

Unproject the DEM to determine the geographic region it covers.

Create the latitude coordinate grid for this region. (In Arc* products prior to version 10, this is done with "$$YMap": http://forums.esri.com/Thread.asp?c=93&f=1740&t=182407.)

Projecting this grid produces the latitude raster. For the projection, use some form of interpolation for the resampling (bilinear should be good enough in most cases), not nearest-neighbor.

2

whuber's method is simpler, but this should also work if you have Spatial Analyst and ArcGIS:

  1. Spatial Analyst Tools > Extractions > Sample, to create a points layer for each cell
  2. Add X and Y fields to the points layers and calculate the X and Y values using "calculate geometry"
  3. Use Conversion Tools > To Raster > Points to Raster to create a new grid for each value.
1

I realise this is an old thread but thought I'd contribute to help anyone searching in the future. My DEM was too large to use Patrick's method, so I used a points file that contained a reasonable number of points (approx. 70, spread across the extent of the United Kingdom), then interpolated between these (using latitude as the z value). Hope this is helpful to someone, sometime!

1

The simplest way to create Lat/Long grids rasters is to use the r.latlong function in GRASS GIS.

By importing a DEM (or another raster), you can use the DEM as input and the function will create a latitude (and longitude using the -l flag) that matches the input DEM. You can then export to any desired format. This took ~ 1.5 min for a 13 x 10 degree, 30m DEM, using a 32 GB RAM, 32 Core workstation.

https://grass.osgeo.org/grass74/manuals/r.latlong.html

0

I used Kate's approach in ArcGIS (very much appreciated, even after all this time). I used a basic IDW interpolation with a variable search window on ~300 points. The rabbit hole that led me this far has been trying to ADD a directional elevation trend to to an existing DEM dataset to impose a stronger flow accumulation trend in a flat landscape. As the $$YMAP/$$XMAP GRID variables are no longer supported in Arc 10+, this was the easiest workaround for me. Doing this is was able to create two rasters for X and Y coordinate values to then work into map algebra.

0

This is now trivial to do with GRASS tools available within QGIS. Open your raster data in QGIS (e.g., 'raster_dem.tif') and open the GRASS tool r.rastercalculator in the Processing Toolbox. For the formula variable, enter this:

raster_dem = y()

This will produce a raster of latitude values. If you also need a raster of longitude values, simply use x() instead of y(). It's much faster than previous methods too.

  • It can be kind of dicey to do this through QGIS, because the region creation isn't reliable; this method didn't work for me. It did work to do the whole thing in GRASS, but I had to first double check & reset the region with g.region (or Settings -> Region -> Set Region in the GUI). – Nat Nov 18 '16 at 22:26

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.