I am struggling to plot points using WGS84 co-ordinates on a map of the UK using the OSGB 1936 / British National Grid CRS. I'm using the rgdal package in R.

Here is my reproducible example, using the co-ordinates of Buckingham Palace...

foo <- data.frame(lat = 51.500829, long = -0.142994)
bar <- SpatialPoints(foo)
proj4string(bar) <- CRS("+init=epsg:4326")
bar <- spTransform(bar, CRS("+init=epsg:27700"))

This outputs the following transformed co-ordinates:

         lat     long
[1,] 7464126 -5554500

Where I should be getting latitude of 179622 and longitude of 528993.

Can anyone tell me what I'm doing wrong? The only similar problem I could find was here and I'm now pretty confident I am choosing the right CRSs. I'm trying to do something similar to this post but again, I don't think the solutions there can help me.

P.S. I'm using this site to check what co-ordinates I should be getting.

  • 1
    technically they are eastings and northings after the transform not lat/lon
    – Ian Turton
    May 31, 2018 at 14:40

1 Answer 1


Short answer: x is longitude and y is latitude. (For geographic coordinates. East and north for projected coordinates)


foo <- data.frame(y = 51.500829, x = -0.142994) # lat == y, long == x
coordinates(foo) <- ~x+y
proj4string(foo) <- CRS("+init=epsg:4326")
bar <- spTransform(foo, CRS("+init=epsg:27700"))
##          x        y
## 1 528992.9 179622.5
  • The core problem is that SpatialPoints(foo) ignores the names on the data frame and takes the first column as the "X" coordinate (longitude) and the second column as "Y" (latitude).
    – Spacedman
    May 31, 2018 at 18:20
  • @Spacedman yes, indeed isn't explicit the order of input coordinates
    – aldo_tapia
    May 31, 2018 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.