Day: July 11, 2023

Show Only ...
Maps - Photos - Videos

How to Build a Table in R with Fill Color Style Info from an ArcGIS Feature Server

The R code is fairly simple — just grab the JSON from the server and use purrr to map over the various styles. The returned tibble contains the value returned from the server, along with the label and fill color.

# this builds a dataframe of styles/colors from feature server
feature.info <- jsonlite::read_json('https://services.arcgis.com/cJ9YHowT8TU7DUyn/arcgis/rest/services/AirNowLatestContoursCombined/FeatureServer/0/?f=pjson')
style <- map(feature.info$drawingInfo$renderer$uniqueValueInfos,
    \(x) {
      tibble(value = x$value %>% as.numeric, 
             label = x$label,
             color = rgb(x$symbol$color[[1]], x$symbol$color[[2]], x$symbol$color[[3]], x$symbol$color[[4]], maxColorValue = 255))
    }
  ) %>% list_rbind()

Agricultural Area around Lake Champlain

I was noticing on the National Land Cover Dataset how relatively narrow the fertile agricultural land around Lake Champlain is on the map. You don't get very far from the lake before the hills and mountains turn the fantastic soil for growing into infertile rock and sand.