Skip to content

Splitting large geometries in query #99

Description

@j-miszczyszyn

Hello, i find a problem with requesting date for big areas.

remotes::install_github("kadyb/rgugik")
library(rgugik)
library(sf)
library(tidyverse)

#Preparing data
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)

#Subset for smaller area
counties_geom= counties_geom[1,]

req_df = DEM_request(counties_geom)

ERROR: DEM_request(counties_geom)': maximum number of records, reduce the area

May I suggest a solution using loops ?

aoi=st_as_sf(counties_geom)
grid=st_make_grid(aoi, n=10)  
aoi=st_intersection(aoi, grid)

result_dem=data_frame()

for (i in 1:nrow(aoi)) {
  req_df = DEM_request(aoi[i, ])
  result_dem = bind_rows(result_dem, req_df)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions