16EAGLE / basemaps

A lightweight package for accessing basemaps from open sources in R 🗺️
https://jakob.schwalb-willmann.de/basemaps
GNU General Public License v3.0
57 stars 15 forks source link

Higher resolution #5

Closed dominicroye closed 2 years ago

dominicroye commented 2 years ago

Hi,

Your package is great. But I have noticed that the resolution is low with only 72 dpi which is in many cases not enough when I work with high-resolution data. Is there a way to get 300 dpi?

library(basemaps)
data(ext)
basemap_magick(ext, map_service = "carto",
               map_type = "dark_no_labels",
               map_res = 1)

Best,

Dominic

16EAGLE commented 2 years ago

Hi,

for writing downloaded map tiles as PNGs in the first place, basemaps internally uses magick::write(), maintaining the original tile dpi. After mosaicing, cropping and converting to GeoTIFF in the process, basemaps uses png::writePNG() with defaults to convert the GeoTIFF mosaic back to PNG. This apparently results in a default dpi of 72. I added the option to pass the dpi argument down to png::writePNG() form any basemap* function, e.g. like this:

basemap_magick(ext, map_service = "carto", map_type = "dark_no_labels", map_res = 1, dpi = 300)

or

basemap_png(ext, map_service = "carto", map_type = "dark_no_labels", map_res = 1, dpi = 300)

Does this solve your issue?

16EAGLE commented 2 years ago

Please reopen if this did not solve the issue.