2

I have MTM coordinates in the following format

df <- data.frame(xcentro = c(250605,250770,250871),ycentro = c(5186087,5185610,5186140))

and need them to be converted in the WGS84 format. I expect the rgdal library to be able to do that, but I fail in finding the correct epsg

The only way out I see would be to implement the conversion formulas https://stackoverflow.com/questions/27824732/how-to-convert-mtm-canada-coordinates-to-latitude-and-longitude but I cannot believe it was not already implemented somehow in rgdal.

7
  • Do you know the MTM zone? There do exist EPSG Codes for MTM zones (i.e. EPSG:32189). So it is only a matter of finding the right zone – JonasV Oct 1 '20 at 13:54
  • The geographical zone is Eastern Canada (Québec). – Xavier Prudent Oct 1 '20 at 15:02
  • Most of the MTM zones cover a portion of Quebec. Here's a url that does a search for MTM zones that contain Quebec in their area of use. – mkennedy Oct 1 '20 at 23:14
  • Looks like this might be EPSG:32187 (NAD83 MTM Zone 7) which would correspond to points in Old Quebec City. – FSimardGIS Oct 2 '20 at 2:40
  • What would be the consequence if I used an epsg for another zone close by, would the precision sink or would that be negeligible (~1meter). – Xavier Prudent Oct 2 '20 at 17:58
2

It looks like your points might be in EPSG:32187 (NAD83 MTM Zone 7) which would correspond to points in Old Quebec City.

It is important to tell the system the correct coordinate system and zone that your points are expressed in. Let's take the MTM Zones as an example:

enter image description here

In each zone, the x,y coordinates repeat themselves, but 3 longitude degrees apart. Choosing a wrong zone would cause the system to locate your points in a completely different region. Your points would be hundreds of km off if you used another zone. MTM zones are 3 longitude degrees wide, so if your zone number is off by 1, then your point is off by 3 degrees of longitude, or +- 200 km.

0

More technical details about how to do the conversion in R:

library(rgdal)
library(leaflet)

## Given a shapefile with coordinates projected onto MTM-zone 7
myFile <- "/path/to/file.shp"
data <- readOGR(myFile)

## Define the projection used for these data
proj4string(data) <- CRS("+init=epsg:32187") # MTM zone 7

## Define the new projection to use (WGS84 for lat-lon)
CRS.wgs84 <- CRS("+init=epsg:4326") 

## Tranform to the WGS projection
data <- spTransform(data,CRS.wgs84)

## Look at it on a map
m <- leaflet() %>% addTiles() 
m %>% addPolygons(data=coords)

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.