I am dealing with IGN shapefiles of french "communes" that are in Lambert93 projection.

temp <- readOGR(dsn = chemin) temp@proj4string

which gives

CRS arguments: +proj=lcc +lat_1=44 +lat_2=49 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +units=m +no_defs

I would like to focus on the attached dataset and to use the coordinates of some points :

data.temp <- as.data.frame(temp@data) coordinates(data.temp) <- ~X_CHF_LIEU+Y_CHF_LIEU

if we look at the coordinates :

> coordinates(data.temp.centr) X_CHF_LIEU Y_CHF_LIEU 0 1743 68564 1 7919 63428 2 7747 63253 3 5284 64353 4 9895 68015 5 7931 63483

But I would like to have this in the WGS84 projection system. In order to do so, I first assign the initial CRS to spatial data frame I extracted. And then re-project it.

data.temp@proj4string <- temp@proj4string data.temp <- spTransform(data.temp, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +"))

But unfortunately, it gives unrelevant coordinates :

> coordinates(data.temp.centr) X_CHF_LIEU Y_CHF_LIEU 0 -1.375898 -5.554938 1 -1.335507 -5.584978 2 -1.336522 -5.586134 3 -1.352299 -5.580093 4 -1.324725 -5.555561 5 -1.335450 -5.584630

but obviously, it is not in France anymore.. Any idea why I'm not ending with proper WGS84 coordinates ?


As far as I remember, if you read the metadata of your shapefiles, provided by the IGN on their website, you'll see that coordinates in the table are divided by 100 (not 1000 as written in previous version). So that you should do:

data.temp$long <- data.temp$X_CHF_LIEU * 100
data.temps$lat <- data.temp$Y_CHF_LIEU * 100
coordinates(data.temp) <- ~long+lat
  • I didn't know this, but looks about right. @user8324208 if you compare the Lambert coordinates in your example and the projected bounds of the coordinate system, you can notice that their orders of magnitutde are different. – Janina Jul 18 '17 at 12:49
  • Yes, in fact, I sorted the issue out by noticing that the coords were provided in hectometers and not in meters. So that, it should be multiplied by 100 and not 1000. But it is the idea. Thanks! – Martin Jul 19 '17 at 8:24

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.