Changing Leaflet map according to input without redrawing (multiple polygons)

后端 未结 3 425
走了就别回头了
走了就别回头了 2021-01-03 05:27

cannot fix my problem for MULTIPLE filters/polygons. Currently my code works, but very slow, I do not use observe(), reactive(), and LeafletProxy(), becau

3条回答
  •  情歌与酒
    2021-01-03 05:50

    Following this issue you can also create the map once and then recolor the polygons as you like.

    This involves some javascript code, including the leafletjs code and then using the setShapeStyle function. Note that both the javascript and the setShapeStyle function are shown in the issue above.

    # in ui
    ui <- fluidPage(leafletjs, ...)
    
    # in server
    observe({
      leafletProxy("map") %>%
        setShapeStyle(layerId = ~LayerIDs, fillColor=input$color)
    })
    

提交回复
热议问题