pfrater / arcpullr

21 stars 9 forks source link

simplification of polygons using get_spatial_layer() #19

Open jaymwin opened 1 month ago

jaymwin commented 1 month ago

Hello,

I noticed that there seems to be some simplification of polygon borders when downloading them using arcpullr vs. downloading them directly. For example, I downloaded the fire perimeter from the 2013 Rim fire in California using the CAL FRAP database (https://34c031f8-c9fd-4018-8c5a-4159cdff6b0d-cdn-endpoint.azureedge.net/-/media/calfire-website/what-we-do/fire-resource-assessment-program---frap/gis-data/april-2023/fire23-1gdb.zip'?rev=852b1296fecc483380284f7aad868659) and using arcpullr:

library(tidyverse)
library(sf)
library(arcpullr)

st_layers("fire23-1gdb/fire23_1.gdb")

# read in fire perimeters
fires_sf <- 
  st_read("fire23-1gdb/fire23_1.gdb", layer = 'firep23_1')

# select 2013 Rim fire from FRAP geodatabase
rim_gdb_sf <-
  fires_sf |> 
  filter(FIRE_NAME == 'RIM' & YEAR_ == 2013) |> 
  # re-project to match arcpullr output
  st_transform(4326)

# select 2013 Rim fire using arcpullr
rim_arcpullr_sf <-
  arcpullr::get_spatial_layer(
    url = 'https://services1.arcgis.com/jUJYIo9tSA7EHvfZ/ArcGIS/rest/services/California_Fire_Perimeters/FeatureServer/2',
    where = "FIRE_NAME = 'RIM' AND YEAR_ = 2013"
  )

# is there a difference?
plot(st_geometry(st_difference(rim_gdb_sf, rim_arcpullr_sf)))

# yes; how much?
st_difference(rim_gdb_sf, rim_arcpullr_sf) |> 
  st_area()

There's a 141219 [m^2] difference between the two polygons around the outer edges:

Rplot

Is that a possibility using arpcullr? If so, is there a way to control for that in the get_spatial_layer function?

Thanks,

Jay