Often coordinates for water quality sites are provided in eastings and northings and it’s useful to convert to latitude and longitude. There are programs and on-line tools available for this. For example, Geoscience Australia provides a web-app here and also a spreadsheet as linked from this page. A direct link to the spreadsheet is here.
Based on the spreadsheet, I’ve developed an R function
UTM2deg to convert UTM coordinates to latitudes and longitudes (available via this gist). I’m interested in plotting points in Australia so have used the GRS80 ellipsoid which is used for the Geocentric Datum of Australia (GDA94).
Let’s try it. First input the easting and northings for the two water quality stations on Merri Creek, convert to Lat and Lon and then plot. Plotting is done using the ggmap package.
library(dplyr) library(ggmap) # Source the UTM2deg function source("https://gist.githubusercontent.com/TonyLadson/f37aab3e2ef517188a7f27166307c985/raw/0822970769bc90fcc28052a91b375399d665286e/UTM2deg.R") # Some sample data test_df <- structure(list(Location = c("Summerhill Road, Craigieburn", "Roseneath Street, Yarra Bend" ), Northing = c(5839684, 5815224), Easting = c(320312, 324192)), .Names = c("Location", "Northing", "Easting" ), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame" )) # Add columns of lat and lon using the UTM2deg function test_df <- bind_cols(test_df, UTM2deg(test_df$Easting, test_df$Northing, zone = 55)) test_df # Centre of the map map_center <- test_df %>% summarise(lon = mean(lon), lat = mean(lat)) # plot ggmap(get_map(map_center, zoom = 11, source = 'osm', maptype = 'terrain'), darken = c(0.3, 'black'), extent = 'device') + geom_point(data = test_df, aes(lon, lat), colour = 'red', size = 2) + geom_label(data = test_df, aes(lon, lat, label = Location), colour = 'red', fontface = 'bold', hjust = 0, vjust = -0.5)