Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Altering arguments in add_heatmap_layer() for extremely high densities of points #34

Open
ConnorFlynn opened this issue Aug 7, 2024 · 0 comments

Comments

@ConnorFlynn
Copy link

Hi Kyle, I am really enjoying your 3 part workshop on mapgl! I am trying to utilize the package for Machine Learning predicted points of marine plastic off of windward Oahu. There is 171,000 points of predicted plastic in the bounding box. Is there something within the arguments of add_heatmap_layer() that can fix this?

My code:

knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(here)
library(mapgl)
library(sf)
library(tidycensus)

Read in Data

plastics <- read_csv(here("Plastic.csv"))

Turn Lat & Longs to point geometries

plastics_sf <- plastics %<>% 
  st_as_sf(coords = c("longitude", "latitude")) %>% 
  st_sf(crs = 4326)

Pull in Hawaii Data

hawaii <- get_acs(
  state = "HI",
  county = "Honolulu",
  geography = "tract",
  variables = "B19013_001",
  geometry = TRUE,
  year = 2020
)

Base map

hi_map <- mapboxgl(
  style = mapbox_style("light"),
  bounds = hawaii
)

output:

Screen.Recording.2024-08-07.at.12.42.32.PM.mp4

Here is an output I got with hex bins using tmap

Screen Shot 2024-07-26 at 2 03 36 PM

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant