Skip to content

How to style rasters added to a leaflet map with addTileFolder? #103

@jpd-defra

Description

@jpd-defra

Hello,

I've created a set of tiles with gdal2tiles.py I can get them to display on the leaflet map with addTileFolder, but from the docs can't work out how to style the raster(s). Which options can I use to provide a colour palette?

My code looks like this:

leaflet() %>%
  addTiles() %>%
  addTileFolder(
    "/tmp/30by30_tiles_WGS84",
    tms = TRUE,
    layerId = NULL,
    group = NULL,
    attribution = NULL,
    options = leaflet::tileOptions(),
    data = leaflet::getMapData(.)
  )

And my map looks like this - the raster extent is correct.

image

If there's a bit more detail to add to the docs, I would be happy to do this in a PR.

Any help much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions