[R-sig-Geo] rgdal and MSSQL Server geometries

cmundy Craig.Mundy at utas.edu.au
Thu Apr 4 15:51:58 CEST 2013

Hi Shannon,

The following syntax has worked for me for the past year.

projstring <- CRS('+init=epsg:28355')

##Establish the dsn
# Note: use the odbc tool in Windows to create a dsn for your SQL Server
database beforehand
myMSSQLdsn <-

#Confirm connection is working

#Reading sp object classes from SQL SERVER
lyr <- c("mssqlserverTablename")
spdf <-readOGR(dsn=myMSSQLdsn, layer=lyr,p4s=CRSargs(projstring))

#Writing sp object classes to SQL SERVER
lyrout= c("NewMSSQLSpatialTableName")
writeOGR(spdfname, dsn=myMSSQLdsn, layer=lyrout, driver="MSSQLSpatial",

If you haven't created a dsn, this could be a big part of your problem.


View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rgdal-and-MSSQL-Server-geometries-tp7583193p7583203.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list