[R-sig-Geo] Saving a spatial point object into a shapefile
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Thu Nov 4 11:25:21 CET 2010
On 11/04/2010 11:16 AM, Manuel Spínola wrote:
> Dear list members,
>
> I am trying to save a spatial point object as a shapefile, but I got an
> error that I do not have the right object class, why?
Because the documentation sais so. ?writeOGR tells me:
Usage:
writeOGR(obj, dsn, layer, driver, dataset_options = NULL,
layer_options=NULL, verbose = FALSE)
Arguments:
obj: a SpatialPointsDataFrame, SpatialLinesDataFrame, or a
SpatialPolygonsDataFrame object.
...
you can create a SpatialPointsDataFrame with dummy attributes from your
object by:
x = SpatialPointsDataFrame(sitiosMikeCRTM05, data.frame(dummy = rep(1,14))
>
> > sitiosMikeCRTM05
> SpatialPoints:
> x y
> [1,] 480244.6 1181636
> [2,] 480651.1 1184371
> [3,] 477555.2 1181189
> [4,] 486482.8 1167946
> [5,] 483764.4 1164624
> [6,] 477301.6 1192979
> [7,] 483737.4 1192048
> [8,] 480760.2 1192652
> [9,] 479985.8 1150756
> [10,] 481748.5 1148902
> [11,] 476126.6 1165617
> [12,] 464735.7 1167079
> [13,] 481182.4 1185941
> [14,] 500632.8 1132727
> Coordinate Reference System (CRS) arguments: +proj=tmerc +lon_0=-84
> +lat_0=0 +x_0=500000 +k=0.9999 +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
>
> > writeOGR(sitiosMikeCRTM05,
> dsn="C:/ProyectosRespacial/CBSS/Shapefiles_proyectados",
> layer="sitiosMikeCRTM05", driver="ESRI Shapefile")
> Error en writeOGR(sitiosMikeCRTM05, dsn =
> "C:/ProyectosRespacial/CBSS/Shapefiles_proyectados", :
> obj of wrong class
>
> Best,
>
> Manuel
>
>
>
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list