How to make a 3D map using my own values to plot polygons at varying heights

I have a working leaflet map which breaks New York State into various block groups and color codes each block group by an index called the ADI Score. I would like to make a new map which shows the same information but does so in a 3D manner. Basically, block groups which have a high ADI would be above those with a low ADI in 3D space and the map would be viewed at an angle. Does anyone have any ideas of how I could accomplish this? This is the code I have for my normal map.

ADI_Database <- read_excel("ADI Database.xlsx")

counties <- c(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33,
              35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
              67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 
              99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123)

blocks <- block_groups(state='NY', county = c(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33,
                                    35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65,
                                    67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 
                                    99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123), cb=TRUE)
blocks$GEOID <- as.numeric(blocks$GEOID)
geo<-geo.make(state=c("NY"), county = "*", tract = "*", block.group = "*")
poverty_merged <- geo_join(blocks, ADI_Database, "GEOID", "GEOID")

poverty_merged <- poverty_merged[poverty_merged$ALAND>0,]
popup <- paste0("GEOID: ", poverty_merged$GEOID, "<br>", "ADI Score: ", round(poverty_merged$adi_natrank,2))
pal <- colorNumeric(
  palette = "RdYlGn",
  domain = ADI_Database$adi_natrank,
  reverse = TRUE)

map5<-leaflet() %>%
  addProviderTiles("CartoDB.Positron") %>%
  add
  addPolygons(data = poverty_merged, 
              fillColor = ~pal(adi_natrank), 
              color = "#b2aeae", # you need to use hex colors
              fillOpacity = 0.7, 
              weight = 1, 
              smoothFactor = 0.2,
              popup = popup) %>%
  addLegend(pal = pal, 
            values = poverty_merged$adi_natrank, 
            position = "bottomright", 
            title = "ADI Score",
            labFormat = labelFormat(suffix = "")) %>%
map5

Use rayshader or mapdeck?

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.