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

Example not reproducible: img_width not found #68

Closed
JosiahParry opened this issue Jan 12, 2024 · 2 comments
Closed

Example not reproducible: img_width not found #68

JosiahParry opened this issue Jan 12, 2024 · 2 comments

Comments

@JosiahParry
Copy link

I suspect this is a change that came with the newest version of {sf}. The examples in get_tiles() does not work out of the box.

library(terrainr)
simulated_data <- data.frame(
  id = seq(1, 100, 1),
  lat = runif(100, 44.04905, 44.17609),
  lng = runif(100, -74.01188, -73.83493)
)

simulated_data <- sf::st_as_sf(simulated_data, coords = c("lng", "lat"))

get_tiles(simulated_data, tempfile())
Error in hit_national_map_api(current_bbox, current_box[["img_width"]],  : 
  object '"img_width"' not found
In addition: Warning messages:
1: Assuming geographic CRS.
ℹ Set 'projected' to TRUE if projected. 
2: Assuming CRS of EPSG 4326
ℹ Set bboxSR explicity to override 
@mikemahoney218
Copy link
Member

Thanks for the report! I'm unfortunately not going to be able to dig into this until Tuesday, but hopefully will be able to get a patch in after that.

@mikemahoney218
Copy link
Member

Kinda dissatisfying resolution, but the basic issue is that the API was down a few weeks ago, and now it's back up. The example no longer errors (but I reproduced it at the time and this API is known for being flaky).

This error message should be nicer, but I'm going to close out the issue for the moment because I'm not currently actively working on terrainr, so that would need to happen as part of a larger overhaul effort (which I don't have scheduled).

Josiah -- if terrainr's tests being flaky are blocking you on something, let me know and we can find a workaround.

But if you were looking for a better way to download this data, might I recommend the rsi package, which has a nicer interface, much faster download times, and is overall an upgrade from terrainr:

rsi::get_dem(
  some_aoi,
  "2010-01-01",
  "2024-01-01",
  asset_names = rsi::dem_band_mapping$planetary_computer_v1$`3dep-seamless`
)

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

2 participants