[R-sig-Geo] writeOGR issue in dbf
Roger Bivand
Roger.Bivand at nhh.no
Thu Mar 18 17:26:33 CET 2010
On Thu, 18 Mar 2010, caspar hallmann wrote:
> Dear list,
>
> I am using writeOGR to create an ESRI shapefile from a
> SpatialPointsDataFrame. When opening the shapefile in ArcMap and ask
> for the attributes, I get an error "A column was specified that does
> not exist".
I only have other tools using OGR (GRASS, QGIS) and Excel 2003 SP3 on
Windows XP. Your example cannot be reproduced using those. I suspect from
trying to interpret the entrails of ESRI "help", that an integer column is
required reproducing the FID values already encoded in the *.shp. Try:
meuse$FIDs <- 1:nrow(meuse)
and write out again. This doesn't match your simple copying to get it to
read, though. If others could comment who have access to Arc (which
version), that would be useful. Please include a copy of the messages
displayed when rgdal is loaded, so that we have control of the versions.
Does changing locale make a difference?
Roger
> Similarly, when opening the dbf of the shapefile in Paradox I get
> "Unable to open table. Corrupt table/index header".
> This does not only happen to my own Dataset but also the meuse data.
>
> data(meuse)
> coordinates(meuse)=~x+y
> class(meuse)
> writeOGR(meuse,".","test",driver="ESRI Shapefile")
> # then try ArcMap or Paradox fails as mentioned above.
> #Strangely, when i do
> write.dbf(read.dbf("test.dbf"),file="test2")
> #then renaming test2 into test, my attribute tables open up fine, and
> Paradox stops complaining.
>
> any clues?
>
> Caspar.
>
>> sessionInfo()
> R version 2.10.1 (2009-12-14)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252
> LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
> [5] LC_TIME=Dutch_Netherlands.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] pscl_1.03.3 coda_0.13-4 mvtnorm_0.9-9
> automap_1.0-5 MASS_7.3-5 lme4_0.999375-32
> Matrix_0.999375-33 maptools_0.7-29
> [9] lattice_0.18-3 foreign_0.8-39 raster_0.9.9-24
> rgdal_0.6-24 gstat_0.9-66 sp_0.9-57
>
> loaded via a namespace (and not attached):
> [1] grid_2.10.1 tools_2.10.1
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list