Sorry, I didn't reply for the list.

Cristina

-------- Original Message --------
Subject: 	Re: [R-sig-Geo] Conversion of a SpatialPolygonsDataFrame into 
a ESRI file
Date: 	Tue, 20 Mar 2012 12:15:46 +0000
From: 	Cristina Silva <csilva@ipimar.pt>
To: 	Pınar Aslantas Bostan <aslantas@metu.edu.tr>


Hi Pinar,

The problem is not to get the data, this can be done directly with
write.csv or write.table. I was looking for a package/function to export
the whole spatial object to a ESRI shapefile with all the files needed
(.shp, .shx, .prj and .dbf). With writeOGR I can do this but the
resulting .dbf file is not read properly, although the data are there.

Thanks anyway.

Cristina

On 20/03/2012 11:36, Pınar Aslantas Bostan wrote:
>  Dear Cristina,
>
>  For this purpose I use "write.table" function.
>
>  my code is this;
>
>  write.table(dem, file="D:\\Data\\dem_outputs.txt", quote = TRUE, dec = ".",
>  qmethod = c("escape", "double"))
>
>  # "dem" is SpatialPixelsDataFrame in my study.
>
>  then you can add your data as txt file in ArcGis.
>
>  I hope this helps.
>
>  Best wishes,
>  Pinar
>
>
>  -----Original Message-----
>  From: r-sig-geo-bounces@r-project.org
>  [mailto:r-sig-geo-bounces@r-project.org] On Behalf Of Cristina Silva
>  Sent: Tuesday, March 20, 2012 1:11 PM
>  To: r-sig-geo@r-project.org
>  Subject: [R-sig-Geo] Conversion of a SpatialPolygonsDataFrame into a ESRI
>  file
>
>  Dear all,
>
>  I need to export a SpatialPolygonsDataFrame to a shapefile to  be read by
>  ArcGIS. I have used several packages and functions to do this with different
>  results.
>
>  1) with maptools, function writePolyShape: The file .prj is not created
>
>  2) with spsurvey, function sp2shape: Doesn't work, gives the following
>  message "Error: Opening .prj file in C function writeShapeFilePolygon"
>
>  3) with rgdal, function writeOGR:
>
>     * with data projected (transforming longlat into utm) or not (longlat:
>       the file is read by ArcGIS. However, when I try to open the
>       Attributes table, it gives the message that could not load the data
>       from the data source, suggests to refresh (which is not possible)
>       and opens an empty table, although having the number of columns and
>       lines of the data. Looking for the info of each polygon in the map,
>       the data are displayed for each individual record. So, the data
>       exist but are not acessible from the Attributes Table.
>     * To display the Attributes Table, I had to convert the .dbf file in
>       .csv and export again as a .dbf.
>
>  Is there any better way to make this conversion?
>
>  Cristina
>
>  --
>  ------------------------------------------
>  Cristina Silva
>  INRB/L-IPIMAR
>  Unidade de Recursos Marinhos e Sustentabilidade Av. de Brasmlia, 1449-006
>  Lisboa Portugal
>  Tel.: 351 21 3027096
>  Fax: 351 21 3015948
>  csilva@ipimar.pt
>
>
>  	[[alternative HTML version deleted]]
>
>


-- 
------------------------------------------
Cristina Silva
INRB/L-IPIMAR
Unidade de Recursos Marinhos e Sustentabilidade
Av. de Brasília, 1449-006 Lisboa
Portugal
Tel.: 351 21 3027096
Fax: 351 21 3015948
csilva@ipimar.pt



	[[alternative HTML version deleted]]

