I am trying to transform Lat/Long data from Italy (UTM 32 and 33) to UTM. I am struggling a bit with this.

The code I am trying to use is one I found in a previous post, I tried to modify it to solve the problem of several UTMs but does not seem to work.

df <- data.frame(x = Data_group_malesCLEAN$Latitude, y = Data_group_malesCLEAN$Longitude, ID = Data_group_malesCLEAN$Group.1)

long2UTM <- function(long) { ## Function to get the UTM zone for a given longitude (floor((long + 180)/6) %% 60) + 1 }

LongLatToUTM <- function(df){ coordinates(df) <- ~x+y
proj4string(df) <- CRS("+proj=longlat +datum=WGS84")

zone <- long2UTM(df$x)

## Change CRS of the spatial data frame and convert to data frame

res1 <- spTransform(df, CRS(paste0("+proj=utm +zone=", zone, "+datum=WGS84"))) return(as.data.frame(res1)) }


I also tried to do it with Qgis... but I am in the same problem... It is only possible for one UTM,... any ideas? Best

  • I don't understand the code, but a data frame / map can only use one coordinate reference system. Are you taking that into account? – mkennedy Apr 4 '18 at 20:08
  • mkennedy, thanks. However Italy fells between 2 UTMS 12 and 13, and my dataset has data from all Italy, so I was wondering How I could approach this. Because even in Qsig for instance, you only can use one UTM... any suggestions? Thanks! – Maravillas Ruiz Apr 5 '18 at 8:45
  • You'll have to decide to use one, or use another coordinate reference system that covers the entire area of use. – mkennedy Apr 5 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.