paul-carteron / happign

Happign allows you to use the APIs provided by the IGN (France) to download their public data.
https://paul-carteron.github.io/happign/
GNU General Public License v3.0
27 stars 3 forks source link

Multifeatures sf object don't work #12

Open paul-carteron opened 1 year ago

paul-carteron commented 1 year ago

getapicart* don't support multi featrues objects :

library(sf)
#> Warning: le package 'sf' a été compilé avec la version R 4.3.1
#> Linking to GEOS 3.11.2, GDAL 3.6.2, PROJ 9.2.0; sf_use_s2() is TRUE
library(happign)
#> Please make sure you have an internet connection.
#> Use happign::get_last_news() to display latest geoservice news.

penmarch <- read_sf(system.file("extdata/penmarch.shp", package = "happign"))

# work
pt <- st_sample(penmarch, 1)
pt_res <- get_apicarto_cadastre(pt, "parcelle")
#> Features downloaded :
#> 1

# don't work
pts <- st_sample(penmarch, 2)
pts_res <- get_apicarto_cadastre(pts, "parcelle")
#> Features downloaded :
#> Error: Error in `req_perform()`:
#> ! HTTP 400 Bad Request.
#> Probably due to bad parameters.

Created on 2023-08-27 with reprex v2.0.2

Two solutions to tests :