-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
we should be able to parse a url like this "https://www.arcgis.com/home/search.html?restrict=false&sortField=relevance&sortOrder=desc&searchTerm=pdf#content"
and be able to perform the search from this url
this is based on R-ArcGIS/arcgislayers#275
prototype
library(arcgisutils)
#>
#> Attaching package: 'arcgisutils'
#> The following object is masked from 'package:base':
#>
#> %||%
# search prototype
query <- arc_url_parse("https://www.arcgis.com/home/search.html?restrict=false&sortField=relevance&sortOrder=desc&searchTerm=pdf#content")
httr2::request(query$hostname)
#> <httr2_request>
#> GET www.arcgis.com
#> Body: empty
burl <- sprintf("%s://%s", query$scheme, query$hostname)
query$query[["q"]] <- query$query$searchTerm
query$query[["searchTerm"]] <- NULL
resp <- arc_base_req(
burl,
path = c("sharing", "rest", "search"),
query = c(compact(query$query), f = "json")
) |>
httr2::req_perform() |>
httr2::resp_body_string() |>
RcppSimdJson::fparse()
# TODO make into S7 class with pagination method
str(resp, 2)
#> List of 5
#> $ total : int 10000
#> $ start : int 1
#> $ num : int 10
#> $ nextStart: int 11
#> $ results :'data.frame': 10 obs. of 46 variables:
#> ..$ id : chr [1:10] "8f16fdeef39c46b3952002b2d85ea5de" "a6dddf4d4297436c8af697d9965f1dd7" "001a008b76b142c78cafa921e18ab174" "3db9c6eacb934b718e94c1334a4c6d1d" ...
#> ..$ owner : chr [1:10] "DavidSpriggs" "DavidSpriggs" "Saskatchewan.Government" "Altamonte_GIS" ...
#> ..$ created : num [1:10] 1.30e+12 1.31e+12 1.62e+12 1.54e+12 1.68e+12 ...
#> ..$ modified : num [1:10] 1.31e+12 1.31e+12 1.73e+12 1.72e+12 1.75e+12 ...
#> ..$ guid : logi [1:10] NA NA NA NA NA NA ...
#> ..$ name : chr [1:10] "ExportPDF web application and GP service sample_1301666703250" "Export PDF Flex widget - sync and async_1308928693047" NA "City_Boundary_Map_Landscape_11x17.pdf" ...
#> ..$ title : chr [1:10] "Export PDF web application and GP service sample" "Export PDF Flex widget - sync and async" "FRI: PDF maps" "City Boundary 11 x 17 (PDF)" ...
#> ..$ type : chr [1:10] "Web Mapping Application" "Web Mapping Application" "Web Map" "PDF" ...
#> ..$ typeKeywords :List of 10
#> ..$ description : chr [1:10] "<span><span><span><span><span><span><div>Functionality includes:</div><div><ol><li>User drawn graphics are supp"| __truncated__ "The zip file contains two widgets for use with the export pdf gp sample found here: <a href='http://www.arcgis."| __truncated__ "<p>The Saskatchewan Ministry of Environment, Forest Service Branch, has developed a forest resource inventory ("| __truncated__ "City of Altamonte Springs City Boundary Map (PDF) 11 x 17. City of Altamonte Springs is located in Seminole County, FL." ...
#> ..$ tags :List of 10
#> ..$ snippet : chr [1:10] "This sample includes a JavaScript web application and Python geoprocessing service to export the map to PDF. Ca"| __truncated__ "Flex widgets for use with export pdf Geoprocessing service" "FRI PDF maps is a web map for accessing a series of 10 x 10 km maps at 1:12,500 scale in geospatial PDF format." "City of Altamonte Springs City Boundary Map (PDF) 11 x 17" ...
#> ..$ thumbnail : chr [1:10] "thumbnail/ExportMap.jpg" "thumbnail/ExportMap.jpg" "thumbnail/thumbnail1629306565490.png" "thumbnail/thumbnail1535463002269.png" ...
#> ..$ documentation : logi [1:10] NA NA NA NA NA NA ...
#> ..$ extent :List of 10
#> ..$ categories :List of 10
#> ..$ spatialReference : chr [1:10] NA NA "" NA ...
#> ..$ accessInformation : chr [1:10] "" NA "Saskatchewan Ministry of Environment, Forest Service Branch" NA ...
#> ..$ classification : logi [1:10] NA NA NA NA NA NA ...
#> ..$ licenseInfo : chr [1:10] "<span><span><span><span><span><span><div style='background-image: initial; background-attachment: initial; back"| __truncated__ NA "<a href='https://gisappl.saskatchewan.ca/Html5Ext/Resources/GOS_Standard_Unrestricted_Use_Data_Licence_v2.0.pdf"| __truncated__ "<span style='font-family: Calibri, sans-serif; font-size: 14.6667px;'>Maps, data, and information are provided "| __truncated__ ...
#> ..$ culture : chr [1:10] "en-us" "en-us" "en-us" "en-us" ...
#> ..$ properties : logi [1:10] NA NA NA NA NA NA ...
#> ..$ advancedSettings : logi [1:10] NA NA NA NA NA NA ...
#> ..$ url : chr [1:10] "http://stlouis.esri.com/apps/exportmap/" NA "" NA ...
#> ..$ proxyFilter : logi [1:10] NA NA NA NA NA NA ...
#> ..$ access : chr [1:10] "public" "public" "public" "public" ...
#> ..$ size : int [1:10] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
#> ..$ subInfo : int [1:10] 0 0 0 0 0 0 0 0 0 0
#> ..$ appCategories :List of 10
#> ..$ industries :List of 10
#> ..$ languages :List of 10
#> ..$ largeThumbnail : logi [1:10] NA NA NA NA NA NA ...
#> ..$ banner : logi [1:10] NA NA NA NA NA NA ...
#> ..$ screenshots :List of 10
#> ..$ listed : logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ...
#> ..$ numComments : int [1:10] 34 7 0 0 0 1 0 29 2 0
#> ..$ numRatings : int [1:10] 3 1 0 0 0 0 0 3 1 0
#> ..$ avgRating : num [1:10] 4.38 3.25 0 0 0 ...
#> ..$ numViews : int [1:10] 25571 7256 5210 3954 15680 8126 6897 1657 1757 3003
#> ..$ scoreCompleteness : int [1:10] 98 78 100 93 66 80 95 100 81 96
#> ..$ groupDesignations : logi [1:10] NA NA NA NA NA NA ...
#> ..$ apiToken1ExpirationDate: int [1:10] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
#> ..$ apiToken2ExpirationDate: int [1:10] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
#> ..$ lastViewed : num [1:10] 1.75e+12 1.75e+12 1.75e+12 1.75e+12 1.75e+12 ...
#> ..$ contentStatus : chr [1:10] NA NA NA "public_authoritative" ...
#> ..$ orgId : chr [1:10] NA NA NA "OvfxyBJwA3MeWeEl" ...
Created on 2025-08-01 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels