0

我已经可以绘制一个具有特定半径的圆圈的城市;我不知道如何用点标记圆的中心。我正在使用 R、Shiny 和传单。

observe({
        map$clearShapes()
        cities <- topCitiesInBounds()

    if (nrow(cities) == 0)
      return()


    map$addCircle(
      cities$Lat,
      cities$Long,
      sqrt(cities[[popCol()]]) * radiusFactor * 35 / max(5, input$map_zoom)^2, 
      row.names(cities),
      list(
        weight=1.2,
        fill=TRUE,
        color='#4A9'
      ) 
    )


  })
4

1 回答 1

0

你的例子是不可复制的,所以很难帮助你。但我假设您有一个包含 Lat ang Long 信息的 data.frame 城市。

您可以添加标记:

paramList <- dlply(cities, 2, function(x) {
        list(x[['Lat']], 
             x[['Long']], 
             x[['id']]})
        )})
lapply(paramList1, function(x) do.call(map$addMarker, unname(x)))
于 2013-12-23T21:20:38.560 回答