Skip to content

Instantly share code, notes, and snippets.

@elipousson
Last active February 20, 2024 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elipousson/bcc6420a086a33cdc87725a33d16d031 to your computer and use it in GitHub Desktop.
Save elipousson/bcc6420a086a33cdc87725a33d16d031 to your computer and use it in GitHub Desktop.
url <- "https://geodata.md.gov/imap/rest/services/Transportation/MD_Transit/FeatureServer/9"

meta <- esri2sf::esrimeta(url)

meta_comparison <- arcgislayers::arc_open(url) |> 
  unclass()

length(meta)
#> [1] 55
length(meta_comparison)
#> [1] 51

# Drops NULL and empty metadata values
meta[!(names(meta) %in% names(meta_comparison))]
#> $parentLayer
#> NULL
#> 
#> $editFieldsInfo
#> NULL
#> 
#> $ownershipBasedAccessControlForFeatures
#> NULL
#> 
#> $relationships
#> list()
#> 
#> $templates
#> list()

folder_url <- "https://geodata.md.gov/imap/rest/services/Transportation/"

# Gets metadata for folder
folder_meta <- esri2sf::esrimeta(folder_url)

# Errors
folder_meta_comparison <- arcgislayers::arc_open(folder_url) |> 
  unclass()
#> Error in arcgislayers::arc_open(folder_url): Cannot determine layer type

Created on 2024-02-20 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment