[R-sig-Geo] polygons ignored rasterizing with R-raster rasterize()

Jose Tanago josetanago at gmail.com
Fri Sep 7 15:55:05 CEST 2012


Thanks roman

I am newbie in this kind of posting, so i dont know exactly what you
mean with self-confined reproductible example.

I have created a super small subset of the data as example (few
polygons and a super small raster with same extent) as well as the
rasterized output. all in a dropbox folder of 40kb in total.

the lines of my code I am running are:

>segmshp<-readShapePoly("Segm2rasterize.shp")
>ima<-raster("imagecroped.tiff")
>rastsegm<-rasterize(segmshp, ima, field='ID', fun=max, filename='segmRast.tif')

After running the rasterize() I got this message in the console:

> Found 11 region(s) and 14 polygon(s)

A priori I identified two polygons that are not rasterized: (ID 636)
and (ID 163)

I am sending to you the dropbox link here:
https://www.dropbox.com/sh/snrfz1p5tlaok5i/4z_OGOJ4Y-

Please let me know if that works fine for you.

Thank you vey much
Jose


2012/9/7 Roman Luštrik <roman.lustrik at gmail.com>:
> Can you provide a small, self-confined reproducible example?
>
> Cheers,
> Roman
>
>
> On Fri, Sep 7, 2012 at 1:57 PM, Jose Tanago <josetanago at gmail.com> wrote:
>>
>> Dear R-geo experts
>> I have experienced a weird problem rasterizing polygons with the
>> function "rasterize()" of Raster package.
>> Polygons that falls within the boundaries of another polygon are not
>> rasterized for an unknown reason. The output leave the inner pixels
>> (the ones overlaying the ignored polygons) without data
>>
>> The ignored polygons are completely surrounded by another polygon but
>> the outer polygon do not spatially overlay (just enclosed). All the
>> polygons were created by segmenting a raster with the same pixel size
>> and exactly equal spatial structure. So, the concerned empty pixels
>> centers are perfectly covered by the inner polygon (the one ignored),
>> while the outer polygon do not cover at all the concerned pixels.
>>
>> Do you have any idea what is wrong and how to overcome it?
>> (I have rasterized the same vector with ARGIS and those polygons
>> ignored in rasterize() are well rasterized by the ARCGIS tool)
>> thanks in advance for any hint.
>> Best
>> Jose
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
>
>
> --
> In God we trust, all others bring data.



More information about the R-sig-Geo mailing list