Want to see the code? Click on the black boxes on the right to show/hide the code.

Highlights from my ‘conversation’ with ChatGPT. Find it in full here: https://chatgpt.com/share/6727f6b7-3140-800a-b25f-d14363bb93b5

Me: Hi ChatGPT. If you were making a map for the 30DayMapChallenge, what would you make a map of?

If I were making a map for the 30DayMapChallenge, I’d consider something creative and informative that aligns with the day’s prompt. Here are a few ideas:

Would any of these ideas fit into what you were thinking for a challenge map?

Me: They all look like great ideas, but I’m interested in what you think! Why don’t you pick one of those and produce an rmarkdown (rmd) file that uses the mapview library to create a map for your chosen subject. You’d also need to create a separate file containing the geospatial data to display - geojson would be an ideal format.

Great! I’ll go with the Urban Green Spaces idea, focusing on a well-known city like New York City. This map will highlight public parks and green spaces, using mapview in R to provide an interactive visualization. I’ll create an RMarkdown file (urban_green_spaces_nyc.Rmd) and a separate GeoJSON file (nyc_green_spaces.geojson) for the geospatial data.

Here’s how I’ll approach this:

# Let's load the sf and mapview libraries to process and view geospatial data
library(sf)
library(mapview)
library(raster)
library(terra)

# Load the GeoJSON data
green_spaces <- st_read("data/09/nyc_green_spaces.geojson")
## Reading layer `nyc_green_spaces' from data source 
##   `/home/andrew/dev/30-day-map-challenge-2024/data/09/nyc_green_spaces.geojson' 
##   using driver `GeoJSON'
## Simple feature collection with 5 features and 1 field
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: -73.9819 ymin: 40.6997 xmax: -73.8711 ymax: 40.8281
## Geodetic CRS:  WGS 84

The Map

Interactive Map of Urban Green Spaces

New York City is known for its vibrant parks and green spaces that provide essential ecological and recreational benefits to the urban population. This map visualizes the locations of key green spaces in the city.

Me: So, here’s what ChatGPT gave me. First impression is that, at its fullest extent you can’t really see the green spaces. This is something that I did ask to be addressed, but that didn’t really seem to happen.

But if you zoom in, it doesn’t really look like the data it created accurately matches the boundaries of the green spaces - it sort-of gets some of them in the right location, but as with anything LLM related - it might be correct 80% of the time, but that means you still have to check 100% of its work.

# Set custom mapview options for better visibility
mapviewOptions(
  basemaps = c("OpenStreetMap", "Esri.WorldImagery"),
  vector.palette = colorspace::sequential_hcl(1, palette = "Greens"),
  leafletWidth = "100%",
)

# Display the map with enhanced properties
mapview(
  green_spaces,
  col.regions = "green", # Color of the polygons
  alpha.regions = 0.6,   # Transparency of the fill
  lwd = 2,               # Line width
  legend = TRUE,         # Show legend
  layer.name = "NYC Green Spaces"
)

Credits

I guess OpenAI owns some of the copyright in this map?