Transforming Coordinates from Lat Long to UTM

Please note: rgdal is being deprecated at the end of 2023. See this blog post on r-spatial.

Update: Updated post for transformation in R using sf is available here.

If you’re new to the world of movement and spatial ecology, its likely that you have all of your coordinates in latitude and longitude (lat long for short) format. For example, the coordinates for Santa Cruz,CA, in lat long are 36.9741° N, 122.0308° W. In order to make the most of your coordinates, you’ll need to convert your lat long coordinates to UTM.

First thing you’ll need to know is the UTM zone that your coordinates are in. Thankfully, there are plenty of maps that show you where your coordinates are. You can locate your zone by checking it here. After that, you’ll need to locate the EPSG code for that zone. Please note, if its in the northern hemisphere, the zone will be followed by a N. If its in the southern hemisphere, it’ll be followed by a S. So Santa Cruz is in UTM zone 10N, which is epsg 26910.

While locating your epsg code, there may be some confusion about whether you’re using NAD83 or WGS84. There’s only about 3-4 feet of difference between the two, so its not that big of a deal. When in doubt, refer to the documentation that came with your GPS unit. It should tell you whether its NAD83 or WGS84. If you’re still not sure, go with WGS84.

I’ll cover two methods to transform your data. Method 1 will be to use QGIS. Method 2 will be to use R. Both software are opensource and free to distribute. QGIS can be downloaded here. R can be downloaded here. Both methods will require that you have your coordinates in a CSV file. I recommend that the column holding longitude be labeled “x” and the column holding latitude be labeled “y”.

Method 1: QGIS

  1. Load your CSV file.
    1. In the menu, go to Layer > Add Layer > Add Delimited Text Layer
  2. In the new menu box, open browse and find your CSV file.
  3. Under geometry definition, select your X and Y field. X field is the column holding your longitude coordinates and Y field is the column holding your latitude coordinates.
  4. Click okay. You should now be prompted to specify the coordinate reference system for your coordinates. Select your reference system. If you’re unsure, enter WGS 84 for now. You can always confirm later.
  5. In the layer panel, select the newly plotted layer. Right click and go to save as. Select the format you would like. It defaults to ESRI Shapefile, but you can save it as a CSV again if you would like.
  6. Fourth option down is the CRS selector. If you look to the far right of that option, you’ll see a button with what looks like a blue sphere with a spiderweb over it. Click that to select the CRS of your choice. In filter, enter the epsg code of your UTM zone and that’ll select the UTM of interest. Since I’m interested in Santa Cruz, CA, I’ll filter for 26910. Only one option should come up. Confirm that the its the one you’re looking for. For example, mine says NAD83 / UTM Zone 10N.
  7. Click okay. All done!

Method 2: R

  1. Either call or install the rgdal package.
    1. To install, type the following line of code into your console.
      1. > install.packages(“rgdal”)
    2. To call:
      1. > library(rgdal)
  2. Read your csv file using the read.csv function.
    1. > coords <- read.csv(“”)
  3. Transform your csv using the following lines of code. Please note, this assumes that the column heading for longitude is x and latitude is y. Also note that I use the epsg codes for my data. You’ll need to update the epsg codes to accurately reflect your coordinates.
    1. > <- coords[c(“x”, “y”)]
    2. > coords.xy <- SpatialPoints(
    3. > proj4string(coords.xy) <- CRS(“+init=epsg:4326”)
    4. > coords.utm <- spTransform(coords.xy), CRS(“+init=epsg:26910”)
  4. To show your new utm coordinates:
    1. > coords.utm
  5. To write it to a CSV:
    1. > write.csv(coords.utm, “UTM.csv”)

Both methods will give you a CSV of your coordinates in UTM. Please note that due to different algorithms, there will be minor differences between the two methods that are negligible. In my comparison, the difference occur after the 5th decimal place. That’s less than a centimeter in difference.

The featured image is We are “here” by Cary Hampton used under CC 2.0.

Posted in GIS

2 thoughts on “Transforming Coordinates from Lat Long to UTM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s