[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-geo
Subject:    Re: [R-sig-Geo] using mapview to plot raster with integer values
From:       Paulo Flores Ribeiro <paulo.flores.mail () gmail ! com>
Date:       2021-11-12 13:43:42
Message-ID: e8545e4b-06ee-445f-7a40-9ee8cd54f426 () gmail ! com
[Download RAW message or body]

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@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@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic