Choosing the correct value for proj4string for shapefile reading in R?

The proj4string is a valid PROJ4 crs string.

see How can I get the proj4 string or EPSG code from a shapefile .prj file? and Shapefile PRJ to PostGIS SRID lookup table?

in short:

  • You can use gdalinfo as in the first reference or the GDAL Python bindings as in the second reference.

Or

  • go to Prj2EPSG (a simple service for converting well-known text projection information from .prj files into standard EPSG codes)
  • Enter the content of your prj file

enter image description here

  • the result is EPSG:27700 so a first version of the PROJ4 string is

    "+init=epsg:27700"

`Or

  • Go to Spatial Reference and enter the code -> result EPSG Projection 27700 - OSGB 1936 / British National Grid

enter image description here

  • click on Proj4 and the complete PROJ4 string is:

    "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs"


Here is a very handy website for retrieving the EPSG code for a given projection. In your case the projection is "EPSG:27700". If you have projections defined for the shapefile you can assign the projection when you create the SpatialPointsDataFrame and then use the projection definition from your imported shapefile. Using "readOGR" from the rgdal package will retain the projection definitions. Here is an example of assigning and pulling coordinate strings on sp class data.

require(sp)
require(rgdal)

# Use meuse dataset
data(meuse)

# Coerce into SpatialPointsDataframe
coordinates(meuse) <- ~x+y

# Assign projection
proj4string(meuse) <- CRS("+init=epsg:28992")

# Pull some observations and transform to Lat/Long
meuse.geo <- meuse[sample(dim(meuse)[1],10),]
  prj.LatLong <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
    meuse.geo <- spTransform(meuse.geo, prj.LatLong)

# Pull projection string from meuse.geo and use in spTransform
#   to reproject meuse to lat/long  
( prj <- proj4string(meuse.geo) )   
meuse <- spTransform(meuse, CRS(prj))