[R-sig-Geo] using mapview to plot raster with integer values

Paulo Flores Ribeiro p@u|o@||ore@@m@|| @end|ng |rom gm@||@com
Fri Nov 12 14:43:42 CET 2021


Your first solution solved it perfectly!
Thanks,
PauloFR

Às 13:36 de 12/11/2021, Tim Salabim escreveu:
> Hi Paolo,
> I am assuming the raster is being warped/projected upon rendering. By
> default we use 'bilinear' resampling.
>
> 2 possible solutions:
>
> 1) set the method for projecting with mapview(rst, method = "ngb") for
> nearest-neighbor resampling
> 2) set mapview(rst, native.crs = TRUE) so that the raster does not get
> projected and hence not resampled (though you'll lose the background
> maps).
>
> HTH
> Tim
>
> On Fri, Nov 12, 2021 at 2:10 PM Paulo Flores Ribeiro
> <paulo.flores.mail using gmail.com> wrote:
>> I'm trying to plot a raster where pixels can only assume integer values
>> 1, 2 or 3, identifying 3 land use classes. The map does fine when
>> plotted with the base r function: plot(rastername). However, I would
>> like to use mapview (or another package for interactive maps) but it
>> creates pixels with non-integer values on transition boundaries between
>> classes (eg between classes 1 and 2 it creates a transition zone with
>> some pixels assuming non-integer values 1.2033, 1.4221, 1.7119, etc.).
>> Any way to avoid this? Thanks in advance, PauloFR
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list