pfrater / arcpullr

21 stars 9 forks source link

Add get_table_layer() and get_layer_info() #13

Closed szego closed 1 year ago

szego commented 1 year ago

This PR adds two new functions, get_table_layer() and get_layer_info(). The first one is the main function of the PR, and the second one is just a helper function I think might as well be exposed.

The motivation for get_table_layer() is that I wanted to pull a "Table" from ArcGIS Online.

For example, this one: https://www.arcgis.com/home/item.html?id=0b57e0f6185a4546b8683429c42542a8 This table has no geometry, so get_spatial_layer() can't retrieve it.

Example code pulling the above table:

get_table_layer(
  "https://www.portlandmaps.com/arcgis/rest/services/Public/COP_OpenData_ARPA/MapServer/1352",
  head = TRUE
)

The other function, get_layer_info(), pulls the layer metadata from its "ArcGIS REST Services Directory" page. The code for this function is just what was already in the top of get_spatial_layer(), but since I also needed that code for get_table_layer() I separated it out into its own function.

This PR also updates some of the documentation to match the roxygen2 comments (I just ran devtools::document()).