Julia,
To save an object of class "im" (image object from spatstat) to a
shapefile, you could do the following:
# create example data
library(spatstat)
image <- im( matrix(1:100, nrow=10, ncol=10) )
library(raster)
# transform to RasterLayer
r <- as(image, 'RasterLayer')
# to polygons
p <- rasterToPolygons(r)
# save (using rgdal)
shapefile("shapefile.shp", p)
Whether it makes sense to save raster data to a shapefile rather than to a
raster format file is another matter.
Robert
On Fri, Oct 12, 2012 at 7:10 AM, Julian Burgos <[email protected]> wrote:
> Julia, what do you mean with "shapefile"? Shapefiles are for vectorial
> data (points, lines, polygons). Your data appears to be a raster. What
> exactly do you want to do?
>
>
> On 10/12/2012 11:01 AM, Julia Chacon Labella wrote:
>
>> Hello to everybody,
>>
>> I have an image with the structure that is showed below, and I need to
>> convert it to a shapefile, any idea?
>>
>> str(image)
>>
>> List of 10
>> $ v : num [1:201, 1:240] NA NA NA NA NA NA NA NA NA NA ...
>> $ dim : int [1:2] 201 240
>> $ xrange: num [1:2] -0.0114 11.8824
>> $ yrange: num [1:2] -0.0094 9.9346
>> $ xstep : num 0.0496
>> $ ystep : num 0.0495
>> $ xcol : num [1:240] 0.0134 0.0629 0.1125 0.1621 0.2116 ...
>> $ yrow : num [1:201] 0.0153 0.0648 0.1143 0.1637 0.2132 ...
>> $ type : chr "real"
>> $ units :List of 3
>> ..$ singular : chr "unit"
>> ..$ plural : chr "units"
>> ..$ multiplier: num 1
>> ..- attr(*, "class")= chr "units"
>> - attr(*, "class")= chr "im"
>>
>> Thank you very much for your attention!!
>>
>> Julia
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________**_________________
>> R-sig-Geo mailing list
>> [email protected]
>> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>>
>>
>>
>
> --
> Julian Mariano Burgos, PhD
> Hafrannsóknastofnunin/Marine Research Institute
> Skúlagata 4, 121 Reykjavík, Iceland
> Sími/Telephone : +354-5752037
> Bréfsími/Telefax: +354-5752001
> Netfang/Email: [email protected]
>
>
> ______________________________**_________________
> R-sig-Geo mailing list
> [email protected]
> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo