Skip to contents

arc_url_parse() uses httr2::url_parse() to parse URL components and combine the components with a service or content URL type and a layer number. A layer component is only included if the type is "MapServer" or "FeatureServer" and the URL includes a trailing digit. A full url value is also included in the returned list. The url, type, and layer components are not part of the httr2_url class object returned by httr2::url_parse().

Usage

arc_url_parse(url, base_url = NULL)

Arguments

url

A string containing the URL to parse.

base_url

Use this as a parent, if url is a relative URL.

Value

A named list with the following components: scheme, hostname, username, password, port, path, query, fragment, url, type, and layer.

Examples

arc_url_parse(
  "https://services.arcgisonline.com/arcgis/rest/services/USA_Topo_Maps/MapServer/0"
)
#> Warning: PCRE pattern compilation error
#> 	'lookbehind assertion is not fixed length'
#> 	at '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'
#> Error in grepl(pattern, url, perl = TRUE): invalid regular expression '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'
arc_url_parse(
  "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
)
#> Warning: PCRE pattern compilation error
#> 	'lookbehind assertion is not fixed length'
#> 	at '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'
#> Error in grepl(pattern, url, perl = TRUE): invalid regular expression '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'
arc_url_parse(
  "https://services.arcgisonline.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
)
#> Warning: PCRE pattern compilation error
#> 	'lookbehind assertion is not fixed length'
#> 	at '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'
#> Error in grepl(pattern, url, perl = TRUE): invalid regular expression '(?<=(FeatureServer|MapServer)/)[0-9]+/?$'