[R-sig-Geo] resolution of openmap() raster layers

Chris Reudenbach reudenbach at uni-marburg.de
Thu Feb 25 19:42:36 CET 2016


Hi,

if you just want to map the data, mapview could be an option that among 
others avoid the pixel stretching.

require(mapview)
require(raster)
nica <- getData("GADM", country="NIC", level=0)

mapview(nica)

mapview(nica,zcol = "POP2000", color = "#FFA500", lwd= 5, alpha.regions 
= 0.4)


cheers Chris



Am 25.02.2016 um 18:49 schrieb Barry Rowlingson:
> On Thu, Feb 25, 2016 at 5:11 PM, Agustin Lobo <alobolistas at gmail.com> wrote:
>> Is there any way to download the raster layers
>> of openmap() with an increased resolution?
>> I find the quality of the labels very low,
>> or am I doing something wrong? i.e.
>>
>> require(raster)
>> require(mapmisc)
>> nica <- getData("GADM", country="NIC", level=0)
>> nicabg <- openmap(nica, path="landscape")
>> plot(nicabg)
>   Map tiles from OpenStreetMap and other map tile providers are images
> designed to be shown at a fixed resolution. When you plot them in an R
> graphics window you could be stretching them so that each pixel in the
> original maps to 1.273 pixels on your screen. So some kind of
> interpolation or nearest neighbour replacement has to be done, and
> this makes text labels look bad. Other line work will look bad too.
>
>   If you try and download more map tiles at a higher resolution then
> you'll find the labels are now way too small, because what you've
> downloaded are map tiles designed for a higher zoom level on a web
> browser. Web map browsers have a fixed set of zoom values that
> correspond to the resolution of the map tiles. With an R window, you
> are free to choose odd zoom factors that give the ugly behaviour.
>
>   If you can resize your R window exactly right then you might get
> something that looks good!
>
>   The alternative is to build a background map yourself from
> OpenStreetMap *vector* data and some code and some styling. Or use a
> map tile provider that doesn't have text labels and add them to
> selected places with R graphics commands. Lines and polygons will
> still be stretched and a bit "jaggy" but our eyes don't notice this as
> much as badly scaled text.
>
> Barry
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list