How to create a GreenR map

Hi, I m following the steps for create a trees map for Santiago de Chile in the link GitHub - sachit27/greenR: greenR is an R package that enables the quantification, analysis, and visualization of urban greenness within city networks. It leverages data from OpenStreetMap ( and is implemented as both an R package and a Shiny web application for user-friendly interaction. and have no results. I think I have a problem with de osm data


install.packages("remotes") # Uncomment if you do not have the 'remotes' package installed

remotes::install_github("sachit27/greenR", dependencies = TRUE)
remotes::install_github ("ropensci/osmdata")

Obtener datos de OSM para Santiago de Chile

data <- get_osm_data("City of Santiago, Chile")

Calcular el índice verde

green_index <- calculate_green_index(data, crs = 4326)

Create a static plot

map <- plot_green_index(green_index)

Create an interactive plot using Plotly

map <- plot_green_index(green_index, interactive = TRUE)

Customize the plot

map <- plot_green_index(green_index, colors = c("#FF0000", "#00FF00"), line_width = 1, line_type = "dashed")

Hi, try this

data <- get_osm_data("Santiago, Chile")
green_index <- calculate_green_index(data, 4326)

I just tried it and it works fine.

Also, if you are having issues with osmdata R package, I would suggest installing it from Github

remotes::install_github ("ropensci/osmdata")

thank you very much, @Sachit_Mahajan . One more question: ("Santiago, Chile") in this case is the Municipality of Santiago, that is inside the city of Santiago. Do you know how can I do the same for the complete city? Best wishes