├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── NAMESPACE ├── R ├── arcpullr-package.R ├── data.R ├── imports.R ├── plot_layers.R ├── process_raster.R ├── retrieve_layer_properties.R ├── retrieve_layers.R ├── retrieve_layers_by_geometry.R ├── sysdata.rda ├── url_objects.R └── utilities.R ├── README.Rmd ├── README.md ├── _pkgdown.yml ├── arcpullr.Rproj ├── data-raw ├── iceland_polygon.R ├── internal_data.R ├── raster_layers.R ├── sp_rel_lookups.R ├── vignette_examples.R └── wi_polygons.R ├── data ├── cook_creek_env.rda ├── cook_creek_streams.rda ├── cook_creek_ws.rda ├── example_poly.rda ├── iceland_poly.rda ├── mke_county.rda ├── mke_river.rda ├── poly_streams_contains.rda ├── poly_streams_crosses.rda ├── portage_county.rda ├── reykjanes_poly.rda ├── sp_rel_lookup.rda ├── sp_rel_valid.rda ├── sugar_creek.rda ├── sugar_creek_env.rda ├── trout_hab_project_pt.rda ├── trout_hab_project_pts.rda ├── wis_counties.rda └── wis_poly.rda ├── docs ├── 404.html ├── _config.yml ├── articles │ ├── index.html │ ├── intro_to_arcpullr.html │ ├── intro_to_arcpullr_files │ │ └── figure-html │ │ │ └── plot_county_layer-1.png │ ├── raster_layers.html │ ├── raster_layers_files │ │ └── figure-html │ │ │ ├── image_layer-1.png │ │ │ ├── map_layer-1.png │ │ │ ├── plot_image_layer-1.png │ │ │ └── plot_map_layer-1.png │ ├── spatial_queries.html │ └── spatial_queries_files │ │ ├── bootstrap-5.1.0 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ ├── bootstrap.min.css │ │ └── fonts │ │ │ └── bootstrap │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.svg │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── bs3compat-0.3.1 │ │ ├── bs3compat.js │ │ ├── tabs.js │ │ └── transition.js │ │ ├── bs3compat-0.8.0 │ │ ├── bs3compat.js │ │ ├── tabs.js │ │ └── transition.js │ │ ├── crosstalk-1.1.1 │ │ ├── css │ │ │ └── crosstalk.css │ │ └── js │ │ │ ├── crosstalk.js │ │ │ ├── crosstalk.js.map │ │ │ ├── crosstalk.min.js │ │ │ └── crosstalk.min.js.map │ │ ├── crosstalk-1.2.0 │ │ ├── css │ │ │ └── crosstalk.min.css │ │ ├── js │ │ │ ├── crosstalk.js │ │ │ ├── crosstalk.js.map │ │ │ ├── crosstalk.min.js │ │ │ └── crosstalk.min.js.map │ │ └── scss │ │ │ └── crosstalk.scss │ │ ├── crosstalk-1.2.1 │ │ ├── css │ │ │ └── crosstalk.min.css │ │ ├── js │ │ │ ├── crosstalk.js │ │ │ ├── crosstalk.js.map │ │ │ ├── crosstalk.min.js │ │ │ └── crosstalk.min.js.map │ │ └── scss │ │ │ └── crosstalk.scss │ │ ├── datatables-binding-0.19 │ │ └── datatables.js │ │ ├── datatables-binding-0.20 │ │ └── datatables.js │ │ ├── datatables-binding-0.22 │ │ └── datatables.js │ │ ├── datatables-binding-0.33 │ │ └── datatables.js │ │ ├── datatables-css-0.0.0 │ │ └── datatables-crosstalk.css │ │ ├── dt-core-1.10.20 │ │ ├── css │ │ │ ├── jquery.dataTables.extra.css │ │ │ └── jquery.dataTables.min.css │ │ └── js │ │ │ └── jquery.dataTables.min.js │ │ ├── dt-core-bootstrap4-1.10.20 │ │ ├── css │ │ │ ├── dataTables.bootstrap4.extra.css │ │ │ └── dataTables.bootstrap4.min.css │ │ └── js │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ └── jquery.dataTables.min.js │ │ ├── dt-core-bootstrap4-1.11.3 │ │ ├── css │ │ │ ├── dataTables.bootstrap4.extra.css │ │ │ └── dataTables.bootstrap4.min.css │ │ └── js │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ └── jquery.dataTables.min.js │ │ ├── dt-core-bootstrap5-1.13.6 │ │ ├── css │ │ │ └── dataTables.bootstrap5.min.css │ │ └── js │ │ │ ├── dataTables.bootstrap5.min.js │ │ │ └── jquery.dataTables.min.js │ │ ├── figure-html │ │ ├── plot_by_env-1.png │ │ ├── plot_by_line-1.png │ │ ├── plot_by_multipoint-1.png │ │ ├── plot_by_point-1.png │ │ ├── plot_by_poly-1.png │ │ ├── plot_sp_rel_contains-1.png │ │ ├── plot_sp_rel_crosses-1.png │ │ ├── unnamed-chunk-10-1.png │ │ ├── unnamed-chunk-11-1.png │ │ ├── unnamed-chunk-4-1.png │ │ ├── unnamed-chunk-5-1.png │ │ ├── unnamed-chunk-6-1.png │ │ ├── unnamed-chunk-7-1.png │ │ ├── unnamed-chunk-8-1.png │ │ └── unnamed-chunk-9-1.png │ │ ├── htmltools-fill-0.5.8.1 │ │ └── fill.css │ │ ├── htmlwidgets-1.5.4 │ │ └── htmlwidgets.js │ │ ├── htmlwidgets-1.6.4 │ │ └── htmlwidgets.js │ │ └── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map ├── authors.html ├── deps │ ├── bootstrap-5.1.0 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-5.3.1 │ │ ├── bootstrap.bundle.min.js │ │ ├── bootstrap.bundle.min.js.map │ │ └── bootstrap.min.css │ ├── bootstrap-toc-1.0.1 │ │ └── bootstrap-toc.min.js │ ├── clipboard.js-2.0.11 │ │ └── clipboard.min.js │ ├── data-deps.txt │ ├── font-awesome-6.5.2 │ │ ├── css │ │ │ ├── all.css │ │ │ ├── all.min.css │ │ │ ├── v4-shims.css │ │ │ └── v4-shims.min.css │ │ └── webfonts │ │ │ ├── fa-brands-400.ttf │ │ │ ├── fa-brands-400.woff2 │ │ │ ├── fa-regular-400.ttf │ │ │ ├── fa-regular-400.woff2 │ │ │ ├── fa-solid-900.ttf │ │ │ ├── fa-solid-900.woff2 │ │ │ ├── fa-v4compatibility.ttf │ │ │ └── fa-v4compatibility.woff2 │ ├── headroom-0.11.0 │ │ ├── headroom.min.js │ │ └── jQuery.headroom.min.js │ ├── jquery-3.6.0 │ │ ├── jquery-3.6.0.js │ │ ├── jquery-3.6.0.min.js │ │ └── jquery-3.6.0.min.map │ └── search-1.0.0 │ │ ├── autocomplete.jquery.min.js │ │ ├── fuse.min.js │ │ └── mark.min.js ├── favicon.ico ├── index.html ├── katex-auto.js ├── lightswitch.js ├── link.svg ├── logo.png ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── arcpullr-package.html │ ├── example_urls.html │ ├── figures │ │ ├── README-example-1.png │ │ └── logo.png │ ├── format_coords.html │ ├── get_geometry_type.html │ ├── get_image_layer.html │ ├── get_layer_html.html │ ├── get_layer_info.html │ ├── get_layer_legend.html │ ├── get_layers_by_spatial.html │ ├── get_map_layer.html │ ├── get_raster_layer.html │ ├── get_service_type.html │ ├── get_sf_crs.html │ ├── get_spatial_layer.html │ ├── get_table_layer.html │ ├── icons │ │ ├── globe.png │ │ ├── logo.png │ │ ├── make_hex_auto.R │ │ ├── pin.png │ │ └── white_cloud.png │ ├── index.html │ ├── match_legend_colors.html │ ├── match_raster_colors.html │ ├── plot_layer-RasterBrick-method.html │ ├── plot_layer-RasterLayer-method.html │ ├── plot_layer-RasterStack-method.html │ ├── plot_layer-SpatRaster-method.html │ ├── plot_layer-sf-method.html │ ├── plot_layer.html │ ├── raster_colors-RasterBrick-method.html │ ├── raster_colors-RasterLayer-method.html │ ├── raster_colors-RasterStack-method.html │ ├── raster_colors-SpatRaster-method.html │ ├── raster_colors.html │ ├── sf_example_polys.html │ ├── sf_example_raster.html │ ├── sf_objects.html │ ├── sp_rel_lookups.html │ ├── sp_rel_xref.html │ ├── sql_where.html │ └── valid_sp_rel.html ├── search.json └── sitemap.xml ├── icons ├── globe.png ├── make_hex_auto.R ├── pin.png └── white_cloud.png ├── inst ├── wi_aerial_imagery.png ├── wi_aerial_imagery.png.aux.xml ├── wi_landcover.png └── wi_landcover.png.aux.xml ├── man ├── arcpullr-package.Rd ├── example_urls.Rd ├── figures │ ├── README-example-1.png │ └── logo.png ├── format_coords.Rd ├── get_geometry_type.Rd ├── get_image_layer.Rd ├── get_layer_html.Rd ├── get_layer_info.Rd ├── get_layer_legend.Rd ├── get_layers_by_spatial.Rd ├── get_map_layer.Rd ├── get_raster_layer.Rd ├── get_service_type.Rd ├── get_sf_crs.Rd ├── get_spatial_layer.Rd ├── get_table_layer.Rd ├── match_legend_colors.Rd ├── plot_layer-RasterBrick-method.Rd ├── plot_layer-RasterLayer-method.Rd ├── plot_layer-RasterStack-method.Rd ├── plot_layer-SpatRaster-method.Rd ├── plot_layer-sf-method.Rd ├── plot_layer.Rd ├── raster_colors-RasterBrick-method.Rd ├── raster_colors-RasterLayer-method.Rd ├── raster_colors-RasterStack-method.Rd ├── raster_colors-SpatRaster-method.Rd ├── raster_colors.Rd ├── sf_example_polys.Rd ├── sf_objects.Rd ├── sp_rel_lookups.Rd ├── sp_rel_xref.Rd ├── sql_where.Rd └── valid_sp_rel.Rd ├── other_tests ├── .Rhistory └── sp_rel_tests │ ├── brown_cty_hyrdrants_biketrails_parks_test.R │ ├── check_tests.R │ ├── get_wi_dnr_layer_types.R │ ├── goodyear_seawall_outstanding_streams_test.R │ └── hydro_trout_hab_test.R ├── pkgdown └── favicon │ └── favicon.ico ├── tests ├── testthat.R └── testthat │ ├── test_format_spatial_coords.R │ ├── test_get_layer_by_geometry.R │ ├── test_get_spatial_layer.R │ ├── test_layer_properties.R │ ├── test_process_terra_rasters.R │ └── test_utilities.R └── vignettes ├── .gitignore ├── intro_to_arcpullr.Rmd ├── raster_layers.Rmd └── spatial_queries.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^data-raw$ 4 | ^\.travis\.yml$ 5 | ^icons$ 6 | ^todo$ 7 | ^tests/testthat/test_get_spatial_layer.R$ 8 | ^tests/testthat/test_get_layer_by_geometry.R$ 9 | ^tests/testthat/test_layer_properies.R$ 10 | ^other_tests$ 11 | ^_pkgdown\.yml$ 12 | ^docs$ 13 | ^pkgdown$ 14 | ^README\.Rmd$ 15 | ^vignettes/articles$ 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user/ 2 | *.pdf 3 | inst/doc 4 | *.ppt 5 | icons/logo.png 6 | *.pptx 7 | *.RData 8 | .Rhistory 9 | todo 10 | 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | language: R 4 | cache: packages 5 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: arcpullr 2 | Type: Package 3 | Title: Pull Data from an 'ArcGIS REST' API 4 | Version: 0.3.0 5 | Authors@R: c(person(given = "Paul", 6 | family = "Frater", 7 | role = c("aut", "cre"), 8 | email = "paul.frater@wisconsin.gov", 9 | comment = c(ORCID = "0000-0002-7237-6563")), 10 | person("Zac", "Driscoll", 11 | email = "zdriscoll@mmsd.com", 12 | role = c("aut"), 13 | comment = c(ORCID = "0000-0002-8233-0980"))) 14 | License: GPL-3 15 | Encoding: UTF-8 16 | LazyData: true 17 | Description: 18 | Functions to efficiently query 'ArcGIS REST' APIs 19 | . 20 | Both spatial and SQL queries can be used to retrieve data. 21 | Simple Feature (sf) objects are utilized to perform spatial queries. 22 | This package was neither produced nor is maintained by Esri. 23 | Depends: 24 | R (>= 4.2.0), 25 | sf (>= 0.9.7), 26 | Imports: 27 | httr (>= 1.4.1), 28 | jsonlite (>= 1.8.9), 29 | dplyr (>= 1.1.4), 30 | ggplot2 (>= 3.5.1), 31 | tidyr (>= 1.3.1), 32 | rlang (>= 1.1.4), 33 | raster (>= 3.6.30), 34 | terra (>= 1.8.15), 35 | purrr (>= 1.0.2), 36 | grDevices (>= 4.3.3), 37 | graphics (>= 4.3.3), 38 | DT (>= 0.33), 39 | methods 40 | RoxygenNote: 7.3.2 41 | Suggests: 42 | testthat (>= 3.0.1), 43 | knitr (>= 1.30), 44 | rmarkdown (>= 2.6), 45 | rvest (>= 0.3.6), 46 | xml2 (>= 1.3.2), 47 | stringr (>= 1.4.0), 48 | cowplot (>= 1.1.1), 49 | magick (>= 2.5.2) 50 | VignetteBuilder: knitr 51 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(format_coords) 4 | export(format_envelope_coords) 5 | export(format_line_coords) 6 | export(format_multipoint_coords) 7 | export(format_point_coords) 8 | export(format_polygon_coords) 9 | export(get_geometry_type) 10 | export(get_image_layer) 11 | export(get_layer_by_envelope) 12 | export(get_layer_by_line) 13 | export(get_layer_by_multipoint) 14 | export(get_layer_by_point) 15 | export(get_layer_by_poly) 16 | export(get_layer_by_spatial) 17 | export(get_layer_info) 18 | export(get_layer_legend) 19 | export(get_map_layer) 20 | export(get_service_type) 21 | export(get_sf_crs) 22 | export(get_spatial_layer) 23 | export(get_table_layer) 24 | export(match_legend_colors) 25 | export(plot_layer) 26 | export(plot_layer.sf) 27 | export(raster_colors) 28 | export(reykjanes_lava_flow_url) 29 | export(sf_box) 30 | export(sf_line) 31 | export(sf_point) 32 | export(sf_points) 33 | export(sf_polygon) 34 | export(sp_rel_xref) 35 | export(sql_where) 36 | export(valid_sp_rel) 37 | export(wi_hydro_url) 38 | export(wi_landcover_url) 39 | export(wi_leaf_off_url) 40 | exportMethods(plot_layer) 41 | exportMethods(raster_colors) 42 | import(purrr) 43 | import(sf) 44 | import(terra) 45 | importFrom(DT,datatable) 46 | importFrom(grDevices,col2rgb) 47 | importFrom(rlang,.data) 48 | importFrom(stats,setNames) 49 | importFrom(utils,download.file) 50 | -------------------------------------------------------------------------------- /R/arcpullr-package.R: -------------------------------------------------------------------------------- 1 | #' arcpullr 2 | #' 3 | #' A package for pulling spatial data from an ArcGIS REST API 4 | #' 5 | #' \if{html}{\figure{logo.png}{options: alt='logo' width='15\%'}} 6 | #' \if{latex}{\figure{logo.png}{options: width=0.5in}} 7 | #' The role of the arcpullr package is simple...to pull spatial data from an 8 | #' ArcGIS REST API. These APIs are housed by various different agencies, 9 | #' organizations, entitites, etc., but allow a consistent format for storing and 10 | #' retrieving spatial data 11 | #' 12 | #' @section \code{\link{get_spatial_layer}}: 13 | #' This function makes up the core of the package. It allows users to pull 14 | #' spatial data given a URL of an ArcGIS REST API. There are many additional 15 | #' query parameters that can (and probably should) be added; however, we've 16 | #' simplified many of these out for you with the functions below. 17 | #' 18 | #' @section \code{\link{get_layer_by_spatial}} family of functions: 19 | #' These functions allow you to pull layers using a spatial query. The abstract 20 | #' syntax is wrapped into the functions, so all you have to do is pass these 21 | #' functions an sf object of the spatial area, line, or point you want to query 22 | #' by. These functions include get_layer_by_poly, get_layer_by_point, 23 | #' get_layer_by_line, get_layer_by_multipoint, and get_layer_by_envelope. It 24 | #' should be fairly obvious what type of spatial layer each function takes with 25 | #' the exception of get_layer_by_envelope except that it isn't particularly 26 | #' useful for a single point. 27 | #' 28 | #' @section \code{\link{get_image_layer}}: 29 | #' This is one of the core functions of the package. It retrieves image service 30 | #' layers from an ArcGIS REST API designated by the URL 31 | #' 32 | #' @section \code{\link{get_map_layer}}: 33 | #' This is one of the core functions of the package. It retrieves map service 34 | #' layers from an ArcGIS REST API designated by the URL 35 | #' 36 | #' @section Helper functions: 37 | #' There are a few utility functions to help you along the way. The first is 38 | #' \code{\link{plot_layer}}, which is a useful way to plot the spatial layer 39 | #' you've tried to pull just to make sure it works. If you want fancier maps 40 | #' you'd be better served with ggplot2 or tmaps, though. 41 | #' 42 | #' Other helpers include the \code{\link{sf_objects}} functions, which allow 43 | #' you to easily create sf points, lines, and polygons with a few coordinates. 44 | #' 45 | #' Lastly, there is a \code{\link{sql_where}} function to help aid in building 46 | #' more complex SQL WHERE clauses used to query by the where argument in the 47 | #' retrieval functions above. 48 | #' 49 | #' @aliases arcpullr 50 | #' 51 | #' @keywords internal 52 | "_PACKAGE" 53 | 54 | 55 | #' @import sf 56 | NULL 57 | 58 | #' @import purrr 59 | NULL 60 | 61 | #' @import terra 62 | NULL 63 | 64 | #' @importFrom rlang .data 65 | NULL 66 | 67 | #' @importFrom DT datatable 68 | NULL 69 | 70 | #' @importFrom utils download.file 71 | NULL 72 | 73 | #' @importFrom grDevices col2rgb 74 | NULL 75 | 76 | #' @importFrom stats setNames 77 | NULL 78 | 79 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' Various example sf polygons 2 | #' 3 | #' These are sf polygons that are used for examples throughout the package 4 | #' 5 | #' @format An object of class sf and data.frame: 6 | #' @name sf_example_polys 7 | #' 8 | #' @source ggplot2's \code{\link[ggplot2]{map_data}} and \href{https://dnrmaps.wi.gov/arcgis/rest/services}{Wisconsin DNR ArcGIS REST API} 9 | "iceland_poly" 10 | 11 | #' @rdname sf_example_polys 12 | "mke_county" 13 | 14 | #' @rdname sf_example_polys 15 | "portage_county" 16 | 17 | #' @rdname sf_example_polys 18 | "reykjanes_poly" 19 | 20 | #' @rdname sf_example_polys 21 | "wis_counties" 22 | 23 | #' @rdname sf_example_polys 24 | "wis_poly" 25 | 26 | #' @rdname sf_example_polys 27 | "cook_creek_ws" 28 | 29 | #' @rdname sf_example_polys 30 | "cook_creek_streams" 31 | 32 | #' @rdname sf_example_polys 33 | "cook_creek_env" 34 | 35 | #' @rdname sf_example_polys 36 | "mke_river" 37 | 38 | #' @rdname sf_example_polys 39 | "poly_streams_contains" 40 | 41 | #' @rdname sf_example_polys 42 | "poly_streams_crosses" 43 | 44 | #' @rdname sf_example_polys 45 | "sugar_creek" 46 | 47 | #' @rdname sf_example_polys 48 | "sugar_creek_env" 49 | 50 | #' @rdname sf_example_polys 51 | "trout_hab_project_pt" 52 | 53 | #' @rdname sf_example_polys 54 | "trout_hab_project_pts" 55 | 56 | #' @rdname sf_example_polys 57 | "example_poly" 58 | 59 | #' @rdname sf_example_polys 60 | "trout_hab_project_pts" 61 | 62 | 63 | # Various example raster objects 64 | # 65 | # These are raster objects that are used for examples throughout the package 66 | # 67 | # @name sf_example_raster 68 | # 69 | # @source \href{https://dnrmaps.wi.gov/arcgis_image/rest/services}{Wisconsin DNR ArcGIS Image Server} 70 | # "wi_landcover" 71 | 72 | 73 | # @rdname sf_example_raster 74 | # "wi_aerial_imagery" 75 | 76 | 77 | #' Various URLs used in examples 78 | #' 79 | #' These are URLs that are used for examples throughout the package 80 | #' 81 | #' @format Character strings of URLs 82 | #' @name example_urls 83 | "reykjanes_lava_flow_url" 84 | 85 | #' @rdname example_urls 86 | #' @export 87 | "wi_hydro_url" 88 | 89 | #' @rdname example_urls 90 | #' @export 91 | "wi_landcover_url" 92 | 93 | #' @rdname example_urls 94 | #' @export 95 | "wi_leaf_off_url" 96 | 97 | 98 | #' Spatial relationship descriptor and lookup tables 99 | #' 100 | #' 101 | #' These data.frames are used to lookup and explain which spatial relation types 102 | #' go with different spatial queries. 103 | #' 104 | #' sp_rel_lookup explains the various different types of spatial relationships 105 | #' available through ArcGIS REST APIs. sp_rel_valid shows which spatial 106 | #' relationships are valid with different geometry types being queried and 107 | #' used to do spatial queries 108 | #' 109 | #' 110 | #' @format \code{sp_rel_valid} is a data.frame with 105 rows and 3 variables as 111 | #' follows: 112 | #' \describe{ 113 | #' \item{feature_class}{A feature class to be queried} 114 | #' \item{query_feature_class}{The feature class used to do a spatial query} 115 | #' \item{sp_rel}{ 116 | #' The spatial relationships that are valid for the feature class and 117 | #' query_feature_class combination 118 | #' } 119 | #' } 120 | #' @name sp_rel_lookups 121 | #' 122 | #' @source sp_rel_valid--Independent tests done specifically by and for arcpullr 123 | "sp_rel_valid" 124 | 125 | #' @rdname sp_rel_lookups 126 | #' @format \code{sp_rel_lookup} is a data.frame with 9 rows and 2 variables as 127 | #' follows: 128 | #' \describe{ 129 | #' \item{sp_rel}{The spatial relationship being described} 130 | #' \item{description}{A description of the sp_rel} 131 | #' } 132 | #' @source sp_rel_lookup -- 133 | #' \url{https://help.arcgis.com/en/webapi/wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.SpatialRelationship.html 134 | #' } 135 | "sp_rel_lookup" 136 | -------------------------------------------------------------------------------- /R/imports.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/R/imports.R -------------------------------------------------------------------------------- /R/retrieve_layer_properties.R: -------------------------------------------------------------------------------- 1 | #' Returns a legend for a raster layer 2 | #' 3 | #' Raster layers are accompanied with legends to identify what the colors mean. 4 | #' This function retrieves those legend values and returns them as a data.frame 5 | #' with the associated RGB color values. This will likely be most useful for 6 | #' plotting and analysis of map layers. 7 | #' 8 | #' @param url A URL to a Map or Image Service layer 9 | #' 10 | #' @export 11 | #' @return A data.frame with two columns (color, values) and the number of 12 | #' rows equal to the number of values in a layer 13 | #' 14 | #' 15 | #' @examples 16 | #' \dontrun{ 17 | #' get_layer_legend(wi_landcover_url) 18 | #' } 19 | get_layer_legend <- function(url) { 20 | if (!("magick" %in% rownames(utils::installed.packages()))) { 21 | stop("This function requires the magick package.\n", 22 | "Please install by running the following:\n", 23 | " install.packages('magick')") 24 | } 25 | legend_url <- paste0(url, "/legend") 26 | legend_html <- 27 | legend_url |> 28 | xml2::read_html() |> 29 | rvest::html_nodes("table") |> 30 | rvest::html_nodes("tr") 31 | legend_src <- 32 | legend_html |> 33 | rvest::html_nodes("img") |> 34 | rvest::html_attr("src") 35 | legend_colors <- lapply(legend_src, function(x) { 36 | out <- 37 | stringr::str_replace(x, "^data.*base64,", "") |> 38 | jsonlite::base64_dec() |> 39 | magick::image_read() |> 40 | magick::image_data(channels = "rgb") |> 41 | as.integer() |> 42 | terra::rast() |> 43 | raster_colors() |> 44 | dplyr::count(.data$color) |> 45 | dplyr::arrange(dplyr::desc(.data$n)) |> 46 | dplyr::slice(1) 47 | return(out$color) 48 | }) |> unlist() 49 | legend_values <- 50 | legend_html |> 51 | rvest::html_nodes("img") |> 52 | rvest::html_attr("alt") 53 | out <- data.frame(color = legend_colors, value = legend_values) 54 | return(structure(out, class = c("raster_legend", "data.frame"))) 55 | } 56 | -------------------------------------------------------------------------------- /R/retrieve_layers_by_geometry.R: -------------------------------------------------------------------------------- 1 | #' Retrieve ArcGIS REST API spatial layer by spatial query 2 | #' 3 | #' These functions are wrappers around \code{\link{get_spatial_layer}} that are 4 | #' specialized for querying by a spatial layer. They will make a POST request 5 | #' to the query URL which returns data (if available) based on the appropriate 6 | #' spatial feature (\code{geometry}) and relationship (\code{sp_rel}). 7 | #' 8 | #' @param url A character string of the url for the layer to pull 9 | #' @param geometry An \code{sf} object used for the spatial query 10 | #' @param geom_type A character of the geometry type to be used. This param is 11 | #' automatically specified in all \code{get_layer_by_*} functions except 12 | #' \code{get_spatial_layer} 13 | #' @param sp_ref The spatial reference value 14 | #' @param sp_rel Character. The type of relationship to query by. Possible 15 | #' options include "intersects", "contains", and "crosses" 16 | #' @param ... Additional arguements to pass to \code{\link{get_spatial_layer}} 17 | #' 18 | #' @return An object of class "sf" of the appropriate layer 19 | #' @export 20 | #' 21 | #' @name get_layers_by_spatial 22 | #' 23 | #' @examples 24 | #' \dontrun{ 25 | #' mke_waters <- get_layer_by_poly(wi_hydro_url, mke_county) 26 | #' } 27 | get_layer_by_poly <- function(url, geometry, 28 | sp_rel = "contains", 29 | ...) { 30 | if (!all(sf::st_is_valid(geometry))) { 31 | cat( 32 | "The polygon you provided is not valid. Would you like to make it valid ", 33 | "now?\n1: Yes\n2: No" 34 | ) 35 | make_me_valid <- readline("Selection: ") 36 | if (tolower(make_me_valid) %in% c("1", "y", "yes")) { 37 | geometry <- sf::st_make_valid(geometry) 38 | warning( 39 | "Initially invalid geometries may not return the same results as ", 40 | "geometries that are created validly. ", 41 | "You may want to create your geometry correctly first." 42 | ) 43 | } 44 | } 45 | return(get_layer_by_spatial(url = url, 46 | geometry = format_polygon_coords(geometry), 47 | geom_type = "esriGeometryPolygon", 48 | sp_ref = get_sf_crs(geometry), 49 | sp_rel = sp_rel_xref(sp_rel), ...)) 50 | } 51 | 52 | #' @name get_layers_by_spatial 53 | #' @export 54 | get_layer_by_line <- function(url, geometry, 55 | sp_rel = "intersects", ...) { 56 | return(get_layer_by_spatial(url = url, 57 | geometry = format_line_coords(geometry), 58 | geom_type = "esriGeometryPolyline", 59 | sp_ref = get_sf_crs(geometry), 60 | sp_rel = sp_rel_xref(sp_rel), ...)) 61 | } 62 | 63 | #' @name get_layers_by_spatial 64 | #' @export 65 | get_layer_by_point <- function(url, geometry, 66 | sp_rel = "intersects", ...) { 67 | npts <- nrow(sf::st_coordinates(geometry)) 68 | if (npts == 1) { 69 | format_geom <- format_point_coords(geometry) 70 | geom_type <- "esriGeometryPoint" 71 | } else { 72 | format_geom <- format_multipoint_coords(geometry) 73 | geom_type <- "esriGeometryMultipoint" 74 | } 75 | return(get_layer_by_spatial(url = url, 76 | geometry = format_geom, 77 | geom_type = geom_type, 78 | sp_ref = get_sf_crs(geometry), 79 | sp_rel = sp_rel_xref(sp_rel), ...)) 80 | } 81 | 82 | #' @name get_layers_by_spatial 83 | #' @export 84 | get_layer_by_multipoint <- function(url, geometry, 85 | sp_rel = "intersects", ...) { 86 | warning( 87 | "get_layer_by_multipoint has been generalized to get_layer_by_point.\n", 88 | "Please use that function instead as this one is being deprecated." 89 | ) 90 | return(get_layer_by_spatial(url = url, 91 | geometry = format_multipoint_coords(geometry), 92 | geom_type = "esriGeometryMultipoint", 93 | sp_ref = get_sf_crs(geometry), 94 | sp_rel = sp_rel_xref(sp_rel), ...)) 95 | } 96 | 97 | #' @name get_layers_by_spatial 98 | #' @export 99 | get_layer_by_envelope <- function(url, geometry, 100 | sp_rel = "intersects", ...) { 101 | return(get_layer_by_spatial(url = url, 102 | geometry = format_envelope_coords(geometry), 103 | geom_type = "esriGeometryEnvelope", 104 | sp_ref = get_sf_crs(geometry), 105 | sp_rel = sp_rel_xref(sp_rel), ...)) 106 | } 107 | 108 | #' @name get_layers_by_spatial 109 | #' @export 110 | get_layer_by_spatial <- function(url, geometry, geom_type, sp_ref = NULL, 111 | sp_rel = "intersects", ...) { 112 | if (is.null(sp_ref)) { 113 | if ("sf" %in% class(geometry)) { 114 | sp_ref <- get_sf_crs(geometry) 115 | } else { 116 | stop("You must specify a CRS number in sp_ref ", 117 | "or pass an sf object for a geometry.") 118 | } 119 | } 120 | return(get_spatial_layer(url = url, geometry = geometry, 121 | geometryType = geom_type, inSR = sp_ref, 122 | spatialRel = sp_rel, ...)) 123 | } 124 | 125 | -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/R/sysdata.rda -------------------------------------------------------------------------------- /R/url_objects.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | reykjanes_lava_flow_url <- paste0( 3 | "https://arcgisserver.isor.is:6443/arcgis/rest/services/", 4 | "vi/uttekt_eldstodva_allt_2/MapServer/5" 5 | ) 6 | 7 | #' @export 8 | wi_landcover_url <- paste0( 9 | "https://dnrmaps.wi.gov/arcgis_image/rest/services/", 10 | "DW_Land_Cover/EN_Land_Cover2_Lev2/MapServer" 11 | ) 12 | 13 | #' @export 14 | wi_leaf_off_url <- paste0( 15 | "https://dnrmaps.wi.gov/arcgis_image/rest/services/", 16 | "DW_Imagery/EN_Image_Basemap_Latest_Leaf_Off/ImageServer" 17 | ) 18 | 19 | #' @export 20 | wi_hydro_url <- paste0( 21 | "https://dnrmaps.wi.gov/arcgis/rest/services/", 22 | "WT_SWDV/WT_Inland_Water_Resources_WTM_Ext_v2/MapServer/2" 23 | ) 24 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | 16 | # arcpullr 17 | 18 | 19 | 20 | 21 | 22 | The `arcpullr` package provides functions for pulling spatial data from an ArcGIS REST API and formatting those layers into either `sf` or `Raster*` objects (depending on the layer being requested). These functions provide the basis for retrieving spatial data housed in an ArcGIS REST API using either spatial or relational queries. The output from these querying functions is intended to work seamlessly with other spatial packages already implemented and established in R. This package was neither produced nor is maintained by Esri. 23 | 24 | 25 | ## Installation 26 | 27 | ``` {r install,eval = FALSE} 28 | #Install directly from CRAN: 29 | install.packages("arcpullr") 30 | 31 | # Or the development version from GitHub: 32 | # install.packages("devtools") 33 | devtools::install_github("pfrater/arcpullr") 34 | ``` 35 | 36 | ## Example 37 | 38 | The below example demonstrates how to use `arcpullr` 39 | to query the [Wisconsin Department of Natural Resources County 40 | ArcGIS Rest API](https://dnrmaps.wi.gov/arcgis/rest/services//DW_Map_Dynamic/EN_Basic_Basemap_WTM_Ext_Dynamic_L16/MapServer/3) 41 | 42 | ```{r example, warning=FALSE} 43 | library(arcpullr) 44 | wdnr_server <-"https://dnrmaps.wi.gov/arcgis/rest/services/" 45 | counties <- "DW_Map_Dynamic/EN_Basic_Basemap_WTM_Ext_Dynamic_L16/MapServer/3" 46 | wi_counties_url <- paste(wdnr_server,counties, sep ="/") 47 | wi_counties <- get_spatial_layer(wi_counties_url) 48 | 49 | ggplot2::ggplot() + 50 | ggplot2::geom_sf(data = wi_counties) 51 | ``` 52 | 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # arcpullr 5 | 6 | 7 | 8 | 9 | The `arcpullr` package provides functions for pulling spatial data from 10 | an ArcGIS REST API and formatting those layers into either `sf` or 11 | `Raster*` objects (depending on the layer being requested). These 12 | functions provide the basis for retrieving spatial data housed in an 13 | ArcGIS REST API using either spatial or relational queries. The output 14 | from these querying functions is intended to work seamlessly with other 15 | spatial packages already implemented and established in R. This package 16 | was neither produced nor is maintained by Esri. 17 | 18 | ## Installation 19 | 20 | ``` r 21 | #Install directly from CRAN: 22 | install.packages("arcpullr") 23 | 24 | # Or the development version from GitHub: 25 | # install.packages("devtools") 26 | devtools::install_github("pfrater/arcpullr") 27 | ``` 28 | 29 | ## Example 30 | 31 | The below example demonstrates how to use `arcpullr` to query the 32 | [Wisconsin Department of Natural Resources County ArcGIS Rest 33 | API](https://dnrmaps.wi.gov/arcgis/rest/services//DW_Map_Dynamic/EN_Basic_Basemap_WTM_Ext_Dynamic_L16/MapServer/3) 34 | 35 | ``` r 36 | library(arcpullr) 37 | #> Loading required package: sf 38 | #> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE 39 | wdnr_server <-"https://dnrmaps.wi.gov/arcgis/rest/services/" 40 | counties <- "DW_Map_Dynamic/EN_Basic_Basemap_WTM_Ext_Dynamic_L16/MapServer/3" 41 | wi_counties_url <- paste(wdnr_server,counties,sep ="/") 42 | wi_counties <- get_spatial_layer(wi_counties_url) 43 | 44 | ggplot2::ggplot() + 45 | ggplot2::geom_sf(data = wi_counties) 46 | ``` 47 | 48 | 49 | -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: ~ 2 | template: 3 | bootstrap: 5 4 | 5 | -------------------------------------------------------------------------------- /arcpullr.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | -------------------------------------------------------------------------------- /data-raw/iceland_polygon.R: -------------------------------------------------------------------------------- 1 | iceland_poly <- 2 | ggplot2::map_data("world", region = "iceland") %>% 3 | dplyr::rename(x = long, y = lat) %>% 4 | dplyr::select(x, y) %>% 5 | as.list() 6 | iceland_poly$range <- c(min(iceland_poly$x), max(iceland_poly$x), 7 | min(iceland_poly$y), max(iceland_poly$y)) 8 | iceland_poly$names <- "iceland" 9 | class(iceland_poly) <- c("map", "list") 10 | iceland_poly <- sf::st_as_sf(iceland_poly) 11 | 12 | # filter to just Reykjanes 13 | bbox <- sf_polygon(c(-25, 64.5), c(-21, 64.5), c(-21, 63), 14 | c(-25, 63), c(-25, 64.5)) 15 | reykjanes_poly <- sf::st_intersection(iceland_poly, bbox) 16 | 17 | usethis::use_data(iceland_poly, reykjanes_poly, overwrite = TRUE) 18 | -------------------------------------------------------------------------------- /data-raw/internal_data.R: -------------------------------------------------------------------------------- 1 | sp_rel_ref <- 2 | data.frame(sp.rel.ref = unique(sp_rel_lookup$sp_rel)) %>% 3 | dplyr::mutate(sp.xref = tolower(str_remove(sp.rel.ref, "esriSpatialRel"))) 4 | 5 | usethis::use_data(sp_rel_ref, internal = TRUE, overwrite = TRUE) 6 | -------------------------------------------------------------------------------- /data-raw/raster_layers.R: -------------------------------------------------------------------------------- 1 | ## code to prepare `raster_layers` dataset goes here 2 | # WDNR Server 3 | image_server <- "https://dnrmaps.wi.gov/arcgis_image/rest/services/" 4 | 5 | # WI Landcover Type URL 6 | landcover_path <- "DW_Land_Cover/EN_Land_Cover2_Lev2/MapServer" 7 | landcover_url <- paste0(image_server, landcover_path) 8 | 9 | wi_landcover <- get_map_layer(landcover_url, wis_poly) 10 | 11 | wi_leaf_off_path <- "DW_Imagery/EN_Image_Basemap_Latest_Leaf_Off/ImageServer" 12 | wi_aerial_imagery_url <- paste0(image_server, wi_leaf_off_path) 13 | wi_aerial_imagery <- get_image_layer(wi_aerial_imagery_url, wis_poly) 14 | 15 | terra::writeRaster( 16 | wi_landcover, 17 | here::here("inst/wi_landcover.png"), 18 | overwrite = TRUE 19 | ) 20 | terra::writeRaster( 21 | wi_aerial_imagery, 22 | here::here("inst/wi_aerial_imagery.png"), 23 | overwrite = TRUE 24 | ) 25 | # usethis::use_data(wi_landcover, wi_aerial_imagery, overwrite = TRUE) 26 | -------------------------------------------------------------------------------- /data-raw/sp_rel_lookups.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | 3 | 4 | # creating an sp_rel_valid table based on our tests of what works--------------- 5 | test_result_names <- c( 6 | "hydro_trout_hab", 7 | "goodyear_seawall_outstanding_streams", 8 | "brown_cty_hydrants_biketrails_parks" 9 | ) 10 | 11 | test_results <- lapply(test_result_names, function(x) { 12 | load(paste0("other_tests/sp_rel_tests/", x, "_test_results.RData")) 13 | out <- 14 | test_results %>% 15 | select(fc_type, query_fc_type, sp_rel, valid) 16 | names(out)[4] <- paste(x, "valid", sep = "_") 17 | return(out) 18 | }) 19 | 20 | all_results <- 21 | Reduce(function(...) { 22 | left_join(..., by = c("fc_type", "query_fc_type", "sp_rel")) 23 | }, test_results) 24 | 25 | check_results <- 26 | all_results %>% 27 | mutate(test_sum = select(., ends_with("valid")) %>% rowSums()) %>% 28 | filter(test_sum %in% c(0, 3)) 29 | 30 | sp_rel_valid <- 31 | check_results %>% 32 | filter(test_sum == 3) %>% 33 | rbind(filter(., fc_type == "point") %>% mutate(fc_type = "multipoint")) %>% 34 | select(fc_type, query_fc_type, sp_rel) %>% 35 | arrange(fc_type, query_fc_type, sp_rel) %>% 36 | rename(feature_class = fc_type, 37 | query_feature_class = query_fc_type) 38 | 39 | 40 | # create a lookup table of the descriptions of each sp_rel---------------------- 41 | url <- paste( 42 | "https://help.arcgis.com/en/webapi/wpf/apiref/", 43 | "ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.SpatialRelationship.html", 44 | sep = "") 45 | 46 | sp_rel_lookup <- 47 | xml2::read_html(url) %>% 48 | rvest::html_nodes("table")%>% 49 | magrittr::extract2(6)%>% 50 | rvest::html_table() %>% 51 | dplyr::rename(sp_rel = Member, description = Description) 52 | 53 | usethis::use_data(sp_rel_lookup, sp_rel_valid, overwrite = TRUE) 54 | -------------------------------------------------------------------------------- /data-raw/vignette_examples.R: -------------------------------------------------------------------------------- 1 | 2 | # layers to pull for spatial_query vignette examples 3 | # 1. milwaukee river 4 | # 2. trout hab projects - don't really love advertising these to the public 5 | # -what would be a better point layer to query by? 6 | # 3. brown county rivers 7 | 8 | 9 | #WDNR Server 10 | server <- "https://dnrmaps.wi.gov/arcgis/rest/services/" 11 | server2 <- "https://dnrmaps.wi.gov/arcgis2/rest/services/" 12 | 13 | #River URL 14 | layer <- "TS_AGOL_STAGING_SERVICES/EN_AGOL_STAGING_SurfaceWater_WTM/MapServer/2" 15 | river_url <- paste0(server2,layer) 16 | 17 | #Country URL 18 | layer <- "DW_Map_Dynamic/EN_Basic_Basemap_WTM_Ext_Dynamic_L16/MapServer/3" 19 | county_url <- paste0(server,layer) 20 | 21 | # SNA URL 22 | layer <- "LF_DML/ER_DNR_NA_StateNaturalAreas_WTM_Ext/MapServer/5" 23 | sna_url <- paste0(server, layer) 24 | 25 | #Trout URL 26 | layer <- "FM_Trout/FM_TROUT_HAB_SITES_WTM_Ext/MapServer/0" 27 | trout_url <- paste0(server,layer) 28 | 29 | #Watershed URL 30 | layer <- "WT_SWDV/WT_Inland_Water_Resources_WTM_Ext_v2/MapServer/5" 31 | watershed_url <- paste0(server,layer) 32 | 33 | # 1 - milwaukee river 34 | mke_river <- get_spatial_layer( 35 | river_url, 36 | where = sql_where(RIVER_SYS_NAME = "Milwaukee River") 37 | ) %>% 38 | dplyr::group_by(RIVER_SYS_NAME, ROW_NAME, RIVER_SYS_WBIC, STREAM_ORDER) %>% 39 | dplyr::summarize(geoms = sf::st_combine(geoms), .groups = "drop") 40 | 41 | # 2. pull some different trout habitat projects 42 | trout_hab_project_pts <- get_spatial_layer( 43 | trout_url, 44 | # where = "FISCALYEAR = 2018" 45 | where = "WATERBODYNAMECOMBINED = 'Sugar Creek' and FISCALYEAR = 2017" 46 | ) 47 | trout_hab_project_pt <- trout_hab_project_pts[1, ] 48 | sugar_creek <- get_layer_by_point(river_url, trout_hab_projects_pts) 49 | sugar_creek_env <- get_layer_by_envelope(river_url, sugar_creek) 50 | 51 | 52 | # use coon creek as example for polygon and envelope 53 | cook_creek_ws <- wdnr.gis::get_watershed_layer( 54 | watershed_name = "Cook Creek" 55 | ) 56 | cook_creek_streams <- 57 | get_layer_by_poly(river_url, cook_creek_ws) %>% 58 | dplyr::group_by(ROW_NAME, STREAM_ORDER) %>% 59 | dplyr::summarize(geoms = sf::st_combine(geoms), .groups = "drop") 60 | cook_creek_env <- 61 | get_layer_by_envelope(river_url, cook_creek_ws) %>% 62 | dplyr::group_by(ROW_NAME, STREAM_ORDER) %>% 63 | dplyr::summarize(geoms = sf::st_combine(geoms), .groups = "drop") 64 | 65 | # some example data for contains vs. crosses sp_rel 66 | example_poly <- sf_polygon( 67 | c(-90.62, 43.76), 68 | c(-90.62, 43.77), 69 | c(-90.61, 43.77), 70 | c(-90.61, 43.76), 71 | c(-90.62, 43.76) 72 | ) 73 | poly_streams_contains <- get_layer_by_poly(river_url, example_poly) 74 | poly_streams_crosses <- get_layer_by_poly( 75 | river_url, 76 | example_poly, 77 | sp_rel = "esriSpatialRelCrosses" 78 | ) 79 | 80 | 81 | usethis::use_data( 82 | mke_river, 83 | trout_hab_project_pt, 84 | trout_hab_project_pts, 85 | sugar_creek, 86 | sugar_creek_env, 87 | cook_creek_streams, 88 | cook_creek_ws, 89 | cook_creek_env, 90 | example_poly, 91 | poly_streams_contains, 92 | poly_streams_crosses, 93 | overwrite = TRUE 94 | ) 95 | 96 | -------------------------------------------------------------------------------- /data-raw/wi_polygons.R: -------------------------------------------------------------------------------- 1 | wis_poly <- 2 | maps::map("state", regions = "wisconsin", 3 | plot = FALSE, fill = TRUE, bg = NA) %>% 4 | sf::st_as_sf() 5 | wis_counties <- 6 | maps::map("county", regions = "wisconsin", 7 | plot = FALSE, fill = TRUE, bg = NA) %>% 8 | sf::st_as_sf() %>% 9 | tidyr::separate(ID, into = c("state", "county"), sep = ",") 10 | mke_county <- 11 | wi_counties %>% 12 | dplyr::filter(county == "milwaukee") 13 | portage_county <- 14 | wi_counties %>% 15 | dplyr::filter(county == "portage") 16 | 17 | 18 | usethis::use_data(wis_poly, wis_counties, mke_county, portage_county, 19 | overwrite = TRUE) 20 | -------------------------------------------------------------------------------- /data/cook_creek_env.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/cook_creek_env.rda -------------------------------------------------------------------------------- /data/cook_creek_streams.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/cook_creek_streams.rda -------------------------------------------------------------------------------- /data/cook_creek_ws.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/cook_creek_ws.rda -------------------------------------------------------------------------------- /data/example_poly.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/example_poly.rda -------------------------------------------------------------------------------- /data/iceland_poly.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/iceland_poly.rda -------------------------------------------------------------------------------- /data/mke_county.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/mke_county.rda -------------------------------------------------------------------------------- /data/mke_river.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/mke_river.rda -------------------------------------------------------------------------------- /data/poly_streams_contains.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/poly_streams_contains.rda -------------------------------------------------------------------------------- /data/poly_streams_crosses.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/poly_streams_crosses.rda -------------------------------------------------------------------------------- /data/portage_county.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/portage_county.rda -------------------------------------------------------------------------------- /data/reykjanes_poly.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/reykjanes_poly.rda -------------------------------------------------------------------------------- /data/sp_rel_lookup.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/sp_rel_lookup.rda -------------------------------------------------------------------------------- /data/sp_rel_valid.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/sp_rel_valid.rda -------------------------------------------------------------------------------- /data/sugar_creek.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/sugar_creek.rda -------------------------------------------------------------------------------- /data/sugar_creek_env.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/sugar_creek_env.rda -------------------------------------------------------------------------------- /data/trout_hab_project_pt.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/trout_hab_project_pt.rda -------------------------------------------------------------------------------- /data/trout_hab_project_pts.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/trout_hab_project_pts.rda -------------------------------------------------------------------------------- /data/wis_counties.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/wis_counties.rda -------------------------------------------------------------------------------- /data/wis_poly.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/data/wis_poly.rda -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Page not found (404) • arcpullr 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Skip to contents 24 | 25 | 26 |
59 |
60 |
64 | 65 | Content not found. Please use links in the navbar. 66 | 67 |
68 |
69 | 70 | 71 |
74 | 75 | 78 | 79 |
80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-tactile -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | Articles • arcpullr 3 | Skip to contents 4 | 5 | 6 |
32 |
33 |
36 | 37 |
38 |

All vignettes

39 |
40 | 41 |
Introduction to arcpullr
42 |
43 |
Raster Layers
44 |
45 |
Spatial Queries
46 |
47 |
48 |
49 | 50 | 51 |
54 | 55 | 58 | 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/articles/intro_to_arcpullr_files/figure-html/plot_county_layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/intro_to_arcpullr_files/figure-html/plot_county_layer-1.png -------------------------------------------------------------------------------- /docs/articles/raster_layers_files/figure-html/image_layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/raster_layers_files/figure-html/image_layer-1.png -------------------------------------------------------------------------------- /docs/articles/raster_layers_files/figure-html/map_layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/raster_layers_files/figure-html/map_layer-1.png -------------------------------------------------------------------------------- /docs/articles/raster_layers_files/figure-html/plot_image_layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/raster_layers_files/figure-html/plot_image_layer-1.png -------------------------------------------------------------------------------- /docs/articles/raster_layers_files/figure-html/plot_map_layer-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/raster_layers_files/figure-html/plot_map_layer-1.png -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/articles/spatial_queries_files/bootstrap-5.1.0/fonts/bootstrap/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.3.1/bs3compat.js: -------------------------------------------------------------------------------- 1 | // Inform the world that we have the ability to use BS3 nav/navbar markup in BS4 2 | window.BS3_COMPAT = true; 3 | 4 | // This logic needs to execute after both the BS4+ (new) as well as BS3 (legacy) 5 | // jQuery plugins have been registered. For BS5, plugin registration happens 6 | // after DOM content is loaded, which is why we do the same here. 7 | // https://github.com/twbs/bootstrap/blob/08139c22/js/dist/tab.js#L87 8 | $(function() { 9 | 10 | // The legacy plugin needs to be registered after the new one 11 | if (!$.fn.tab.Constructor.VERSION.match(/^3\./)) { 12 | (console.warn || console.error || console.log)("bs3compat.js couldn't find bs3 tab impl; bs3 tabs will not be properly supported"); 13 | return; 14 | } 15 | var legacyTabPlugin = $.fn.tab.noConflict(); 16 | 17 | if (!$.fn.tab || !$.fn.tab.Constructor || !$.fn.tab.noConflict) { 18 | (console.warn || console.error || console.log)("bs3compat.js couldn't find a jQuery tab impl; bs3 tabs will not be properly supported"); 19 | } 20 | var newTabPlugin = $.fn.tab.noConflict(); 21 | 22 | // Re-define the tab click event 23 | // https://github.com/twbs/bootstrap/blob/08139c2/js/src/tab.js#L33 24 | var EVENT_KEY = "click.bs.tab.data-api"; 25 | $(document).off(EVENT_KEY); 26 | 27 | var SELECTOR = '[data-toggle="tab"], [data-toggle="pill"], [data-bs-toggle="tab"], [data-bs-toggle="pill"]'; 28 | $(document).on(EVENT_KEY, SELECTOR, function(event) { 29 | event.preventDefault(); 30 | $(this).tab("show"); 31 | }); 32 | 33 | function TabPlugin(config) { 34 | // Legacy (bs3) tabs: li.active > a 35 | // New (bs4+) tabs: li.nav-item > a.active.nav-link 36 | var legacy = $(this).closest(".nav").find("li:not(.dropdown).active > a").length > 0; 37 | var plugin = legacy ? legacyTabPlugin : newTabPlugin; 38 | plugin.call($(this), config); 39 | } 40 | 41 | var noconflict = $.fn.tab; 42 | $.fn.tab = TabPlugin; 43 | $.fn.tab.Constructor = newTabPlugin.Constructor; 44 | $.fn.tab.noConflict = function() { 45 | $.fn.tab = noconflict; 46 | return TabPlugin; 47 | }; 48 | }); 49 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.3.1/tabs.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: tab.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#tabs 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | // Register tab plugin after DOM content loaded in order to 10 | // override BS5's plugin 11 | // https://github.com/twbs/bootstrap/blob/08139c22/js/dist/tab.js#L87 12 | $(function() { 13 | 'use strict'; 14 | 15 | // TAB CLASS DEFINITION 16 | // ==================== 17 | 18 | var Tab = function (element) { 19 | // jscs:disable requireDollarBeforejQueryAssignment 20 | this.element = $(element) 21 | // jscs:enable requireDollarBeforejQueryAssignment 22 | } 23 | 24 | Tab.VERSION = '3.4.1' 25 | 26 | Tab.TRANSITION_DURATION = 150 27 | 28 | Tab.prototype.show = function () { 29 | var $this = this.element 30 | var $ul = $this.closest('ul:not(.dropdown-menu)') 31 | var selector = $this.data('target') 32 | 33 | if (!selector) { 34 | selector = $this.attr('href') 35 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 36 | } 37 | 38 | if ($this.parent('li').hasClass('active')) return 39 | 40 | var $previous = $ul.find('.active:last a') 41 | var hideEvent = $.Event('hide.bs.tab', { 42 | relatedTarget: $this[0] 43 | }) 44 | var showEvent = $.Event('show.bs.tab', { 45 | relatedTarget: $previous[0] 46 | }) 47 | 48 | $previous.trigger(hideEvent) 49 | $this.trigger(showEvent) 50 | 51 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 52 | 53 | var $target = $(document).find(selector) 54 | 55 | this.activate($this.closest('li'), $ul) 56 | this.activate($target, $target.parent(), function () { 57 | $previous.trigger({ 58 | type: 'hidden.bs.tab', 59 | relatedTarget: $this[0] 60 | }) 61 | $this.trigger({ 62 | type: 'shown.bs.tab', 63 | relatedTarget: $previous[0] 64 | }) 65 | }) 66 | } 67 | 68 | Tab.prototype.activate = function (element, container, callback) { 69 | var $active = container.find('> .active') 70 | var transition = callback 71 | && $.support.transition 72 | && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 73 | 74 | function next() { 75 | $active 76 | .removeClass('active') 77 | .find('> .dropdown-menu > .active') 78 | .removeClass('active') 79 | .end() 80 | .find('[data-toggle="tab"]') 81 | .attr('aria-expanded', false) 82 | 83 | element 84 | .addClass('active') 85 | .find('[data-toggle="tab"]') 86 | .attr('aria-expanded', true) 87 | 88 | if (transition) { 89 | element[0].offsetWidth // reflow for transition 90 | element.addClass('in') 91 | } else { 92 | element.removeClass('fade') 93 | } 94 | 95 | if (element.parent('.dropdown-menu').length) { 96 | element 97 | .closest('li.dropdown') 98 | .addClass('active') 99 | .end() 100 | .find('[data-toggle="tab"]') 101 | .attr('aria-expanded', true) 102 | } 103 | 104 | callback && callback() 105 | } 106 | 107 | $active.length && transition ? 108 | $active 109 | .one('bsTransitionEnd', next) 110 | .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 111 | next() 112 | 113 | $active.removeClass('in') 114 | } 115 | 116 | 117 | // TAB PLUGIN DEFINITION 118 | // ===================== 119 | 120 | function Plugin(option) { 121 | return this.each(function () { 122 | var $this = $(this) 123 | var data = $this.data('bs.tab') 124 | 125 | if (!data) $this.data('bs.tab', (data = new Tab(this))) 126 | if (typeof option == 'string') data[option]() 127 | }) 128 | } 129 | 130 | var old = $.fn.tab 131 | 132 | $.fn.tab = Plugin 133 | $.fn.tab.Constructor = Tab 134 | 135 | 136 | // TAB NO CONFLICT 137 | // =============== 138 | 139 | $.fn.tab.noConflict = function () { 140 | $.fn.tab = old 141 | return this 142 | } 143 | 144 | 145 | // TAB DATA-API 146 | // ============ 147 | 148 | var clickHandler = function (e) { 149 | e.preventDefault() 150 | Plugin.call($(this), 'show') 151 | } 152 | 153 | $(document) 154 | .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 155 | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 156 | 157 | }); 158 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.3.1/transition.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: transition.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#transitions 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/v3-dev/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) 14 | // ============================================================ 15 | 16 | function transitionEnd() { 17 | var el = document.createElement('bootstrap') 18 | 19 | var transEndEventNames = { 20 | WebkitTransition : 'webkitTransitionEnd', 21 | MozTransition : 'transitionend', 22 | OTransition : 'oTransitionEnd otransitionend', 23 | transition : 'transitionend' 24 | } 25 | 26 | for (var name in transEndEventNames) { 27 | if (el.style[name] !== undefined) { 28 | return { end: transEndEventNames[name] } 29 | } 30 | } 31 | 32 | return false // explicit for ie8 ( ._.) 33 | } 34 | 35 | // https://blog.alexmaccaw.com/css-transitions 36 | $.fn.emulateTransitionEnd = function (duration) { 37 | var called = false 38 | var $el = this 39 | $(this).one('bsTransitionEnd', function () { called = true }) 40 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 41 | setTimeout(callback, duration) 42 | return this 43 | } 44 | 45 | $(function () { 46 | $.support.transition = transitionEnd() 47 | 48 | if (!$.support.transition) return 49 | 50 | $.event.special.bsTransitionEnd = { 51 | bindType: $.support.transition.end, 52 | delegateType: $.support.transition.end, 53 | handle: function (e) { 54 | if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 55 | } 56 | } 57 | }) 58 | 59 | }(jQuery); 60 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.8.0/bs3compat.js: -------------------------------------------------------------------------------- 1 | // Inform the world that we have the ability to use BS3 nav/navbar markup in BS4 2 | window.BS3_COMPAT = true; 3 | 4 | // This logic needs to execute after both the BS4+ (new) as well as BS3 (legacy) 5 | // jQuery plugins have been registered. For BS5, plugin registration happens 6 | // after DOM content is loaded, which is why we do the same here. 7 | // https://github.com/twbs/bootstrap/blob/08139c22/js/dist/tab.js#L87 8 | $(function() { 9 | 10 | // The legacy plugin needs to be registered after the new one 11 | if (!$.fn.tab.Constructor.VERSION.match(/^3\./)) { 12 | (console.warn || console.error || console.log)("bs3compat.js couldn't find bs3 tab impl; bs3 tabs will not be properly supported"); 13 | return; 14 | } 15 | var legacyTabPlugin = $.fn.tab.noConflict(); 16 | 17 | if (!$.fn.tab || !$.fn.tab.Constructor || !$.fn.tab.noConflict) { 18 | (console.warn || console.error || console.log)("bs3compat.js couldn't find a jQuery tab impl; bs3 tabs will not be properly supported"); 19 | } 20 | var newTabPlugin = $.fn.tab.noConflict(); 21 | 22 | // Re-define the tab click event 23 | // https://github.com/twbs/bootstrap/blob/08139c2/js/src/tab.js#L33 24 | var EVENT_KEY = "click.bs.tab.data-api"; 25 | $(document).off(EVENT_KEY); 26 | 27 | var SELECTOR = '[data-toggle="tab"], [data-toggle="pill"], [data-bs-toggle="tab"], [data-bs-toggle="pill"]'; 28 | $(document).on(EVENT_KEY, SELECTOR, function(event) { 29 | event.preventDefault(); 30 | $(this).tab("show"); 31 | }); 32 | 33 | function TabPlugin(config) { 34 | // Legacy (bs3) tabs: li.active > a 35 | // New (bs4+) tabs: li.nav-item > a.active.nav-link 36 | var legacy = $(this).closest(".nav").find("li:not(.dropdown).active > a").length > 0; 37 | var plugin = legacy ? legacyTabPlugin : newTabPlugin; 38 | plugin.call($(this), config); 39 | } 40 | 41 | var noconflict = $.fn.tab; 42 | $.fn.tab = TabPlugin; 43 | $.fn.tab.Constructor = newTabPlugin.Constructor; 44 | $.fn.tab.noConflict = function() { 45 | $.fn.tab = noconflict; 46 | return TabPlugin; 47 | }; 48 | }); 49 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.8.0/tabs.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: tab.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#tabs 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 7 | * ======================================================================== */ 8 | 9 | // Register tab plugin after DOM content loaded in order to 10 | // override BS5's plugin 11 | // https://github.com/twbs/bootstrap/blob/08139c22/js/dist/tab.js#L87 12 | $(function() { 13 | 'use strict'; 14 | 15 | // TAB CLASS DEFINITION 16 | // ==================== 17 | 18 | var Tab = function (element) { 19 | // jscs:disable requireDollarBeforejQueryAssignment 20 | this.element = $(element) 21 | // jscs:enable requireDollarBeforejQueryAssignment 22 | } 23 | 24 | Tab.VERSION = '3.4.1' 25 | 26 | Tab.TRANSITION_DURATION = 150 27 | 28 | Tab.prototype.show = function () { 29 | var $this = this.element 30 | var $ul = $this.closest('ul:not(.dropdown-menu)') 31 | var selector = $this.data('target') 32 | 33 | if (!selector) { 34 | selector = $this.attr('href') 35 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 36 | } 37 | 38 | if ($this.parent('li').hasClass('active')) return 39 | 40 | var $previous = $ul.find('.active:last a') 41 | var hideEvent = $.Event('hide.bs.tab', { 42 | relatedTarget: $this[0] 43 | }) 44 | var showEvent = $.Event('show.bs.tab', { 45 | relatedTarget: $previous[0] 46 | }) 47 | 48 | $previous.trigger(hideEvent) 49 | $this.trigger(showEvent) 50 | 51 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 52 | 53 | var $target = $(document).find(selector) 54 | 55 | this.activate($this.closest('li'), $ul) 56 | this.activate($target, $target.parent(), function () { 57 | $previous.trigger({ 58 | type: 'hidden.bs.tab', 59 | relatedTarget: $this[0] 60 | }) 61 | $this.trigger({ 62 | type: 'shown.bs.tab', 63 | relatedTarget: $previous[0] 64 | }) 65 | }) 66 | } 67 | 68 | Tab.prototype.activate = function (element, container, callback) { 69 | var $active = container.find('> .active') 70 | var transition = callback 71 | && $.support.transition 72 | && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 73 | 74 | function next() { 75 | $active 76 | .removeClass('active') 77 | .find('> .dropdown-menu > .active') 78 | .removeClass('active') 79 | .end() 80 | .find('[data-toggle="tab"]') 81 | .attr('aria-expanded', false) 82 | 83 | element 84 | .addClass('active') 85 | .find('[data-toggle="tab"]') 86 | .attr('aria-expanded', true) 87 | 88 | if (transition) { 89 | element[0].offsetWidth // reflow for transition 90 | element.addClass('in') 91 | } else { 92 | element.removeClass('fade') 93 | } 94 | 95 | if (element.parent('.dropdown-menu').length) { 96 | element 97 | .closest('li.dropdown') 98 | .addClass('active') 99 | .end() 100 | .find('[data-toggle="tab"]') 101 | .attr('aria-expanded', true) 102 | } 103 | 104 | callback && callback() 105 | } 106 | 107 | $active.length && transition ? 108 | $active 109 | .one('bsTransitionEnd', next) 110 | .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 111 | next() 112 | 113 | $active.removeClass('in') 114 | } 115 | 116 | 117 | // TAB PLUGIN DEFINITION 118 | // ===================== 119 | 120 | function Plugin(option) { 121 | return this.each(function () { 122 | var $this = $(this) 123 | var data = $this.data('bs.tab') 124 | 125 | if (!data) $this.data('bs.tab', (data = new Tab(this))) 126 | if (typeof option == 'string') data[option]() 127 | }) 128 | } 129 | 130 | var old = $.fn.tab 131 | 132 | $.fn.tab = Plugin 133 | $.fn.tab.Constructor = Tab 134 | 135 | 136 | // TAB NO CONFLICT 137 | // =============== 138 | 139 | $.fn.tab.noConflict = function () { 140 | $.fn.tab = old 141 | return this 142 | } 143 | 144 | 145 | // TAB DATA-API 146 | // ============ 147 | 148 | var clickHandler = function (e) { 149 | e.preventDefault() 150 | Plugin.call($(this), 'show') 151 | } 152 | 153 | $(document) 154 | .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 155 | .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 156 | 157 | }); 158 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/bs3compat-0.8.0/transition.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Bootstrap: transition.js v3.4.1 3 | * https://getbootstrap.com/docs/3.4/javascript/#transitions 4 | * ======================================================================== 5 | * Copyright 2011-2019 Twitter, Inc. 6 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/v3-dev/LICENSE) 7 | * ======================================================================== */ 8 | 9 | 10 | +function ($) { 11 | 'use strict'; 12 | 13 | // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) 14 | // ============================================================ 15 | 16 | function transitionEnd() { 17 | var el = document.createElement('bootstrap') 18 | 19 | var transEndEventNames = { 20 | WebkitTransition : 'webkitTransitionEnd', 21 | MozTransition : 'transitionend', 22 | OTransition : 'oTransitionEnd otransitionend', 23 | transition : 'transitionend' 24 | } 25 | 26 | for (var name in transEndEventNames) { 27 | if (el.style[name] !== undefined) { 28 | return { end: transEndEventNames[name] } 29 | } 30 | } 31 | 32 | return false // explicit for ie8 ( ._.) 33 | } 34 | 35 | // https://blog.alexmaccaw.com/css-transitions 36 | $.fn.emulateTransitionEnd = function (duration) { 37 | var called = false 38 | var $el = this 39 | $(this).one('bsTransitionEnd', function () { called = true }) 40 | var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 41 | setTimeout(callback, duration) 42 | return this 43 | } 44 | 45 | $(function () { 46 | $.support.transition = transitionEnd() 47 | 48 | if (!$.support.transition) return 49 | 50 | $.event.special.bsTransitionEnd = { 51 | bindType: $.support.transition.end, 52 | delegateType: $.support.transition.end, 53 | handle: function (e) { 54 | if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 55 | } 56 | } 57 | }) 58 | 59 | }(jQuery); 60 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/crosstalk-1.1.1/css/crosstalk.css: -------------------------------------------------------------------------------- 1 | /* Adjust margins outwards, so column contents line up with the edges of the 2 | parent of container-fluid. */ 3 | .container-fluid.crosstalk-bscols { 4 | margin-left: -30px; 5 | margin-right: -30px; 6 | white-space: normal; 7 | } 8 | 9 | /* But don't adjust the margins outwards if we're directly under the body, 10 | i.e. we were the top-level of something at the console. */ 11 | body > .container-fluid.crosstalk-bscols { 12 | margin-left: auto; 13 | margin-right: auto; 14 | } 15 | 16 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 17 | display: inline-block; 18 | padding-right: 12px; 19 | vertical-align: top; 20 | } 21 | 22 | @media only screen and (max-width:480px) { 23 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 24 | display: block; 25 | padding-right: inherit; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/crosstalk-1.2.0/css/crosstalk.min.css: -------------------------------------------------------------------------------- 1 | .container-fluid.crosstalk-bscols{margin-left:-30px;margin-right:-30px;white-space:normal}body>.container-fluid.crosstalk-bscols{margin-left:auto;margin-right:auto}.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:inline-block;padding-right:12px;vertical-align:top}@media only screen and (max-width: 480px){.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:block;padding-right:inherit}}.crosstalk-input{margin-bottom:15px}.crosstalk-input .control-label{margin-bottom:0;vertical-align:middle}.crosstalk-input input[type="checkbox"]{margin:4px 0 0;margin-top:1px;line-height:normal}.crosstalk-input .checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.crosstalk-input .checkbox>label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.crosstalk-input .checkbox input[type="checkbox"],.crosstalk-input .checkbox-inline input[type="checkbox"]{position:absolute;margin-top:2px;margin-left:-20px}.crosstalk-input .checkbox+.checkbox{margin-top:-5px}.crosstalk-input .checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.crosstalk-input .checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px} 2 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/crosstalk-1.2.0/scss/crosstalk.scss: -------------------------------------------------------------------------------- 1 | /* Adjust margins outwards, so column contents line up with the edges of the 2 | parent of container-fluid. */ 3 | .container-fluid.crosstalk-bscols { 4 | margin-left: -30px; 5 | margin-right: -30px; 6 | white-space: normal; 7 | } 8 | 9 | /* But don't adjust the margins outwards if we're directly under the body, 10 | i.e. we were the top-level of something at the console. */ 11 | body > .container-fluid.crosstalk-bscols { 12 | margin-left: auto; 13 | margin-right: auto; 14 | } 15 | 16 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 17 | display: inline-block; 18 | padding-right: 12px; 19 | vertical-align: top; 20 | } 21 | 22 | @media only screen and (max-width:480px) { 23 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 24 | display: block; 25 | padding-right: inherit; 26 | } 27 | } 28 | 29 | /* Relevant BS3 styles to make filter_checkbox() look reasonable without Bootstrap */ 30 | .crosstalk-input { 31 | margin-bottom: 15px; /* a la .form-group */ 32 | .control-label { 33 | margin-bottom: 0; 34 | vertical-align: middle; 35 | } 36 | input[type="checkbox"] { 37 | margin: 4px 0 0; 38 | margin-top: 1px; 39 | line-height: normal; 40 | } 41 | .checkbox { 42 | position: relative; 43 | display: block; 44 | margin-top: 10px; 45 | margin-bottom: 10px; 46 | } 47 | .checkbox > label{ 48 | padding-left: 20px; 49 | margin-bottom: 0; 50 | font-weight: 400; 51 | cursor: pointer; 52 | } 53 | .checkbox input[type="checkbox"], 54 | .checkbox-inline input[type="checkbox"] { 55 | position: absolute; 56 | margin-top: 2px; 57 | margin-left: -20px; 58 | } 59 | .checkbox + .checkbox { 60 | margin-top: -5px; 61 | } 62 | .checkbox-inline { 63 | position: relative; 64 | display: inline-block; 65 | padding-left: 20px; 66 | margin-bottom: 0; 67 | font-weight: 400; 68 | vertical-align: middle; 69 | cursor: pointer; 70 | } 71 | .checkbox-inline + .checkbox-inline { 72 | margin-top: 0; 73 | margin-left: 10px; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/crosstalk-1.2.1/css/crosstalk.min.css: -------------------------------------------------------------------------------- 1 | .container-fluid.crosstalk-bscols{margin-left:-30px;margin-right:-30px;white-space:normal}body>.container-fluid.crosstalk-bscols{margin-left:auto;margin-right:auto}.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:inline-block;padding-right:12px;vertical-align:top}@media only screen and (max-width: 480px){.crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column{display:block;padding-right:inherit}}.crosstalk-input{margin-bottom:15px}.crosstalk-input .control-label{margin-bottom:0;vertical-align:middle}.crosstalk-input input[type="checkbox"]{margin:4px 0 0;margin-top:1px;line-height:normal}.crosstalk-input .checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.crosstalk-input .checkbox>label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.crosstalk-input .checkbox input[type="checkbox"],.crosstalk-input .checkbox-inline input[type="checkbox"]{position:absolute;margin-top:2px;margin-left:-20px}.crosstalk-input .checkbox+.checkbox{margin-top:-5px}.crosstalk-input .checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.crosstalk-input .checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px} 2 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/crosstalk-1.2.1/scss/crosstalk.scss: -------------------------------------------------------------------------------- 1 | /* Adjust margins outwards, so column contents line up with the edges of the 2 | parent of container-fluid. */ 3 | .container-fluid.crosstalk-bscols { 4 | margin-left: -30px; 5 | margin-right: -30px; 6 | white-space: normal; 7 | } 8 | 9 | /* But don't adjust the margins outwards if we're directly under the body, 10 | i.e. we were the top-level of something at the console. */ 11 | body > .container-fluid.crosstalk-bscols { 12 | margin-left: auto; 13 | margin-right: auto; 14 | } 15 | 16 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 17 | display: inline-block; 18 | padding-right: 12px; 19 | vertical-align: top; 20 | } 21 | 22 | @media only screen and (max-width:480px) { 23 | .crosstalk-input-checkboxgroup .crosstalk-options-group .crosstalk-options-column { 24 | display: block; 25 | padding-right: inherit; 26 | } 27 | } 28 | 29 | /* Relevant BS3 styles to make filter_checkbox() look reasonable without Bootstrap */ 30 | .crosstalk-input { 31 | margin-bottom: 15px; /* a la .form-group */ 32 | .control-label { 33 | margin-bottom: 0; 34 | vertical-align: middle; 35 | } 36 | input[type="checkbox"] { 37 | margin: 4px 0 0; 38 | margin-top: 1px; 39 | line-height: normal; 40 | } 41 | .checkbox { 42 | position: relative; 43 | display: block; 44 | margin-top: 10px; 45 | margin-bottom: 10px; 46 | } 47 | .checkbox > label{ 48 | padding-left: 20px; 49 | margin-bottom: 0; 50 | font-weight: 400; 51 | cursor: pointer; 52 | } 53 | .checkbox input[type="checkbox"], 54 | .checkbox-inline input[type="checkbox"] { 55 | position: absolute; 56 | margin-top: 2px; 57 | margin-left: -20px; 58 | } 59 | .checkbox + .checkbox { 60 | margin-top: -5px; 61 | } 62 | .checkbox-inline { 63 | position: relative; 64 | display: inline-block; 65 | padding-left: 20px; 66 | margin-bottom: 0; 67 | font-weight: 400; 68 | vertical-align: middle; 69 | cursor: pointer; 70 | } 71 | .checkbox-inline + .checkbox-inline { 72 | margin-top: 0; 73 | margin-left: 10px; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/datatables-css-0.0.0/datatables-crosstalk.css: -------------------------------------------------------------------------------- 1 | .dt-crosstalk-fade { 2 | opacity: 0.2; 3 | } 4 | 5 | html body div.DTS div.dataTables_scrollBody { 6 | background: none; 7 | } 8 | 9 | 10 | /* 11 | Fix https://github.com/rstudio/DT/issues/563 12 | If the `table.display` is set to "block" (e.g., pkgdown), the browser will display 13 | datatable objects strangely. The search panel and the page buttons will still be 14 | in full-width but the table body will be "compact" and shorter. 15 | In therory, having this attributes will affect `dom="t"` 16 | with `display: block` users. But in reality, there should be no one. 17 | We may remove the below lines in the future if the upstream agree to have this there. 18 | See https://github.com/DataTables/DataTablesSrc/issues/160 19 | */ 20 | 21 | table.dataTable { 22 | display: table; 23 | } 24 | 25 | 26 | /* 27 | When DTOutput(fill = TRUE), it receives a .html-fill-item class (via htmltools::bindFillRole()), which effectively amounts to `flex: 1 1 auto`. That's mostly fine, but the case where `fillContainer=TRUE`+`height:auto`+`flex-basis:auto` and the container (e.g., a bslib::card()) doesn't have a defined height is a bit problematic since the table wants to fit the parent but the parent wants to fit the table, which results pretty small table height (maybe because there is a minimum height somewhere?). It seems better in this case to impose a 400px height default for the table, which we can do by setting `flex-basis` to 400px (the table is still allowed to grow/shrink when the container has an opinionated height). 28 | */ 29 | 30 | .html-fill-container > .html-fill-item.datatables { 31 | flex-basis: 400px; 32 | } 33 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-1.10.20/css/jquery.dataTables.extra.css: -------------------------------------------------------------------------------- 1 | /* Selected rows/cells */ 2 | table.dataTable tr.selected td, table.dataTable td.selected { 3 | background-color: #b0bed9 !important; 4 | } 5 | /* In case of scrollX/Y or FixedHeader */ 6 | .dataTables_scrollBody .dataTables_sizing { 7 | visibility: hidden; 8 | } 9 | 10 | /* The datatables' theme CSS file doesn't define 11 | the color but with white background. It leads to an issue that 12 | when the HTML's body color is set to 'white', the user can't 13 | see the text since the background is white. One case happens in the 14 | RStudio's IDE when inline viewing the DT table inside an Rmd file, 15 | if the IDE theme is set to "Cobalt". 16 | 17 | See https://github.com/rstudio/DT/issues/447 for more info 18 | 19 | This fixes should have little side-effects because all the other elements 20 | of the default theme use the #333 font color. 21 | 22 | TODO: The upstream may use relative colors for both the table background 23 | and the color. It means the table can display well without this patch 24 | then. At that time, we need to remove the below CSS attributes. 25 | */ 26 | div.datatables { 27 | color: #333; 28 | } 29 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap4-1.10.20/css/dataTables.bootstrap4.extra.css: -------------------------------------------------------------------------------- 1 | table.dataTable th.dt-left, 2 | table.dataTable td.dt-left { 3 | text-align: left; 4 | } 5 | table.dataTable th.dt-center, 6 | table.dataTable td.dt-center, 7 | table.dataTable td.dataTables_empty { 8 | text-align: center; 9 | } 10 | table.dataTable th.dt-right, 11 | table.dataTable td.dt-right { 12 | text-align: right; 13 | } 14 | table.dataTable th.dt-justify, 15 | table.dataTable td.dt-justify { 16 | text-align: justify; 17 | } 18 | table.dataTable th.dt-nowrap, 19 | table.dataTable td.dt-nowrap { 20 | white-space: nowrap; 21 | } 22 | table.dataTable thead th.dt-head-left, 23 | table.dataTable thead td.dt-head-left, 24 | table.dataTable tfoot th.dt-head-left, 25 | table.dataTable tfoot td.dt-head-left { 26 | text-align: left; 27 | } 28 | table.dataTable thead th.dt-head-center, 29 | table.dataTable thead td.dt-head-center, 30 | table.dataTable tfoot th.dt-head-center, 31 | table.dataTable tfoot td.dt-head-center { 32 | text-align: center; 33 | } 34 | table.dataTable thead th.dt-head-right, 35 | table.dataTable thead td.dt-head-right, 36 | table.dataTable tfoot th.dt-head-right, 37 | table.dataTable tfoot td.dt-head-right { 38 | text-align: right; 39 | } 40 | table.dataTable thead th.dt-head-justify, 41 | table.dataTable thead td.dt-head-justify, 42 | table.dataTable tfoot th.dt-head-justify, 43 | table.dataTable tfoot td.dt-head-justify { 44 | text-align: justify; 45 | } 46 | table.dataTable thead th.dt-head-nowrap, 47 | table.dataTable thead td.dt-head-nowrap, 48 | table.dataTable tfoot th.dt-head-nowrap, 49 | table.dataTable tfoot td.dt-head-nowrap { 50 | white-space: nowrap; 51 | } 52 | table.dataTable tbody th.dt-body-left, 53 | table.dataTable tbody td.dt-body-left { 54 | text-align: left; 55 | } 56 | table.dataTable tbody th.dt-body-center, 57 | table.dataTable tbody td.dt-body-center { 58 | text-align: center; 59 | } 60 | table.dataTable tbody th.dt-body-right, 61 | table.dataTable tbody td.dt-body-right { 62 | text-align: right; 63 | } 64 | table.dataTable tbody th.dt-body-justify, 65 | table.dataTable tbody td.dt-body-justify { 66 | text-align: justify; 67 | } 68 | table.dataTable tbody th.dt-body-nowrap, 69 | table.dataTable tbody td.dt-body-nowrap { 70 | white-space: nowrap; 71 | } 72 | .table.dataTable tbody td.active, .table.dataTable tbody tr.active td { 73 | background-color: #007bff; 74 | color: white; 75 | } 76 | .dataTables_scrollBody .dataTables_sizing { 77 | visibility: hidden; 78 | } 79 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap4-1.10.20/css/dataTables.bootstrap4.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important;border-spacing:0}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:auto;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:0.85em;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap;justify-content:flex-end}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:before,table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:0.9em;display:block;opacity:0.3}table.dataTable thead .sorting:before,table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:before,table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:before{right:1em;content:"\2191"}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{right:0.5em;content:"\2193"}table.dataTable thead .sorting_asc:before,table.dataTable thead .sorting_desc:after{opacity:1}table.dataTable thead .sorting_asc_disabled:before,table.dataTable thead .sorting_desc_disabled:after{opacity:0}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:before,div.dataTables_scrollBody table thead .sorting_asc:before,div.dataTables_scrollBody table thead .sorting_desc:before,div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-sm>thead>tr>th{padding-right:20px}table.dataTable.table-sm .sorting:before,table.dataTable.table-sm .sorting_asc:before,table.dataTable.table-sm .sorting_desc:before{top:5px;right:0.85em}table.dataTable.table-sm .sorting:after,table.dataTable.table-sm .sorting_asc:after,table.dataTable.table-sm .sorting_desc:after{top:5px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} 2 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap4-1.10.20/js/dataTables.bootstrap4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 4 integration 3 | ©2011-2017 SpryMedia Ltd - datatables.net/license 4 | */ 5 | var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var e=a.length,d=0;d<'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 9 | renderer:"bootstrap"});a.extend(d.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});d.ext.renderer.pageButton.bootstrap=function(b,l,v,w,m,r){var k=new d.Api(b),x=b.oClasses,n=b.oLanguage.oPaginate,y=b.oLanguage.oAria.paginate||{},g,h,t=0,u=function(c,d){var e,l=function(b){b.preventDefault(); 10 | a(b.currentTarget).hasClass("disabled")||k.page()==b.data.action||k.page(b.data.action).draw("page")};var q=0;for(e=d.length;q",{"class":x.sPageButton+" "+h,id:0===v&&"string"===typeof f?b.sTableId+"_"+f:null}).append(a("",{href:"#","aria-controls":b.sTableId,"aria-label":y[f],"data-dt-idx":t,tabindex:b.iTabIndex,"class":"page-link"}).html(g)).appendTo(c);b.oApi._fnBindAction(p,{action:f},l);t++}}}};try{var p=a(l).find(c.activeElement).data("dt-idx")}catch(z){}u(a(l).empty().html('
    ').children("ul"),w);p!==e&&a(l).find("[data-dt-idx="+p+"]").focus()};return d}); 12 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap4-1.11.3/css/dataTables.bootstrap4.extra.css: -------------------------------------------------------------------------------- 1 | table.dataTable th.dt-left, 2 | table.dataTable td.dt-left { 3 | text-align: left; 4 | } 5 | table.dataTable th.dt-center, 6 | table.dataTable td.dt-center, 7 | table.dataTable td.dataTables_empty { 8 | text-align: center; 9 | } 10 | table.dataTable th.dt-right, 11 | table.dataTable td.dt-right { 12 | text-align: right; 13 | } 14 | table.dataTable th.dt-justify, 15 | table.dataTable td.dt-justify { 16 | text-align: justify; 17 | } 18 | table.dataTable th.dt-nowrap, 19 | table.dataTable td.dt-nowrap { 20 | white-space: nowrap; 21 | } 22 | table.dataTable thead th.dt-head-left, 23 | table.dataTable thead td.dt-head-left, 24 | table.dataTable tfoot th.dt-head-left, 25 | table.dataTable tfoot td.dt-head-left { 26 | text-align: left; 27 | } 28 | table.dataTable thead th.dt-head-center, 29 | table.dataTable thead td.dt-head-center, 30 | table.dataTable tfoot th.dt-head-center, 31 | table.dataTable tfoot td.dt-head-center { 32 | text-align: center; 33 | } 34 | table.dataTable thead th.dt-head-right, 35 | table.dataTable thead td.dt-head-right, 36 | table.dataTable tfoot th.dt-head-right, 37 | table.dataTable tfoot td.dt-head-right { 38 | text-align: right; 39 | } 40 | table.dataTable thead th.dt-head-justify, 41 | table.dataTable thead td.dt-head-justify, 42 | table.dataTable tfoot th.dt-head-justify, 43 | table.dataTable tfoot td.dt-head-justify { 44 | text-align: justify; 45 | } 46 | table.dataTable thead th.dt-head-nowrap, 47 | table.dataTable thead td.dt-head-nowrap, 48 | table.dataTable tfoot th.dt-head-nowrap, 49 | table.dataTable tfoot td.dt-head-nowrap { 50 | white-space: nowrap; 51 | } 52 | table.dataTable tbody th.dt-body-left, 53 | table.dataTable tbody td.dt-body-left { 54 | text-align: left; 55 | } 56 | table.dataTable tbody th.dt-body-center, 57 | table.dataTable tbody td.dt-body-center { 58 | text-align: center; 59 | } 60 | table.dataTable tbody th.dt-body-right, 61 | table.dataTable tbody td.dt-body-right { 62 | text-align: right; 63 | } 64 | table.dataTable tbody th.dt-body-justify, 65 | table.dataTable tbody td.dt-body-justify { 66 | text-align: justify; 67 | } 68 | table.dataTable tbody th.dt-body-nowrap, 69 | table.dataTable tbody td.dt-body-nowrap { 70 | white-space: nowrap; 71 | } 72 | .table.dataTable tbody td.active, .table.dataTable tbody tr.active td { 73 | background-color: #007bff; 74 | color: white; 75 | } 76 | .dataTables_scrollBody .dataTables_sizing { 77 | visibility: hidden; 78 | } 79 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap4-1.11.3/js/dataTables.bootstrap4.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 4 integration 3 | ©2011-2017 SpryMedia Ltd - datatables.net/license 4 | */ 5 | var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var e=a.length,d=0;d<'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", 12 | renderer:"bootstrap"});a.extend(d.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});d.ext.renderer.pageButton.bootstrap=function(f,l,A,B,m,t){var u=new d.Api(f),C=f.oClasses,n=f.oLanguage.oPaginate,D=f.oLanguage.oAria.paginate||{},h,k,v=0,y=function(q,w){var x,E=function(p){p.preventDefault(); 13 | a(p.currentTarget).hasClass("disabled")||u.page()==p.data.action||u.page(p.data.action).draw("page")};var r=0;for(x=w.length;r",{"class":C.sPageButton+" "+k,id:0===A&&"string"===typeof g?f.sTableId+"_"+g:null}).append(a("",{href:"#","aria-controls":f.sTableId,"aria-label":D[g],"data-dt-idx":v,tabindex:f.iTabIndex,"class":"page-link"}).html(h)).appendTo(q);f.oApi._fnBindAction(F,{action:g},E);v++}}}};try{var z=a(l).find(c.activeElement).data("dt-idx")}catch(q){}y(a(l).empty().html('
      ').children("ul"),B);z!==e&&a(l).find("[data-dt-idx="+z+"]").trigger("focus")};return d}); 15 | -------------------------------------------------------------------------------- /docs/articles/spatial_queries_files/dt-core-bootstrap5-1.13.6/js/dataTables.bootstrap5.min.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 5 integration 2 | * 2020 SpryMedia Ltd - datatables.net/license 3 | */ 4 | !function(t){var n,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return t(e,window,document)}):"object"==typeof exports?(n=require("jquery"),r=function(e,a){a.fn.dataTable||require("datatables.net")(e,a)},"undefined"==typeof window?module.exports=function(e,a){return e=e||window,a=a||n(e),r(e,a),t(a,0,e.document)}:(r(window,n),module.exports=t(n,window,window.document))):t(jQuery,window,document)}(function(x,e,r,o){"use strict";var i=x.fn.dataTable;return x.extend(!0,i.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row dt-row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",renderer:"bootstrap"}),x.extend(i.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap5",sFilterInput:"form-control form-control-sm",sLengthSelect:"form-select form-select-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"}),i.ext.renderer.pageButton.bootstrap=function(d,e,s,a,l,c){function u(e,a){for(var t,n,r=function(e){e.preventDefault(),x(e.currentTarget).hasClass("disabled")||b.page()==e.data.action||b.page(e.data.action).draw("page")},o=0,i=a.length;o",{class:m.sPageButton+" "+f,id:0===s&&"string"==typeof t?d.sTableId+"_"+t:null}).append(x("",{href:n?null:"#","aria-controls":d.sTableId,"aria-disabled":n?"true":null,"aria-label":w[t],role:"link","aria-current":"active"===f?"page":null,"data-dt-idx":t,tabindex:n?-1:d.iTabIndex,class:"page-link"}).html(p)).appendTo(e),d.oApi._fnBindAction(n,{action:t},r))}}var p,f,t,b=new i.Api(d),m=d.oClasses,g=d.oLanguage.oPaginate,w=d.oLanguage.oAria.paginate||{},e=x(e);try{t=e.find(r.activeElement).data("dt-idx")}catch(e){}var n=e.children("ul.pagination");n.length?n.empty():n=e.html("')},createChildNavList:function(e){var t=this.createNavList();return e.append(t),t},generateNavEl:function(e,t){var n=a('');n.attr("href","#"+e),n.text(t);var r=a("
    • ");return r.append(n),r},generateNavItem:function(e){var t=this.generateAnchor(e),n=a(e),r=n.data("toc-text")||n.text();return this.generateNavEl(t,r)},getTopLevel:function(e){for(var t=1;t<=6;t++){if(1 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/deps/font-awesome-6.5.2/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.11.0 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=ls.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t,n){n=n||{},Object.assign(this,o.options,n),this.classes=Object.assign({},o.options.classes,n.classes),this.elem=t,this.tolerance=function(t){return t===Object(t)?t:{down:t,up:t}}(this.tolerance),this.initialised=!1,this.frozen=!1}return o.prototype={constructor:o,init:function(){return o.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEach(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},o.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},o.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),o}); -------------------------------------------------------------------------------- /docs/deps/headroom-0.11.0/jQuery.headroom.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 3 | * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 4 | * License: MIT 5 | */ 6 | 7 | !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/favicon.ico -------------------------------------------------------------------------------- /docs/katex-auto.js: -------------------------------------------------------------------------------- 1 | // https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 2 | document.addEventListener("DOMContentLoaded", function () { 3 | var mathElements = document.getElementsByClassName("math"); 4 | var macros = []; 5 | for (var i = 0; i < mathElements.length; i++) { 6 | var texText = mathElements[i].firstChild; 7 | if (mathElements[i].tagName == "SPAN") { 8 | katex.render(texText.data, mathElements[i], { 9 | displayMode: mathElements[i].classList.contains("display"), 10 | throwOnError: false, 11 | macros: macros, 12 | fleqn: false 13 | }); 14 | }}}); 15 | -------------------------------------------------------------------------------- /docs/lightswitch.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) 4 | * Copyright 2011-2023 The Bootstrap Authors 5 | * Licensed under the Creative Commons Attribution 3.0 Unported License. 6 | * Updates for {pkgdown} by the {bslib} authors, also licensed under CC-BY-3.0. 7 | */ 8 | 9 | const getStoredTheme = () => localStorage.getItem('theme') 10 | const setStoredTheme = theme => localStorage.setItem('theme', theme) 11 | 12 | const getPreferredTheme = () => { 13 | const storedTheme = getStoredTheme() 14 | if (storedTheme) { 15 | return storedTheme 16 | } 17 | 18 | return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' 19 | } 20 | 21 | const setTheme = theme => { 22 | if (theme === 'auto') { 23 | document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) 24 | } else { 25 | document.documentElement.setAttribute('data-bs-theme', theme) 26 | } 27 | } 28 | 29 | function bsSetupThemeToggle () { 30 | 'use strict' 31 | 32 | const showActiveTheme = (theme, focus = false) => { 33 | var activeLabel, activeIcon; 34 | 35 | document.querySelectorAll('[data-bs-theme-value]').forEach(element => { 36 | const buttonTheme = element.getAttribute('data-bs-theme-value') 37 | const isActive = buttonTheme == theme 38 | 39 | element.classList.toggle('active', isActive) 40 | element.setAttribute('aria-pressed', isActive) 41 | 42 | if (isActive) { 43 | activeLabel = element.textContent; 44 | activeIcon = element.querySelector('span').classList.value; 45 | } 46 | }) 47 | 48 | const themeSwitcher = document.querySelector('#dropdown-lightswitch') 49 | if (!themeSwitcher) { 50 | return 51 | } 52 | 53 | themeSwitcher.setAttribute('aria-label', activeLabel) 54 | themeSwitcher.querySelector('span').classList.value = activeIcon; 55 | 56 | if (focus) { 57 | themeSwitcher.focus() 58 | } 59 | } 60 | 61 | window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => { 62 | const storedTheme = getStoredTheme() 63 | if (storedTheme !== 'light' && storedTheme !== 'dark') { 64 | setTheme(getPreferredTheme()) 65 | } 66 | }) 67 | 68 | window.addEventListener('DOMContentLoaded', () => { 69 | showActiveTheme(getPreferredTheme()) 70 | 71 | document 72 | .querySelectorAll('[data-bs-theme-value]') 73 | .forEach(toggle => { 74 | toggle.addEventListener('click', () => { 75 | const theme = toggle.getAttribute('data-bs-theme-value') 76 | setTheme(theme) 77 | setStoredTheme(theme) 78 | showActiveTheme(theme, true) 79 | }) 80 | }) 81 | }) 82 | } 83 | 84 | setTheme(getPreferredTheme()); 85 | bsSetupThemeToggle(); 86 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/logo.png -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('nav.navbar').headroom(); 6 | 7 | Toc.init({ 8 | $nav: $("#toc"), 9 | $scope: $("main h2, main h3, main h4, main h5, main h6") 10 | }); 11 | 12 | if ($('#toc').length) { 13 | $('body').scrollspy({ 14 | target: '#toc', 15 | offset: $("nav.navbar").outerHeight() + 1 16 | }); 17 | } 18 | 19 | // Activate popovers 20 | $('[data-bs-toggle="popover"]').popover({ 21 | container: 'body', 22 | html: true, 23 | trigger: 'focus', 24 | placement: "top", 25 | sanitize: false, 26 | }); 27 | 28 | $('[data-bs-toggle="tooltip"]').tooltip(); 29 | 30 | /* Clipboard --------------------------*/ 31 | 32 | function changeTooltipMessage(element, msg) { 33 | var tooltipOriginalTitle=element.getAttribute('data-bs-original-title'); 34 | element.setAttribute('data-bs-original-title', msg); 35 | $(element).tooltip('show'); 36 | element.setAttribute('data-bs-original-title', tooltipOriginalTitle); 37 | } 38 | 39 | if(ClipboardJS.isSupported()) { 40 | $(document).ready(function() { 41 | var copyButton = ""; 42 | 43 | $("div.sourceCode").addClass("hasCopyButton"); 44 | 45 | // Insert copy buttons: 46 | $(copyButton).prependTo(".hasCopyButton"); 47 | 48 | // Initialize tooltips: 49 | $('.btn-copy-ex').tooltip({container: 'body'}); 50 | 51 | // Initialize clipboard: 52 | var clipboard = new ClipboardJS('[data-clipboard-copy]', { 53 | text: function(trigger) { 54 | return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); 55 | } 56 | }); 57 | 58 | clipboard.on('success', function(e) { 59 | changeTooltipMessage(e.trigger, 'Copied!'); 60 | e.clearSelection(); 61 | }); 62 | 63 | clipboard.on('error', function(e) { 64 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 65 | }); 66 | 67 | }); 68 | } 69 | 70 | /* Search marking --------------------------*/ 71 | var url = new URL(window.location.href); 72 | var toMark = url.searchParams.get("q"); 73 | var mark = new Mark("main#main"); 74 | if (toMark) { 75 | mark.mark(toMark, { 76 | accuracy: { 77 | value: "complementary", 78 | limiters: [",", ".", ":", "/"], 79 | } 80 | }); 81 | } 82 | 83 | /* Search --------------------------*/ 84 | /* Adapted from https://github.com/rstudio/bookdown/blob/2d692ba4b61f1e466c92e78fd712b0ab08c11d31/inst/resources/bs4_book/bs4_book.js#L25 */ 85 | // Initialise search index on focus 86 | var fuse; 87 | $("#search-input").focus(async function(e) { 88 | if (fuse) { 89 | return; 90 | } 91 | 92 | $(e.target).addClass("loading"); 93 | var response = await fetch($("#search-input").data("search-index")); 94 | var data = await response.json(); 95 | 96 | var options = { 97 | keys: ["what", "text", "code"], 98 | ignoreLocation: true, 99 | threshold: 0.1, 100 | includeMatches: true, 101 | includeScore: true, 102 | }; 103 | fuse = new Fuse(data, options); 104 | 105 | $(e.target).removeClass("loading"); 106 | }); 107 | 108 | // Use algolia autocomplete 109 | var options = { 110 | autoselect: true, 111 | debug: true, 112 | hint: false, 113 | minLength: 2, 114 | }; 115 | var q; 116 | async function searchFuse(query, callback) { 117 | await fuse; 118 | 119 | var items; 120 | if (!fuse) { 121 | items = []; 122 | } else { 123 | q = query; 124 | var results = fuse.search(query, { limit: 20 }); 125 | items = results 126 | .filter((x) => x.score <= 0.75) 127 | .map((x) => x.item); 128 | if (items.length === 0) { 129 | items = [{dir:"Sorry 😿",previous_headings:"",title:"No results found.",what:"No results found.",path:window.location.href}]; 130 | } 131 | } 132 | callback(items); 133 | } 134 | $("#search-input").autocomplete(options, [ 135 | { 136 | name: "content", 137 | source: searchFuse, 138 | templates: { 139 | suggestion: (s) => { 140 | if (s.title == s.what) { 141 | return `${s.dir} >
      ${s.title}
      `; 142 | } else if (s.previous_headings == "") { 143 | return `${s.dir} >
      ${s.title}
      > ${s.what}`; 144 | } else { 145 | return `${s.dir} >
      ${s.title}
      > ${s.previous_headings} > ${s.what}`; 146 | } 147 | }, 148 | }, 149 | }, 150 | ]).on('autocomplete:selected', function(event, s) { 151 | window.location.href = s.path + "?q=" + q + "#" + s.id; 152 | }); 153 | }); 154 | })(window.jQuery || window.$) 155 | 156 | document.addEventListener('keydown', function(event) { 157 | // Check if the pressed key is '/' 158 | if (event.key === '/') { 159 | event.preventDefault(); // Prevent any default action associated with the '/' key 160 | document.getElementById('search-input').focus(); // Set focus to the search input 161 | } 162 | }); 163 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.1.1 3 | pkgdown_sha: ~ 4 | articles: 5 | intro_to_arcpullr: intro_to_arcpullr.html 6 | raster_layers: raster_layers.html 7 | spatial_queries: spatial_queries.html 8 | last_built: 2025-02-06T17:33Z 9 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/figures/README-example-1.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/icons/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/icons/globe.png -------------------------------------------------------------------------------- /docs/reference/icons/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/icons/logo.png -------------------------------------------------------------------------------- /docs/reference/icons/make_hex_auto.R: -------------------------------------------------------------------------------- 1 | library(hexSticker) 2 | library(tidyverse) 3 | library(magick) 4 | 5 | globe <- 6 | "icons/globe.png" %>% 7 | image_read() %>% 8 | image_scale("200") 9 | cloud <- 10 | "icons/white_cloud.png" %>% 11 | image_read() %>% 12 | image_scale("200") 13 | pin <- 14 | "icons/pin.png" %>% 15 | image_read() %>% 16 | image_scale("200") 17 | 18 | cloudray1 <- arcpullr::sf_line(c(-88.75, 48.4), c(-87, 50)) 19 | cloudray2 <- arcpullr::sf_line(c(-87.2, 47.95), c(-85.3, 50)) 20 | cloudray3 <- arcpullr::sf_line(c(-85.9, 47.1), c(-83.75, 50)) 21 | 22 | plot <- 23 | ggplot() + 24 | geom_sf(data = cloudray1, size = 1, color = "#FFB612", lineend = "round") + 25 | geom_sf(data = cloudray2, size = 1, color = "#FFB612", lineend = "round") + 26 | geom_sf(data = cloudray3, size = 1, color = "#FFB612", lineend = "round") + 27 | coord_sf(xlim = c(-93, -82), ylim = c(42, 53)) + 28 | annotation_raster(globe, ymin = 42, ymax = 49, xmin = -94.5, xmax = -84.5) + 29 | annotation_raster(cloud, ymin = 49, ymax = Inf, xmin = -89, xmax = Inf) + 30 | annotation_raster(pin, ymin = 46.55, ymax = 48.3, xmin = -88, xmax = -90.5) + 31 | theme_void() 32 | 33 | sticker( 34 | plot, 35 | s_x = 1, 36 | s_width = 3, 37 | s_height = 1.25, 38 | p_y = 1.45, 39 | p_size = 20, 40 | p_family = "sans", 41 | p_fontface = "bold", 42 | p_color = "black", 43 | h_fill="#72a3d4", #fill hex code 44 | h_color="#2382a1", #border hex code 45 | package = "arcpullr", 46 | filename = "icons/logo.png" 47 | ) 48 | 49 | file.copy("icons/logo.png", "man/figures/logo.png", overwrite = TRUE) 50 | -------------------------------------------------------------------------------- /docs/reference/icons/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/icons/pin.png -------------------------------------------------------------------------------- /docs/reference/icons/white_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/docs/reference/icons/white_cloud.png -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | /404.html 3 | /articles/index.html 4 | /articles/intro_to_arcpullr.html 5 | /articles/raster_layers.html 6 | /articles/spatial_queries.html 7 | /authors.html 8 | /index.html 9 | /reference/arcpullr-package.html 10 | /reference/example_urls.html 11 | /reference/format_coords.html 12 | /reference/get_geometry_type.html 13 | /reference/get_image_layer.html 14 | /reference/get_layers_by_spatial.html 15 | /reference/get_layer_html.html 16 | /reference/get_layer_info.html 17 | /reference/get_layer_legend.html 18 | /reference/get_map_layer.html 19 | /reference/get_raster_layer.html 20 | /reference/get_service_type.html 21 | /reference/get_sf_crs.html 22 | /reference/get_spatial_layer.html 23 | /reference/get_table_layer.html 24 | /reference/index.html 25 | /reference/match_legend_colors.html 26 | /reference/match_raster_colors.html 27 | /reference/plot_layer-RasterBrick-method.html 28 | /reference/plot_layer-RasterLayer-method.html 29 | /reference/plot_layer-RasterStack-method.html 30 | /reference/plot_layer-sf-method.html 31 | /reference/plot_layer-SpatRaster-method.html 32 | /reference/plot_layer.html 33 | /reference/raster_colors-RasterBrick-method.html 34 | /reference/raster_colors-RasterLayer-method.html 35 | /reference/raster_colors-RasterStack-method.html 36 | /reference/raster_colors-SpatRaster-method.html 37 | /reference/raster_colors.html 38 | /reference/sf_example_polys.html 39 | /reference/sf_example_raster.html 40 | /reference/sf_objects.html 41 | /reference/sp_rel_lookups.html 42 | /reference/sp_rel_xref.html 43 | /reference/sql_where.html 44 | /reference/valid_sp_rel.html 45 | 46 | 47 | -------------------------------------------------------------------------------- /icons/globe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/icons/globe.png -------------------------------------------------------------------------------- /icons/make_hex_auto.R: -------------------------------------------------------------------------------- 1 | library(hexSticker) 2 | library(tidyverse) 3 | library(magick) 4 | 5 | globe <- 6 | "icons/globe.png" %>% 7 | image_read() %>% 8 | image_scale("200") 9 | cloud <- 10 | "icons/white_cloud.png" %>% 11 | image_read() %>% 12 | image_scale("200") 13 | pin <- 14 | "icons/pin.png" %>% 15 | image_read() %>% 16 | image_scale("200") 17 | 18 | cloudray1 <- arcpullr::sf_line(c(-88.75, 48.4), c(-87, 50)) 19 | cloudray2 <- arcpullr::sf_line(c(-87.2, 47.95), c(-85.3, 50)) 20 | cloudray3 <- arcpullr::sf_line(c(-85.9, 47.1), c(-83.75, 50)) 21 | 22 | plot <- 23 | ggplot() + 24 | geom_sf(data = cloudray1, size = 1, color = "#FFB612", lineend = "round") + 25 | geom_sf(data = cloudray2, size = 1, color = "#FFB612", lineend = "round") + 26 | geom_sf(data = cloudray3, size = 1, color = "#FFB612", lineend = "round") + 27 | coord_sf(xlim = c(-93, -82), ylim = c(42, 53)) + 28 | annotation_raster(globe, ymin = 42, ymax = 49, xmin = -94.5, xmax = -84.5) + 29 | annotation_raster(cloud, ymin = 49, ymax = Inf, xmin = -89, xmax = Inf) + 30 | annotation_raster(pin, ymin = 46.55, ymax = 48.3, xmin = -88, xmax = -90.5) + 31 | theme_void() 32 | 33 | sticker( 34 | plot, 35 | s_x = 1, 36 | s_width = 3, 37 | s_height = 1.25, 38 | p_y = 1.45, 39 | p_size = 20, 40 | p_family = "sans", 41 | p_fontface = "bold", 42 | p_color = "black", 43 | h_fill="#72a3d4", #fill hex code 44 | h_color="#2382a1", #border hex code 45 | package = "arcpullr", 46 | filename = "icons/logo.png" 47 | ) 48 | 49 | file.copy("icons/logo.png", "man/figures/logo.png", overwrite = TRUE) 50 | -------------------------------------------------------------------------------- /icons/pin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/icons/pin.png -------------------------------------------------------------------------------- /icons/white_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/icons/white_cloud.png -------------------------------------------------------------------------------- /inst/wi_aerial_imagery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/inst/wi_aerial_imagery.png -------------------------------------------------------------------------------- /inst/wi_aerial_imagery.png.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]] 3 | -9.2922294616699205e+01, 1.4911231994628764e-02, 0.0000000000000000e+00, 4.6938265266418441e+01, 0.0000000000000000e+00, -1.4911231994628772e-02 4 | 5 | PIXEL 6 | 7 | 8 | red 9 | nan 10 | 11 | 255 12 | -9999 13 | 2 14 | -9999 15 | 16 | 17 | 18 | green 19 | nan 20 | 21 | 255 22 | -9999 23 | 3 24 | -9999 25 | 26 | 27 | 28 | blue 29 | nan 30 | 31 | 255 32 | -9999 33 | 13 34 | -9999 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /inst/wi_landcover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/inst/wi_landcover.png -------------------------------------------------------------------------------- /inst/wi_landcover.png.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]] 3 | -9.2922294616699205e+01, 1.4911231994628764e-02, 0.0000000000000000e+00, 4.6938265266418455e+01, 0.0000000000000000e+00, -1.4911231994628772e-02 4 | 5 | _ags_mape705ddd9df0d4616b113d65dc3885fe3 6 | 2.55000000000000E+02 7 | 8 | 16 9 | -9999 10 | 1 11 | -9999 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /man/arcpullr-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/arcpullr-package.R 3 | \docType{package} 4 | \name{arcpullr-package} 5 | \alias{arcpullr-package} 6 | \alias{arcpullr} 7 | \title{arcpullr} 8 | \description{ 9 | A package for pulling spatial data from an ArcGIS REST API 10 | } 11 | \details{ 12 | \if{html}{\figure{logo.png}{options: alt='logo' width='15\%'}} 13 | \if{latex}{\figure{logo.png}{options: width=0.5in}} 14 | The role of the arcpullr package is simple...to pull spatial data from an 15 | ArcGIS REST API. These APIs are housed by various different agencies, 16 | organizations, entitites, etc., but allow a consistent format for storing and 17 | retrieving spatial data 18 | } 19 | \section{\code{\link{get_spatial_layer}}}{ 20 | 21 | This function makes up the core of the package. It allows users to pull 22 | spatial data given a URL of an ArcGIS REST API. There are many additional 23 | query parameters that can (and probably should) be added; however, we've 24 | simplified many of these out for you with the functions below. 25 | } 26 | 27 | \section{\code{\link{get_layer_by_spatial}} family of functions}{ 28 | 29 | These functions allow you to pull layers using a spatial query. The abstract 30 | syntax is wrapped into the functions, so all you have to do is pass these 31 | functions an sf object of the spatial area, line, or point you want to query 32 | by. These functions include get_layer_by_poly, get_layer_by_point, 33 | get_layer_by_line, get_layer_by_multipoint, and get_layer_by_envelope. It 34 | should be fairly obvious what type of spatial layer each function takes with 35 | the exception of get_layer_by_envelope except that it isn't particularly 36 | useful for a single point. 37 | } 38 | 39 | \section{\code{\link{get_image_layer}}}{ 40 | 41 | This is one of the core functions of the package. It retrieves image service 42 | layers from an ArcGIS REST API designated by the URL 43 | } 44 | 45 | \section{\code{\link{get_map_layer}}}{ 46 | 47 | This is one of the core functions of the package. It retrieves map service 48 | layers from an ArcGIS REST API designated by the URL 49 | } 50 | 51 | \section{Helper functions}{ 52 | 53 | There are a few utility functions to help you along the way. The first is 54 | \code{\link{plot_layer}}, which is a useful way to plot the spatial layer 55 | you've tried to pull just to make sure it works. If you want fancier maps 56 | you'd be better served with ggplot2 or tmaps, though. 57 | 58 | Other helpers include the \code{\link{sf_objects}} functions, which allow 59 | you to easily create sf points, lines, and polygons with a few coordinates. 60 | 61 | Lastly, there is a \code{\link{sql_where}} function to help aid in building 62 | more complex SQL WHERE clauses used to query by the where argument in the 63 | retrieval functions above. 64 | } 65 | 66 | \author{ 67 | \strong{Maintainer}: Paul Frater \email{paul.frater@wisconsin.gov} (\href{https://orcid.org/0000-0002-7237-6563}{ORCID}) 68 | 69 | Authors: 70 | \itemize{ 71 | \item Zac Driscoll \email{zdriscoll@mmsd.com} (\href{https://orcid.org/0000-0002-8233-0980}{ORCID}) 72 | } 73 | 74 | } 75 | \keyword{internal} 76 | -------------------------------------------------------------------------------- /man/example_urls.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{example_urls} 5 | \alias{example_urls} 6 | \alias{reykjanes_lava_flow_url} 7 | \alias{wi_hydro_url} 8 | \alias{wi_landcover_url} 9 | \alias{wi_leaf_off_url} 10 | \title{Various URLs used in examples} 11 | \format{ 12 | Character strings of URLs 13 | 14 | An object of class \code{character} of length 1. 15 | 16 | An object of class \code{character} of length 1. 17 | 18 | An object of class \code{character} of length 1. 19 | } 20 | \usage{ 21 | reykjanes_lava_flow_url 22 | 23 | wi_hydro_url 24 | 25 | wi_landcover_url 26 | 27 | wi_leaf_off_url 28 | } 29 | \description{ 30 | These are URLs that are used for examples throughout the package 31 | } 32 | \keyword{datasets} 33 | -------------------------------------------------------------------------------- /man/figures/README-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/man/figures/README-example-1.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/man/figures/logo.png -------------------------------------------------------------------------------- /man/format_coords.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{format_coords} 4 | \alias{format_coords} 5 | \alias{format_polygon_coords} 6 | \alias{format_line_coords} 7 | \alias{format_multipoint_coords} 8 | \alias{format_point_coords} 9 | \alias{format_envelope_coords} 10 | \title{Convert coordinates from an 'sf' object to formatted well-known text} 11 | \usage{ 12 | format_polygon_coords(sf_obj) 13 | 14 | format_line_coords(sf_obj) 15 | 16 | format_multipoint_coords(sf_obj) 17 | 18 | format_point_coords(sf_obj) 19 | 20 | format_envelope_coords(sf_obj) 21 | 22 | format_coords(sf_obj, geom_type) 23 | } 24 | \arguments{ 25 | \item{sf_obj}{An sf object} 26 | 27 | \item{geom_type}{Either "points", "paths", or "rings". Choose wisely} 28 | } 29 | \value{ 30 | String of well known text 31 | } 32 | \description{ 33 | Use this function to convert the coordinates of a sf polygon object to 34 | a string of well known text. The output can be passed to an ArcGIS REST 35 | API to perform a spatial query. 36 | } 37 | \details{ 38 | Spatial queries from an ArcGIS REST API require specific text inputs 39 | formatted in a way called well-known text (WKT). ArcGIS REST APIs have their 40 | own syntax for how the text is taken. These functions will format sf objects 41 | in the correct way to be able to make spatial queries from a ArcGIS REST 42 | API 43 | } 44 | \examples{ 45 | mke_polygon_coords <- format_polygon_coords(mke_county) 46 | } 47 | -------------------------------------------------------------------------------- /man/get_geometry_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{get_geometry_type} 4 | \alias{get_geometry_type} 5 | \title{Get Geometry Type} 6 | \usage{ 7 | get_geometry_type(url) 8 | } 9 | \arguments{ 10 | \item{url}{A character string of a feature services URL} 11 | } 12 | \value{ 13 | A character string of the layers geometry type 14 | } 15 | \description{ 16 | Get Geometry Type 17 | } 18 | \examples{ 19 | \dontrun{ 20 | get_geometry_type(reykjanes_lava_flow_url) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /man/get_image_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_image_layer} 4 | \alias{get_image_layer} 5 | \title{Retrieve an image service layer from an ArcGIS REST API} 6 | \usage{ 7 | get_image_layer( 8 | url, 9 | sf_object = NULL, 10 | bbox = NULL, 11 | bbox_crs = NULL, 12 | token = "", 13 | clip_raster = TRUE, 14 | format = "png", 15 | transparent = TRUE, 16 | ... 17 | ) 18 | } 19 | \arguments{ 20 | \item{url}{A character string of the url for the layer to pull} 21 | 22 | \item{sf_object}{An \code{sf} object used for the bounding box} 23 | 24 | \item{bbox}{Vector of bounding box coordinates} 25 | 26 | \item{bbox_crs}{CRS for bbox (required if bbox is used)} 27 | 28 | \item{token}{A character string of the token (if needed)} 29 | 30 | \item{clip_raster}{Logical. Should the raster be clipped to contain only 31 | the pixels that reside in the \code{sf_object}? By default, ArcGIS returns 32 | some overlapping edge pixels. Setting \code{clip_raster} to TRUE (default) 33 | will remove these using \code{\link[raster]{mask}} from the \code{raster} 34 | package} 35 | 36 | \item{format}{The raster format desired. Default is "png"} 37 | 38 | \item{transparent}{Logical. Retrieve a raster with a transparent background 39 | (TRUE, default) or not (FALSE)} 40 | 41 | \item{...}{Additional arguments to pass to the ArcGIS REST API} 42 | } 43 | \value{ 44 | A "SpatRaster" object 45 | } 46 | \description{ 47 | This function retrieves image service layers from an ArcGIS 48 | REST services API and returns them as a \code{RasterStack} object 49 | } 50 | \details{ 51 | This is one of the core functions of the package. It retrieves image service 52 | layers from an ArcGIS REST API designated by the URL. These layers require a 53 | bounding box to query the map layer, which is either taken from the 54 | \code{sf_object} argument or optionally can be passed via the \code{bbox} 55 | argument. Either \code{sf_object} or \code{bbox} are optional, but one of 56 | them must be present. 57 | 58 | All of the querying parameters are sent via a POST request to the URL, so 59 | if there are issues with passing additional parameters via \code{...} 60 | first determine how they fit into the POST request and make adjustments as 61 | needed. This syntax can be tricky if you're not used to it. 62 | } 63 | \examples{ 64 | \dontrun{ 65 | wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly) 66 | plot_layer(wi_leaf_off_layer, outline_poly = wis_poly) 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /man/get_layer_html.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{get_layer_html} 4 | \alias{get_layer_html} 5 | \title{Pull the HTML body from a web page} 6 | \usage{ 7 | get_layer_html(url) 8 | } 9 | \arguments{ 10 | \item{url}{Character. The URL of the web page} 11 | } 12 | \value{ 13 | A character string of the HTML body 14 | } 15 | \description{ 16 | Used internally to pull HTML for a layer's web page so that the call 17 | doesn't have to be made twice in \code{\link{get_geometry_type}} if the 18 | url provided there is for a raster layer. 19 | } 20 | -------------------------------------------------------------------------------- /man/get_layer_info.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_layer_info} 4 | \alias{get_layer_info} 5 | \title{Retrieve metadata for a layer} 6 | \usage{ 7 | get_layer_info(url, token = "") 8 | } 9 | \arguments{ 10 | \item{url}{A character string of the url for the layer to pull} 11 | 12 | \item{token}{A character string of the token (if needed)} 13 | } 14 | \value{ 15 | A list of metadata fields 16 | } 17 | \description{ 18 | This function retrieves metadata for a layer. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | # lava flows on Reykjanes (pr. 'rake-yah-ness') peninsula in Iceland 23 | lava_flows_info <- get_layer_info(reykjanes_lava_flow_url) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /man/get_layer_legend.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layer_properties.R 3 | \name{get_layer_legend} 4 | \alias{get_layer_legend} 5 | \title{Returns a legend for a raster layer} 6 | \usage{ 7 | get_layer_legend(url) 8 | } 9 | \arguments{ 10 | \item{url}{A URL to a Map or Image Service layer} 11 | } 12 | \value{ 13 | A data.frame with two columns (color, values) and the number of 14 | rows equal to the number of values in a layer 15 | } 16 | \description{ 17 | Raster layers are accompanied with legends to identify what the colors mean. 18 | This function retrieves those legend values and returns them as a data.frame 19 | with the associated RGB color values. This will likely be most useful for 20 | plotting and analysis of map layers. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | get_layer_legend(wi_landcover_url) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /man/get_layers_by_spatial.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers_by_geometry.R 3 | \name{get_layers_by_spatial} 4 | \alias{get_layers_by_spatial} 5 | \alias{get_layer_by_poly} 6 | \alias{get_layer_by_line} 7 | \alias{get_layer_by_point} 8 | \alias{get_layer_by_multipoint} 9 | \alias{get_layer_by_envelope} 10 | \alias{get_layer_by_spatial} 11 | \title{Retrieve ArcGIS REST API spatial layer by spatial query} 12 | \usage{ 13 | get_layer_by_poly(url, geometry, sp_rel = "contains", ...) 14 | 15 | get_layer_by_line(url, geometry, sp_rel = "intersects", ...) 16 | 17 | get_layer_by_point(url, geometry, sp_rel = "intersects", ...) 18 | 19 | get_layer_by_multipoint(url, geometry, sp_rel = "intersects", ...) 20 | 21 | get_layer_by_envelope(url, geometry, sp_rel = "intersects", ...) 22 | 23 | get_layer_by_spatial( 24 | url, 25 | geometry, 26 | geom_type, 27 | sp_ref = NULL, 28 | sp_rel = "intersects", 29 | ... 30 | ) 31 | } 32 | \arguments{ 33 | \item{url}{A character string of the url for the layer to pull} 34 | 35 | \item{geometry}{An \code{sf} object used for the spatial query} 36 | 37 | \item{sp_rel}{Character. The type of relationship to query by. Possible 38 | options include "intersects", "contains", and "crosses"} 39 | 40 | \item{...}{Additional arguements to pass to \code{\link{get_spatial_layer}}} 41 | 42 | \item{geom_type}{A character of the geometry type to be used. This param is 43 | automatically specified in all \code{get_layer_by_*} functions except 44 | \code{get_spatial_layer}} 45 | 46 | \item{sp_ref}{The spatial reference value} 47 | } 48 | \value{ 49 | An object of class "sf" of the appropriate layer 50 | } 51 | \description{ 52 | These functions are wrappers around \code{\link{get_spatial_layer}} that are 53 | specialized for querying by a spatial layer. They will make a POST request 54 | to the query URL which returns data (if available) based on the appropriate 55 | spatial feature (\code{geometry}) and relationship (\code{sp_rel}). 56 | } 57 | \examples{ 58 | \dontrun{ 59 | mke_waters <- get_layer_by_poly(wi_hydro_url, mke_county) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /man/get_map_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_map_layer} 4 | \alias{get_map_layer} 5 | \title{Retrieve a map service layer from an ArcGIS REST API} 6 | \usage{ 7 | get_map_layer( 8 | url, 9 | sf_object = NULL, 10 | bbox = NULL, 11 | bbox_crs = NULL, 12 | token = "", 13 | clip_raster = TRUE, 14 | format = "png", 15 | transparent = TRUE, 16 | add_legend = TRUE, 17 | ... 18 | ) 19 | } 20 | \arguments{ 21 | \item{url}{A character string of the url for the layer to pull} 22 | 23 | \item{sf_object}{An \code{sf} object used for the bounding box} 24 | 25 | \item{bbox}{Vector of bounding box coordinates} 26 | 27 | \item{bbox_crs}{CRS for bbox (required if bbox is used)} 28 | 29 | \item{token}{A character string of the token (if needed)} 30 | 31 | \item{clip_raster}{Logical. Should the raster be clipped to contain only 32 | the pixels that reside in the \code{sf_object}? By default, ArcGIS returns 33 | some overlapping edge pixels. Setting \code{clip_raster} to TRUE (default) 34 | will remove these using \code{\link[raster]{mask}} from the \code{raster} 35 | package} 36 | 37 | \item{format}{The raster format desired. Default is "png"} 38 | 39 | \item{transparent}{Logical. Retrieve a raster with a transparent background 40 | (TRUE, default) or not (FALSE)} 41 | 42 | \item{add_legend}{Logical. Pull legend and match to color values 43 | (TRUE, default) or not (FALSE)} 44 | 45 | \item{...}{Additional arguments to pass to the ArcGIS REST API} 46 | } 47 | \value{ 48 | A "SpatRaster" object 49 | } 50 | \description{ 51 | This function retrieves map service layers from an ArcGIS 52 | REST services API and returns them as a \code{RasterLayer} object 53 | } 54 | \details{ 55 | This is one of the core functions of the package. It retrieves map service 56 | layers from an ArcGIS REST API designated by the URL. These layers require a 57 | bounding box to query the map layer, which is either taken from the 58 | \code{sf_object} argument or optionally can be passed via the \code{bbox} 59 | argument. Either \code{sf_object} or \code{bbox} are optional, but one of 60 | them must be present. 61 | 62 | All of the querying parameters are sent via a POST request to the URL, so 63 | if there are issues with passing additional parameters via \code{...} 64 | first determine how they fit into the POST request and make adjustments as 65 | needed. This syntax can be tricky if you're not used to it. 66 | } 67 | \examples{ 68 | \dontrun{ 69 | wi_landcover<- get_map_layer(wi_landcover_url, wis_poly) 70 | plot_layer(wi_landcover, outline_poly = wis_poly) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /man/get_raster_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_raster_layer} 4 | \alias{get_raster_layer} 5 | \title{Pull a raster layer from a map service or image service layer of an ArcGIS 6 | REST API} 7 | \usage{ 8 | get_raster_layer( 9 | url, 10 | sf_object = NULL, 11 | bbox = NULL, 12 | bbox_crs = NULL, 13 | token = "", 14 | clip_raster = TRUE, 15 | format = "png", 16 | transparent = TRUE, 17 | export_type = "map", 18 | add_legend = FALSE, 19 | ... 20 | ) 21 | } 22 | \arguments{ 23 | \item{url}{A character string of the url for the layer to pull} 24 | 25 | \item{sf_object}{An \code{sf} object used for the bounding box} 26 | 27 | \item{bbox}{Vector of bounding box coordinates} 28 | 29 | \item{bbox_crs}{CRS for bbox (required if bbox is used)} 30 | 31 | \item{token}{A character string of the token (if needed)} 32 | 33 | \item{clip_raster}{Logical. Should the raster be clipped to contain only 34 | the pixels that reside in the \code{sf_object}? By default, ArcGIS returns 35 | some overlapping edge pixels. Setting \code{clip_raster} to TRUE (default) 36 | will remove these using \code{\link[raster]{mask}} from the \code{raster} 37 | package} 38 | 39 | \item{format}{The raster format desired. Default is "png"} 40 | 41 | \item{transparent}{Logical. Retrieve a raster with a transparent background 42 | (TRUE, default) or not (FALSE)} 43 | 44 | \item{export_type}{Character. Either "map" or "image" for the respective 45 | service layer desired} 46 | 47 | \item{add_legend}{Logical. Pull legend and match to color values 48 | (TRUE, default) or not (FALSE)} 49 | 50 | \item{...}{Additional arguments to pass to the ArcGIS REST API} 51 | } 52 | \value{ 53 | An object of type \code{SpatRaster} 54 | } 55 | \description{ 56 | This is an internal function to pull raster layers from either a map service 57 | or an image service of an ArcGIS REST API. This function is the engine that 58 | drives \code{\link{get_map_layer}} and \code{\link{get_image_layer}} 59 | } 60 | -------------------------------------------------------------------------------- /man/get_service_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{get_service_type} 4 | \alias{get_service_type} 5 | \title{Get elements of a Service or Layer from an ArcGIS REST endpoint} 6 | \usage{ 7 | get_service_type(url, ...) 8 | } 9 | \arguments{ 10 | \item{url}{A character string of a valid layer URL} 11 | 12 | \item{...}{Only used internally, but html can be passed} 13 | } 14 | \value{ 15 | A character string defining the layer type 16 | } 17 | \description{ 18 | This family of functions is meant to pull attributes from a particular 19 | service or layer hosted on an ArcGIS REST API. If the service is an 20 | ImageServer or MapServer, then the behavior will be slightly different than 21 | for a Feature Layer (see details). 22 | } 23 | \details{ 24 | \code{get_service_type} will return the type of service or layer for the 25 | respective URL (or html) that is passed to the function. For a feature layer 26 | the function should return "feature_layer", for a Image or Map Server the 27 | function will return "image" or "map", respectively. 28 | 29 | \code{get_geometry_type} will return the geometry type of feature service 30 | layers housed on an ArcGIS REST API server. If a URL is provided that points 31 | to a map or image layer the function will return an error (i.e. only 32 | feature layers have geometry types). 33 | 34 | \code{get_supported_operations} will simply return a character vector that 35 | lists the supported operations for \code{url}. 36 | } 37 | \examples{ 38 | \dontrun{ 39 | get_service_type(reykjanes_lava_flow_url) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /man/get_sf_crs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{get_sf_crs} 4 | \alias{get_sf_crs} 5 | \title{Return CRS value of an sf object} 6 | \usage{ 7 | get_sf_crs(sf_obj) 8 | } 9 | \arguments{ 10 | \item{sf_obj}{An object of class sf} 11 | } 12 | \value{ 13 | A numeric value referring to the coordinate reference system 14 | } 15 | \description{ 16 | Return CRS value of an sf object 17 | } 18 | \examples{ 19 | get_sf_crs(iceland_poly) 20 | } 21 | -------------------------------------------------------------------------------- /man/get_spatial_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_spatial_layer} 4 | \alias{get_spatial_layer} 5 | \title{Retrieve a feature service layer from an ArcGIS REST API} 6 | \usage{ 7 | get_spatial_layer( 8 | url, 9 | out_fields = c("*"), 10 | where = "1=1", 11 | token = "", 12 | sf_type = NULL, 13 | head = FALSE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{url}{A character string of the url for the layer to pull} 19 | 20 | \item{out_fields}{A character string of the fields to pull for each layer} 21 | 22 | \item{where}{A character string of the where condition. Default is 1=1} 23 | 24 | \item{token}{A character string of the token (if needed)} 25 | 26 | \item{sf_type}{A character string specifying the layer geometry to convert to 27 | sf ("esriGeometryPolygon", "esriGeometryPoint", "esriGeometryPolyline"), 28 | if NULL (default) the server will take its best guess} 29 | 30 | \item{head}{Logical or numeric. Limits the number of records returned from a 31 | query. If TRUE, only the first 5 records will be returned. If numeric, then 32 | the number of records specified in \code{head} will be returned} 33 | 34 | \item{...}{Additional arguments to pass to the ArcGIS REST POST request (or 35 | associated internal functions used to query them)} 36 | } 37 | \value{ 38 | An object of class "sf" of the appropriate layer 39 | } 40 | \description{ 41 | This function retrieves spatial layers present in Feature Service layers of 42 | an ArcGIS REST services API and returns them as an \code{sf} object 43 | } 44 | \details{ 45 | This is one of the core functions of this package. It retrieves spatial 46 | layers from feature services of an ArcGIS REST API designated by the URL. 47 | Additional querying features can be passed such as a SQL WHERE statement 48 | (\code{where} argument) or spatial queries as well as any other types of 49 | queries that the ArcGIS REST API accepts (using \code{...}). However, for 50 | easier spatial querying see \code{\link{get_layers_by_spatial}}. 51 | 52 | All of the querying parameters are sent via a POST request to the URL, so 53 | if there are issues with passing additional parameters via \code{...} 54 | first determine how they fit into the POST request and make adjustments as 55 | needed. This syntax can be tricky if you're not used to it. 56 | } 57 | \examples{ 58 | \dontrun{ 59 | # lava flows on Reykjanes (pr. 'rake-yah-ness') peninsula in Iceland 60 | lava_flows <- get_spatial_layer(reykjanes_lava_flow_url) 61 | plot_layer(lava_flows, outline_poly = reykjanes_poly) 62 | plot_layer(lava_flows, outline_poly = iceland_poly) 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /man/get_table_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/retrieve_layers.R 3 | \name{get_table_layer} 4 | \alias{get_table_layer} 5 | \title{Retrieve a table from an ArcGIS REST API} 6 | \usage{ 7 | get_table_layer( 8 | url, 9 | out_fields = "*", 10 | where = "1=1", 11 | token = "", 12 | head = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{url}{A character string of the url for the layer to pull} 18 | 19 | \item{out_fields}{A character string of the fields to pull for each layer} 20 | 21 | \item{where}{A character string of the where condition. Default is 1=1} 22 | 23 | \item{token}{A character string of the token (if needed)} 24 | 25 | \item{head}{Logical or numeric. Limits the number of records returned from a 26 | query. If TRUE, only the first 5 records will be returned. If numeric, then 27 | the number of records specified in \code{head} will be returned} 28 | 29 | \item{...}{Additional arguments to pass to the ArcGIS REST POST request (or 30 | associated internal functions used to query them)} 31 | } 32 | \value{ 33 | A data frame of the appropriate layer 34 | } 35 | \description{ 36 | This function retrieves tables present in an ArcGIS REST services API and 37 | returns them as a data frame. 38 | } 39 | \details{ 40 | This function retrieves tables from an ArcGIS REST API designated by the 41 | URL. Additional querying features can be passed such as a SQL WHERE 42 | statement (\code{where} argument) as well as any other types of queries 43 | that the ArcGIS REST API accepts (using \code{...}). 44 | 45 | All of the querying parameters are sent via a POST request to the URL, so 46 | if there are issues with passing additional parameters via \code{...} 47 | first determine how they fit into the POST request and make adjustments as 48 | needed. This syntax can be tricky if you're not used to it. 49 | } 50 | -------------------------------------------------------------------------------- /man/match_legend_colors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{match_legend_colors} 4 | \alias{match_legend_colors} 5 | \title{Match colors in SpatRaster coltab to the provided legend values} 6 | \usage{ 7 | match_legend_colors(legend, raster_cols) 8 | } 9 | \arguments{ 10 | \item{legend}{An object of class raster_legend as returned by 11 | \code{\link{get_layer_legend}}} 12 | 13 | \item{raster_cols}{The colortable from a SpatRaster object. Use the first 14 | item in the list} 15 | } 16 | \value{ 17 | A raster_legend object with corrected colors to match those in 18 | \code{x} 19 | } 20 | \description{ 21 | Colors provided by the legend do not always correspond exactly with the 22 | colors in the coltab of a SpatRaster object. They are usually pretty 23 | close, though, so this function finds the closest colors, maps them to the 24 | appropriate colors in the Raster* object, and applies that to the legend. 25 | } 26 | \details{ 27 | Raster colors in \code{x} are mapped to those in \code{legend} by converting 28 | the RGB hexadecimal values to a 3D vector of values for red, green and blue. 29 | The closest values are then assigned using 3D Pythagorean theorem to compute 30 | the distance among all colors. The minimum distance in three dimensional 31 | space is the color in \code{x} that gets mapped to the appropriate color in 32 | \code{legend}. 33 | } 34 | \examples{ 35 | \dontrun{ 36 | wi_landcover <- get_map_layer(wi_landcover_url, wis_poly) 37 | legend <- get_layer_legend(wi_landcover_url) 38 | new_legend <- match_legend_colors(legend, wi_landcover_url) 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /man/plot_layer-RasterBrick-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer,RasterBrick-method} 4 | \alias{plot_layer,RasterBrick-method} 5 | \title{Plot a RasterBrick object} 6 | \usage{ 7 | \S4method{plot_layer}{RasterBrick}( 8 | x, 9 | outline_poly = NULL, 10 | outline_size = 1.2, 11 | outline_color = "gray30", 12 | plot_pkg = "ggplot", 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{An sf or Raster* object as returned from a 18 | \code{get_*_layer} function} 19 | 20 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 21 | context} 22 | 23 | \item{outline_size}{Numeric argument that controls width of parameter} 24 | 25 | \item{outline_color}{A character vector of a valid color} 26 | 27 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 28 | (default) or "base"} 29 | 30 | \item{...}{Additional arguments to \code{plot_layer}} 31 | } 32 | \description{ 33 | Plot a RasterBrick object 34 | } 35 | \examples{ 36 | \dontrun{ 37 | wi_aerial <- get_map_layer(wi_leaf_off_url, wis_poly) 38 | plot_layer(wi_aerial, outline_poly = wis_poly) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /man/plot_layer-RasterLayer-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer,RasterLayer-method} 4 | \alias{plot_layer,RasterLayer-method} 5 | \title{Plot a RasterLayer object} 6 | \usage{ 7 | \S4method{plot_layer}{RasterLayer}( 8 | x, 9 | outline_poly = NULL, 10 | outline_size = 1.2, 11 | outline_color = "gray30", 12 | legend = TRUE, 13 | plot_pkg = "ggplot", 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{x}{An sf or Raster* object as returned from a 19 | \code{get_*_layer} function} 20 | 21 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 22 | context} 23 | 24 | \item{outline_size}{Numeric argument that controls width of parameter} 25 | 26 | \item{outline_color}{A character vector of a valid color} 27 | 28 | \item{legend}{Logical. Only valid when plotting RasterLayers 29 | retrieved from \code{\link{get_map_layer}} where legend was also retrieved} 30 | 31 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 32 | (default) or "base"} 33 | 34 | \item{...}{Additional arguments to \code{plot_layer}} 35 | } 36 | \description{ 37 | Plot a RasterLayer object 38 | } 39 | \examples{ 40 | \dontrun{ 41 | wi_landcover <- get_map_layer(wi_landcover_url, wis_poly) 42 | plot_layer(wi_landcover, outline_poly = wis_poly) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /man/plot_layer-RasterStack-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer,RasterStack-method} 4 | \alias{plot_layer,RasterStack-method} 5 | \title{Plot a RasterStack object} 6 | \usage{ 7 | \S4method{plot_layer}{RasterStack}( 8 | x, 9 | outline_poly = NULL, 10 | outline_size = 1.2, 11 | outline_color = "gray30", 12 | plot_pkg = "ggplot", 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{An sf or Raster* object as returned from a 18 | \code{get_*_layer} function} 19 | 20 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 21 | context} 22 | 23 | \item{outline_size}{Numeric argument that controls width of parameter} 24 | 25 | \item{outline_color}{A character vector of a valid color} 26 | 27 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 28 | (default) or "base"} 29 | 30 | \item{...}{Additional arguments to \code{plot_layer}} 31 | } 32 | \description{ 33 | Plot a RasterStack object 34 | } 35 | \examples{ 36 | \dontrun{ 37 | wi_aerial <- get_map_layer(wi_leaf_off_url, wis_poly) 38 | plot_layer(wi_aerial, outline_poly = wis_poly) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /man/plot_layer-SpatRaster-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer,SpatRaster-method} 4 | \alias{plot_layer,SpatRaster-method} 5 | \title{Plot a SpatRaster object} 6 | \usage{ 7 | \S4method{plot_layer}{SpatRaster}( 8 | x, 9 | outline_poly = NULL, 10 | outline_size = 1.2, 11 | outline_color = "gray30", 12 | plot_pkg = "ggplot", 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{An sf or Raster* object as returned from a 18 | \code{get_*_layer} function} 19 | 20 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 21 | context} 22 | 23 | \item{outline_size}{Numeric argument that controls width of parameter} 24 | 25 | \item{outline_color}{A character vector of a valid color} 26 | 27 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 28 | (default) or "base"} 29 | 30 | \item{...}{Additional arguments to \code{plot_layer}} 31 | } 32 | \description{ 33 | Plot a SpatRaster object 34 | } 35 | \examples{ 36 | \dontrun{ 37 | wi_aerial <- get_map_layer(wi_leaf_off_url, wis_poly) 38 | plot_layer(wi_aerial, outline_poly = wis_poly) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /man/plot_layer-sf-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer,sf-method} 4 | \alias{plot_layer,sf-method} 5 | \title{Plot an sf object} 6 | \usage{ 7 | \S4method{plot_layer}{sf}( 8 | x, 9 | outline_poly = NULL, 10 | outline_size = 1.2, 11 | outline_color = "gray30", 12 | plot_pkg = "ggplot", 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{An sf or Raster* object as returned from a 18 | \code{get_*_layer} function} 19 | 20 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 21 | context} 22 | 23 | \item{outline_size}{Numeric argument that controls width of parameter} 24 | 25 | \item{outline_color}{A character vector of a valid color} 26 | 27 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 28 | (default) or "base"} 29 | 30 | \item{...}{Additional arguments to \code{plot_layer}} 31 | } 32 | \description{ 33 | Plot an sf object 34 | } 35 | \examples{ 36 | \dontrun{ 37 | plot_layer(wis_poly) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /man/plot_layer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_layers.R 3 | \name{plot_layer} 4 | \alias{plot_layer} 5 | \alias{plot_layer.sf} 6 | \title{Plot a spatial layer} 7 | \usage{ 8 | plot_layer(x, ...) 9 | 10 | plot_layer.sf( 11 | x, 12 | outline_poly = NULL, 13 | outline_size = 1.2, 14 | outline_color = "gray30", 15 | plot_pkg = "ggplot", 16 | ... 17 | ) 18 | } 19 | \arguments{ 20 | \item{x}{An sf or Raster* object as returned from a 21 | \code{get_*_layer} function} 22 | 23 | \item{...}{Additional arguments to \code{plot_layer}} 24 | 25 | \item{outline_poly}{Optional. An sf polygon to outline \code{sf_data} for 26 | context} 27 | 28 | \item{outline_size}{Numeric argument that controls width of parameter} 29 | 30 | \item{outline_color}{A character vector of a valid color} 31 | 32 | \item{plot_pkg}{Character. The plotting environment to use. Either "ggplot" 33 | (default) or "base"} 34 | } 35 | \value{ 36 | Either a \code{ggplot} object, or simply plots \code{x} if 37 | \code{plot_pkg = "base"} 38 | } 39 | \description{ 40 | This function plots a spatial layer as returned from 41 | \code{\link{get_spatial_layer}}. 42 | } 43 | \examples{ 44 | \dontrun{ 45 | plot_layer(iceland_poly) 46 | plot_layer(portage_county, outline_poly = wis_poly) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /man/raster_colors-RasterBrick-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{raster_colors,RasterBrick-method} 4 | \alias{raster_colors,RasterBrick-method} 5 | \title{Convert RasterBrick into data.frame of colors that can be used for plotting} 6 | \usage{ 7 | \S4method{raster_colors}{RasterBrick}(x) 8 | } 9 | \arguments{ 10 | \item{x}{A RasterBrick object} 11 | } 12 | \value{ 13 | A data.frame with 3 columns and \code{length(raster_object)} rows 14 | } 15 | \description{ 16 | This function is used internally by \code{\link{plot_layer}} to convert a 17 | RasterBrick object to a data.frame of colors for each pixel that can be used 18 | for plotting with ggplot2. Note that this function assumes that the first 19 | three bands in the RasterBrick objects are the RGB values and all additional 20 | bands are ignored. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly) 25 | wi_leaf_off_data <- raster_colors(wi_leaf_off_layer) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/raster_colors-RasterLayer-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{raster_colors,RasterLayer-method} 4 | \alias{raster_colors,RasterLayer-method} 5 | \title{Convert RasterLayer into data.frame of colors that can be used for plotting} 6 | \usage{ 7 | \S4method{raster_colors}{RasterLayer}(x) 8 | } 9 | \arguments{ 10 | \item{x}{A RasterLayer object} 11 | } 12 | \value{ 13 | A data.frame with 3 columns and \code{length(raster_object)} rows 14 | } 15 | \description{ 16 | This function is used internally by \code{\link{plot_layer}} to convert a 17 | RasterLayer object to a data.frame of colors for each pixel that can be used 18 | for plotting with ggplot2 19 | } 20 | \examples{ 21 | \dontrun{ 22 | wi_landcover <- get_map_layer(wi_landcover_url, wis_poly) 23 | wi_landcover_data <- raster_colors(wi_landcover) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /man/raster_colors-RasterStack-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{raster_colors,RasterStack-method} 4 | \alias{raster_colors,RasterStack-method} 5 | \title{Convert RasterStack into data.frame of colors that can be used for plotting} 6 | \usage{ 7 | \S4method{raster_colors}{RasterStack}(x) 8 | } 9 | \arguments{ 10 | \item{x}{A RasterStack object} 11 | } 12 | \value{ 13 | A data.frame with 3 columns and \code{length(raster_object)} rows 14 | } 15 | \description{ 16 | This function is used internally by \code{\link{plot_layer}} to convert a 17 | RasterStack object to a data.frame of colors for each pixel that can be used 18 | for plotting with ggplot2. Note that this function assumes that the first 19 | three bands in the RasterStack objects are the RGB values and all additional 20 | bands are ignored. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly) 25 | wi_leaf_off_data <- raster_colors(wi_leaf_off_layer) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /man/raster_colors-SpatRaster-method.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{raster_colors,SpatRaster-method} 4 | \alias{raster_colors,SpatRaster-method} 5 | \title{Convert SpatRaster into data.frame of colors that can be used for plotting} 6 | \usage{ 7 | \S4method{raster_colors}{SpatRaster}(x) 8 | } 9 | \arguments{ 10 | \item{x}{A SpatRaster object} 11 | } 12 | \value{ 13 | A data.frame with 3 columns and \code{length(raster_object)} rows 14 | } 15 | \description{ 16 | This function is used internally by \code{\link{plot_layer}} to convert a 17 | SpatRaster object to a data.frame of colors for each pixel that can be used 18 | for plotting with ggplot2. Note that this function assumes that the 19 | SpatRaster objects use RGB values. 20 | } 21 | \examples{ 22 | \dontrun{ 23 | wi_leaf_off_layer <- get_image_layer(wi_leaf_off_url, wis_poly) 24 | wi_leaf_off_data <- raster_colors(wi_leaf_off_layer) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /man/raster_colors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/process_raster.R 3 | \name{raster_colors} 4 | \alias{raster_colors} 5 | \title{Convert RasterLayer into data.frame of colors for each pixel that can be 6 | used for plotting} 7 | \usage{ 8 | raster_colors(x) 9 | } 10 | \arguments{ 11 | \item{x}{A Raster* object} 12 | } 13 | \value{ 14 | A data.frame with 3 columns and \code{length(raster_object)} rows. 15 | Two of these columns are the x-y coordinates of each pixel, and one is a 16 | value for color that can be used for plotting 17 | } 18 | \description{ 19 | This function is used internally by \code{\link{plot_layer}} to convert a 20 | Raster* object to a data.frame of colors for each pixel that can be used for 21 | plotting with ggplot2 22 | } 23 | \examples{ 24 | \dontrun{ 25 | wi_landcover <- get_map_layer(wi_landcover_url, wis_poly) 26 | wi_landcover_data <- raster_colors(wi_landcover) 27 | head(wi_landcover_data) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /man/sf_example_polys.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{sf_example_polys} 5 | \alias{sf_example_polys} 6 | \alias{iceland_poly} 7 | \alias{mke_county} 8 | \alias{portage_county} 9 | \alias{reykjanes_poly} 10 | \alias{wis_counties} 11 | \alias{wis_poly} 12 | \alias{cook_creek_ws} 13 | \alias{cook_creek_streams} 14 | \alias{cook_creek_env} 15 | \alias{mke_river} 16 | \alias{poly_streams_contains} 17 | \alias{poly_streams_crosses} 18 | \alias{sugar_creek} 19 | \alias{sugar_creek_env} 20 | \alias{trout_hab_project_pt} 21 | \alias{trout_hab_project_pts} 22 | \alias{example_poly} 23 | \title{Various example sf polygons} 24 | \format{ 25 | An object of class sf and data.frame: 26 | 27 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 3 columns. 28 | 29 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 3 columns. 30 | 31 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 2 columns. 32 | 33 | An object of class \code{sf} (inherits from \code{data.frame}) with 72 rows and 3 columns. 34 | 35 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 2 columns. 36 | 37 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 7 columns. 38 | 39 | An object of class \code{sf} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 5 rows and 3 columns. 40 | 41 | An object of class \code{sf} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 10 rows and 3 columns. 42 | 43 | An object of class \code{sf} (inherits from \code{tbl_df}, \code{tbl}, \code{data.frame}) with 5 rows and 5 columns. 44 | 45 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 28 columns. 46 | 47 | An object of class \code{sf} (inherits from \code{data.frame}) with 4 rows and 28 columns. 48 | 49 | An object of class \code{sf} (inherits from \code{data.frame}) with 7 rows and 28 columns. 50 | 51 | An object of class \code{sf} (inherits from \code{data.frame}) with 15 rows and 28 columns. 52 | 53 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 11 columns. 54 | 55 | An object of class \code{sf} (inherits from \code{data.frame}) with 4 rows and 11 columns. 56 | 57 | An object of class \code{sf} (inherits from \code{data.frame}) with 1 rows and 1 columns. 58 | 59 | An object of class \code{sf} (inherits from \code{data.frame}) with 4 rows and 11 columns. 60 | } 61 | \source{ 62 | ggplot2's \code{\link[ggplot2]{map_data}} and \href{https://dnrmaps.wi.gov/arcgis/rest/services}{Wisconsin DNR ArcGIS REST API} 63 | } 64 | \usage{ 65 | iceland_poly 66 | 67 | mke_county 68 | 69 | portage_county 70 | 71 | reykjanes_poly 72 | 73 | wis_counties 74 | 75 | wis_poly 76 | 77 | cook_creek_ws 78 | 79 | cook_creek_streams 80 | 81 | cook_creek_env 82 | 83 | mke_river 84 | 85 | poly_streams_contains 86 | 87 | poly_streams_crosses 88 | 89 | sugar_creek 90 | 91 | sugar_creek_env 92 | 93 | trout_hab_project_pt 94 | 95 | trout_hab_project_pts 96 | 97 | example_poly 98 | 99 | trout_hab_project_pts 100 | } 101 | \description{ 102 | These are sf polygons that are used for examples throughout the package 103 | } 104 | \keyword{datasets} 105 | -------------------------------------------------------------------------------- /man/sf_objects.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{sf_objects} 4 | \alias{sf_objects} 5 | \alias{sf_line} 6 | \alias{sf_point} 7 | \alias{sf_points} 8 | \alias{sf_polygon} 9 | \alias{sf_box} 10 | \title{Create sf objects from coordinates} 11 | \usage{ 12 | sf_line(..., crs = 4326) 13 | 14 | sf_point(..., crs = 4326) 15 | 16 | sf_points(..., crs = 4326) 17 | 18 | sf_polygon(..., crs = 4326) 19 | 20 | sf_box(xmin, ymin, xmax, ymax, crs = 4326) 21 | } 22 | \arguments{ 23 | \item{...}{The coordinates of the object} 24 | 25 | \item{crs}{The coordinate reference system. Defaults to 4326} 26 | 27 | \item{xmin, xmax, ymin, ymax}{Corners for sf_box} 28 | } 29 | \value{ 30 | An sf object of the appropriate type 31 | } 32 | \description{ 33 | These are simple wrapper functions for creating sf objects from points 34 | } 35 | \examples{ 36 | pt_a <- c(-90, 45) 37 | pt_b <- c(-89, 44) 38 | pt <- sf_points(pt_a) 39 | line <- sf_line(pt_a, pt_b) 40 | } 41 | -------------------------------------------------------------------------------- /man/sp_rel_lookups.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{sp_rel_lookups} 5 | \alias{sp_rel_lookups} 6 | \alias{sp_rel_valid} 7 | \alias{sp_rel_lookup} 8 | \title{Spatial relationship descriptor and lookup tables} 9 | \format{ 10 | \code{sp_rel_valid} is a data.frame with 105 rows and 3 variables as 11 | follows: 12 | \describe{ 13 | \item{feature_class}{A feature class to be queried} 14 | \item{query_feature_class}{The feature class used to do a spatial query} 15 | \item{sp_rel}{ 16 | The spatial relationships that are valid for the feature class and 17 | query_feature_class combination 18 | } 19 | } 20 | 21 | \code{sp_rel_lookup} is a data.frame with 9 rows and 2 variables as 22 | follows: 23 | \describe{ 24 | \item{sp_rel}{The spatial relationship being described} 25 | \item{description}{A description of the sp_rel} 26 | } 27 | } 28 | \source{ 29 | sp_rel_valid--Independent tests done specifically by and for arcpullr 30 | 31 | sp_rel_lookup -- 32 | \url{https://help.arcgis.com/en/webapi/wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.SpatialRelationship.html 33 | } 34 | } 35 | \usage{ 36 | sp_rel_valid 37 | 38 | sp_rel_lookup 39 | } 40 | \description{ 41 | These data.frames are used to lookup and explain which spatial relation types 42 | go with different spatial queries. 43 | } 44 | \details{ 45 | sp_rel_lookup explains the various different types of spatial relationships 46 | available through ArcGIS REST APIs. sp_rel_valid shows which spatial 47 | relationships are valid with different geometry types being queried and 48 | used to do spatial queries 49 | } 50 | \keyword{datasets} 51 | -------------------------------------------------------------------------------- /man/sp_rel_xref.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{sp_rel_xref} 4 | \alias{sp_rel_xref} 5 | \title{Lookup function for shorthand versions of spatial relation text strings} 6 | \usage{ 7 | sp_rel_xref(x) 8 | } 9 | \arguments{ 10 | \item{x}{A character string. One of "contains", "crosses", 11 | "envelopeintersects", "indexintersects", "intersects", "overlaps", 12 | "relation", "touches", "within"} 13 | } 14 | \value{ 15 | The appropriately named ESRI version of \code{x}. For example, 16 | an \code{x} value of "intersects" returns "esriSpatialRelIntersects" 17 | } 18 | \description{ 19 | After typing "esriSpatialRelIntersects" into 4 to 5 functions, you'll get 20 | pretty sick of typing that. This function serves to allow shorthand strings 21 | to be passed to the \code{sp_rel} arguments of the 22 | \code{\link{get_layers_by_spatial}} family of functions. For example, you can 23 | pass "intersects" to this function and it will return 24 | "esriSpatialRelIntersects" 25 | } 26 | \examples{ 27 | sp_rel_xref("intersects") 28 | } 29 | -------------------------------------------------------------------------------- /man/sql_where.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{sql_where} 4 | \alias{sql_where} 5 | \title{Format a SQL where clause from arguments} 6 | \usage{ 7 | sql_where(..., rel_op = "=") 8 | } 9 | \arguments{ 10 | \item{...}{Named objects to be queried by} 11 | 12 | \item{rel_op}{Character. The relational operator in the SQL clause (i.e. "=", 13 | "IN", "NOT IN", etc.). If a single rel_op is provide with multiple ... 14 | parameters then it will be recycled \code{length(...)} times.} 15 | } 16 | \value{ 17 | A character string that can be passed to the where argument of 18 | \code{get_spatial_layer} 19 | } 20 | \description{ 21 | This function will create a where statement that is compatible with 22 | \code{\link{get_spatial_layer}}). This statement can then be passed 23 | to the \code{where} argument in this function. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | wbics <- sql_where(WATERBODY_WBIC = c(805400, 804600), rel_op = "IN") 28 | lakes <- get_spatial_layer(wi_hydro_url, where = wbics) 29 | plot_layer(lakes) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /man/valid_sp_rel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utilities.R 3 | \name{valid_sp_rel} 4 | \alias{valid_sp_rel} 5 | \title{Check to see which spatial relation types are applicable to the feature 6 | classes being queried and the sf objects use do to a spatial query} 7 | \usage{ 8 | valid_sp_rel(fc1, fc2, pull = TRUE) 9 | } 10 | \arguments{ 11 | \item{fc1}{Character. The feature class type being queried. Available options 12 | are "point", "multipoint", "line", or "area".} 13 | 14 | \item{fc2}{Character. The geometry type of the sf object used to do a spatial 15 | query. Available options are "point", "multipoint", "line", or "area".} 16 | 17 | \item{pull}{Logical. Pull the available options (TRUE) or print all columns 18 | of the sp_rel_valid data.frame for the appropriate fc1 and fc2} 19 | } 20 | \value{ 21 | Either a vector or filtered data.frame showing the appropriate 22 | sp_rels for the given feature classes 23 | } 24 | \description{ 25 | Check to see which spatial relation types are applicable to the feature 26 | classes being queried and the sf objects use do to a spatial query 27 | } 28 | \examples{ 29 | valid_sp_rel("line", "line") 30 | } 31 | -------------------------------------------------------------------------------- /other_tests/.Rhistory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/other_tests/.Rhistory -------------------------------------------------------------------------------- /other_tests/sp_rel_tests/check_tests.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | 3 | test_result_names <- c( 4 | "hydro_trout_hab", 5 | "goodyear_seawall_outstanding_streams", 6 | "brown_cty_hydrants_biketrails_parks" 7 | ) 8 | 9 | test_results <- lapply(test_result_names, function(x) { 10 | load(paste0("other_tests/sp_rel_tests/", x, "_test_results.RData")) 11 | out <- 12 | test_results %>% 13 | select(fc_type, query_fc_type, sp_rel, valid) 14 | names(out)[4] <- paste(x, "valid", sep = "_") 15 | return(out) 16 | }) 17 | 18 | all_results <- 19 | Reduce(function(...) { 20 | left_join(..., by = c("fc_type", "query_fc_type", "sp_rel")) 21 | }, test_results) 22 | 23 | check_results <- 24 | all_results %>% 25 | mutate(test_sum = select(., ends_with("valid")) %>% rowSums()) %>% 26 | filter(test_sum %in% c(0, 3)) 27 | 28 | sp_rel_valid <- 29 | check_results %>% 30 | filter(test_sum == 3) %>% 31 | select(fc_type, query_fc_type, sp_rel) 32 | -------------------------------------------------------------------------------- /other_tests/sp_rel_tests/get_wi_dnr_layer_types.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | 3 | wdnr_layers <- filter(wdnr.gis::service_urls, !is.na(url)) 4 | 5 | geom_types <- lapply(1:nrow(wdnr_layers), function(x) { 6 | dat <- wdnr_layers[x, ] 7 | out <- tryCatch(get_geometry_type(dat$url), error = function(e) NULL) 8 | dat$geom_type <- out 9 | Sys.sleep(0.25) 10 | return(dat) 11 | }) 12 | 13 | geom_data <- do.call("rbind", geom_types) 14 | 15 | # no multipoint layers on wdnr arcgis rest api 16 | unique(geom_data$geom_types) 17 | -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfrater/arcpullr/c19cb3c884da2daf13bda2fa95c01dfb4e85c2d1/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(arcpullr) 3 | 4 | test_check("arcpullr") 5 | -------------------------------------------------------------------------------- /tests/testthat/test_format_spatial_coords.R: -------------------------------------------------------------------------------- 1 | context("Formatting Coordinates") 2 | 3 | #create spatial and character objects to run tests on 4 | multipoint <- sf_points(c(0, 0), c(1, 1), c(2, 1)) 5 | line <- sf_line(c(0, 0), c(1, 1), c(2, 1)) 6 | poly <- sf_polygon( 7 | c(0, 0), c(0, 1), c(0, 2), c(1, 2), c(1, 3), c(2, 3), 8 | c(2, 4), c(2, 5), c(1, 5), c(0, 5), c(0, 3), c(0, 0) 9 | ) 10 | 11 | # make polyline 12 | line2 <- sf_line(c(0, 1), c(1, 2), c(3, 2)) 13 | polyline <- rbind(line, line2) 14 | 15 | # make multi-polygon 16 | poly2 <- sf_polygon( 17 | c(10, 10), c(10, 11), c(10, 12), c(11, 12), c(11, 13), c(12, 13), 18 | c(12, 14), c(12, 15), c(11, 15), c(10, 15), c(10, 13), c(10, 10) 19 | ) 20 | multipoly <- rbind(poly, poly2) 21 | 22 | #run tests 23 | # test format_multipoint_coords 24 | expected_multipoint_output <- paste0( 25 | "{'points':[[0,0],[1,1],[2,1]], ", 26 | "'spatialReference':{'wkid':4326}}" 27 | ) 28 | 29 | test_that( 30 | "format_multipoint_coords returns a properly formatted character object", { 31 | actual_multipoint_output <- 32 | format_multipoint_coords(multipoint) 33 | expect_equal(expected_multipoint_output, actual_multipoint_output) 34 | } 35 | ) 36 | 37 | # test format_line_coords 38 | expected_line_output <- paste0( 39 | "{'paths':[[[0,0],[1,1],[2,1]]], ", 40 | "'spatialReference':{'wkid':4326}}" 41 | ) 42 | 43 | test_that("format_line_coords returns a properly formatted character object", 44 | { 45 | actual_line_output <- format_line_coords(line) 46 | expect_equal(expected_line_output, actual_line_output) 47 | }) 48 | 49 | # test format_polygon_coords 50 | expected_polygon_output <- paste0( 51 | "{'rings':[[[0,0],[0,1],[0,2],[1,2],[1,3],[2,3],[2,4],[2,5],[1,5],", 52 | "[0,5],[0,3],[0,0]]], 'spatialReference':{'wkid':4326}}" 53 | ) 54 | 55 | test_that( 56 | "format_polygon_coords returns a properly formatted character object", { 57 | actual_polygon_output <- format_polygon_coords(poly) 58 | expect_equal(expected_polygon_output, actual_polygon_output) 59 | } 60 | ) 61 | 62 | # test sf object with multiple lines 63 | expected_polyline_output <- paste0( 64 | "{'paths':[[[0,0],[1,1],[2,1]], [[0,1],[1,2],[3,2]]], ", 65 | "'spatialReference':{'wkid':4326}}" 66 | ) 67 | 68 | test_that( 69 | "format_line_coords properly formats multiple lines", { 70 | actual_polyline_output <- format_line_coords(polyline) 71 | expect_equal(expected_polyline_output, actual_polyline_output) 72 | } 73 | ) 74 | 75 | # test sf object with multiple polygons 76 | expected_multipoly_output <- paste0( 77 | "{'rings':[[[0,0],[0,1],[0,2],[1,2],[1,3],[2,3],", 78 | "[2,4],[2,5],[1,5],[0,5],[0,3],[0,0]], ", 79 | "[[10,10],[10,11],[10,12],[11,12],[11,13],[12,13],", 80 | "[12,14],[12,15],[11,15],[10,15],[10,13],[10,10]]], ", 81 | "'spatialReference':{'wkid':4326}}" 82 | ) 83 | 84 | test_that( 85 | "format_polygon_coords properly formats multiple polygons", { 86 | actual_multipoly_output <- format_polygon_coords(multipoly) 87 | expect_equal(expected_multipoly_output, actual_multipoly_output) 88 | } 89 | ) 90 | 91 | # test format_envelope_coords 92 | expected_envelope_output <- "xmin : 0, ymin : 0, xmax : 2, ymax : 5" 93 | 94 | test_that( 95 | "format_envelope_coords returns a properly formatted character object", { 96 | actual_envelope_output <- format_envelope_coords(poly) 97 | expect_equal(expected_envelope_output, actual_envelope_output) 98 | } 99 | ) 100 | -------------------------------------------------------------------------------- /tests/testthat/test_get_layer_by_geometry.R: -------------------------------------------------------------------------------- 1 | context("Retrieve Layers by Geometry") 2 | 3 | skip_on_cran() 4 | 5 | #create a point object 6 | point <- c(-88.526848,45.435216)%>% 7 | sf::st_point()%>% 8 | sf::st_sfc() %>% 9 | sf::st_sf(crs = 4326) 10 | 11 | #create a multipoint object 12 | multipoint <- rbind( 13 | c(-88.526848,45.435216), 14 | c(-88.490821,45.444325))%>% 15 | sf::st_multipoint()%>% 16 | sf::st_sfc() %>% 17 | sf::st_sf(crs = 4326) 18 | 19 | #create a line object 20 | line <- rbind(c(-88.534444, 45.436479), 21 | c(-88.521956, 45.433680)) %>% 22 | sf::st_linestring() %>% 23 | sf::st_sfc() %>% 24 | sf::st_sf(crs = 4326) 25 | 26 | #create a polygon object 27 | poly <- list(rbind( 28 | c(-88.533220,45.431675), 29 | c(-88.532662,45.438511), 30 | c( -88.519444,45.439143), 31 | c(-88.519787,45.432036), 32 | c(-88.533220,45.431675) 33 | )) %>% 34 | sf::st_polygon() %>% 35 | sf::st_sfc() %>% 36 | sf::st_sf(crs = 4326) 37 | 38 | hydro_lakes <- paste("https://dnrmaps.wi.gov/arcgis2/rest/services/", 39 | "TS_AGOL_STAGING_SERVICES/EN_AGOL_STAGING_SurfaceWater_WTM/", 40 | "MapServer/1", 41 | sep = "") 42 | 43 | #test get_layer_by_point 44 | test_that("get_layer_by_point returns the correct WATERBODY_WBIC", 45 | { 46 | otter_lake_point <- get_layer_by_point(url = hydro_lakes, 47 | geometry = point) 48 | expect_equal(otter_lake_point$WATERBODY_WBIC,549400) 49 | }) 50 | 51 | #test get_layer_by_multipoint 52 | 53 | test_that("get_layer_by_multipoint returns a warning", 54 | { 55 | expect_warning( 56 | get_layer_by_multipoint(url = hydro_lakes, geometry = multipoint) 57 | ) 58 | }) 59 | 60 | test_that("get_layer_by_multipoint returns the correct WATERBODY_WBIC", 61 | { 62 | otter_lake_multipoint <- 63 | suppressWarnings( 64 | get_layer_by_multipoint( 65 | url = hydro_lakes, geometry = multipoint 66 | ) 67 | ) 68 | expect_equal(otter_lake_multipoint$WATERBODY_WBIC[1],549400) 69 | }) 70 | 71 | 72 | #test get_layer_by_line 73 | test_that("get_layer_by_line returns the correct WATERBODY_WBIC", 74 | { 75 | otter_lake_line <- get_layer_by_line(url = hydro_lakes, 76 | geometry =line) 77 | expect_equal(otter_lake_line$WATERBODY_WBIC,549400) 78 | }) 79 | 80 | #test get_layer_by_poly 81 | test_that("get_layer_by_poly returns the correct WATERBODY_WBIC", 82 | { 83 | otter_lake_poly <- get_layer_by_poly(url = hydro_lakes, 84 | geometry = poly) 85 | expect_equal(otter_lake_poly$WATERBODY_WBIC,549400) 86 | }) 87 | 88 | #test get_layer_by_envelope 89 | test_that("get_layer_by_envelope returns the correct WATERBODY_WBIC", 90 | { 91 | otter_lake_env <- get_layer_by_envelope(url = hydro_lakes, 92 | geometry = poly) 93 | expect_equal(otter_lake_env$WATERBODY_WBIC,549400) 94 | }) 95 | -------------------------------------------------------------------------------- /tests/testthat/test_get_spatial_layer.R: -------------------------------------------------------------------------------- 1 | context("Retrieving layers") 2 | 3 | skip_on_cran() 4 | 5 | stream_hydro_url <- paste0( 6 | "https://dnrmaps.wi.gov/arcgis2/rest/services/", 7 | "TS_AGOL_STAGING_SERVICES/EN_AGOL_STAGING_SurfaceWater_WTM/MapServer/2" 8 | ) 9 | 10 | stream_query_url <- paste(stream_hydro_url, "query", sep = "/") 11 | 12 | oak_creek_where <- "RIVER_SYS_NAME = 'Oak Creek'" 13 | 14 | # these IDs changed at some point. They must have gotten updated during a 15 | # DNR DB upgrade or something. Removing tests - PNF - 12/17/2021 16 | 17 | # oak_creek_ids <- c( 18 | # 909165, 915195, 935421, 937647, 941536, 948799, 953299, 955174, 19 | # 955291, 971135, 973336, 974923, 976365, 1163949, 1173335 20 | # ) 21 | 22 | # test_that("get_object_ids returns proper IDs", { 23 | # test_ids <- get_object_ids( 24 | # query_url = stream_query_url, 25 | # where = oak_creek_where 26 | # ) 27 | # expect_equal(sort(test_ids), sort(oak_creek_ids)) 28 | # }) 29 | # 30 | # test_that("get_esri_features_by_id returns proper feature", { 31 | # test_feature <- get_esri_features_by_id( 32 | # ids = oak_creek_ids[1], 33 | # query_url = stream_query_url, 34 | # fields = "*" 35 | # ) 36 | # expect_equal(test_feature[[1]]$attributes$RIVER_SYS_NAME, "Oak Creek") 37 | # expect_equal(test_feature[[1]]$attributes$RIVER_SYS_WBIC, 14500) 38 | # }) 39 | 40 | test_that("get_esri_features returns proper feature", { 41 | test_feature <- get_esri_features( 42 | query_url = stream_query_url, 43 | fields = "*", 44 | where = oak_creek_where, 45 | head = FALSE 46 | ) 47 | expect_equal(test_feature[[1]]$attributes$RIVER_SYS_NAME, "Oak Creek") 48 | expect_equal(test_feature[[1]]$attributes$RIVER_SYS_WBIC, 14500) 49 | }) 50 | 51 | test_that("get_spatial_layer pulls layer properly", { 52 | oak_creek <- get_spatial_layer( 53 | stream_hydro_url, 54 | where = oak_creek_where 55 | ) 56 | expect_equal(unique(oak_creek$RIVER_SYS_NAME), "Oak Creek") 57 | expect_equal(unique(oak_creek$RIVER_SYS_WBIC), 14500) 58 | }) 59 | -------------------------------------------------------------------------------- /tests/testthat/test_layer_properties.R: -------------------------------------------------------------------------------- 1 | context("Retrieve Legend") 2 | 3 | legend <- get_layer_legend(wi_landcover_url) 4 | 5 | legend_colors <- c( 6 | "#C84141", "#D89382", "#F2EE86", "#E6E2A1", "#E6AC2E", "#9C7209", 7 | "#016400", "#6AB86A", "#1E981E", "#CEEBF9", "#95EDF2", "#70A3BA", 8 | "#00D1DC", "#0F7C82", "#787878", "#A8976D" 9 | ) 10 | 11 | legend_values <- c( 12 | "Developed, High Intensity ", "Developed, Low Intensity", "Crop Rotation", 13 | "Cranberries", "Forage Grassland", "Idle Grassland", "Coniferous Forest", 14 | "Broad-leaved Deciduous Forest", "Mixed Deciduous or Coniferous Forest", 15 | "Open Water", "Floating Aquatic Herbaceous Vegetation", 16 | "Emergent or Wet Meadow", "Lowland Scrub or Shrub", "Forested Wetland", 17 | "Barren", "Shrubland" 18 | ) 19 | 20 | test_that("legend values and colors are correct", { 21 | expect_equal(legend$color, legend_colors) 22 | expect_equal(legend$value, legend_values) 23 | }) 24 | -------------------------------------------------------------------------------- /tests/testthat/test_process_terra_rasters.R: -------------------------------------------------------------------------------- 1 | # context("Process Raster functions") 2 | 3 | nx <- 4 4 | ny <- 4 5 | simple_raster <- terra::rast( 6 | nrow = nx, ncol = ny, 7 | xmin = 0, ymin = 0, 8 | xmax = nx * ny, ymax = nx * ny 9 | ) 10 | set.seed(1234) 11 | terra::values(simple_raster) <- sample(1:3, nx * ny, replace = TRUE) 12 | col1 <- "#EC7E42" 13 | col2 <- "#5AE429" 14 | col3 <- "#1C46FF" 15 | # col1 <- "tomato" 16 | # col2 <- "limegreen" 17 | # col3 <- "royalblue4" 18 | terra::coltab(simple_raster) <- data.frame( 19 | value = 1:3, 20 | col = c(col1, col2, col3) 21 | ) 22 | 23 | simple_raster_cols <- c( 24 | NA, NA, col2, col2, col1, NA, col3, col1, col1, col2, NA, NA, 25 | col2, col3, col2, col2 26 | ) 27 | 28 | simple_legend_raster <- simple_raster 29 | legend_names <- c( 30 | NA, NA, "x", "x", "y", NA, "z", "y", "y", "x", NA, NA, "x", "z", "x", "x" 31 | ) 32 | legend_color_lookup <- 33 | data.frame(color = simple_raster_cols, names = legend_names) |> 34 | dplyr::distinct() |> 35 | dplyr::filter(!is.na(color)) |> 36 | dplyr::arrange(color = match(color, terra::coltab(simple_raster))) 37 | 38 | legend <- 39 | data.frame( 40 | color = c("#1C46FF", "#EC7E42", "#5AE429"), 41 | value = c("z", "y", "x") 42 | ) |> 43 | structure(class = c("raster_legend", "data.frame")) 44 | 45 | test_that("match_legend_colors matches SpatRaster colors correctly", { 46 | simple_rast_cols <- 47 | terra::coltab(simple_raster)[[1]] |> 48 | dplyr::rename(value = values) 49 | color_match <- match_legend_colors(legend, simple_rast_cols) 50 | exp_legend <- data.frame( 51 | color = c("#1C46FF", "#EC7E42", "#5AE429"), 52 | name = c("z", "y", "x"), 53 | value = c(3, 1, 2), 54 | red = c(28, 236, 90), 55 | green = c(70, 126, 228), 56 | blue = c(255, 66, 41) 57 | ) 58 | expect_equal(color_match$color, exp_legend$color) 59 | expect_equal(color_match$value, exp_legend$value) 60 | }) 61 | 62 | -------------------------------------------------------------------------------- /tests/testthat/test_utilities.R: -------------------------------------------------------------------------------- 1 | context("Utilities functions") 2 | 3 | pt_a <- c(-90, 45) 4 | pt_b <- c(-89, 44) 5 | sf_pt <- sf_points(pt_a) 6 | sf_multipt <- sf_points(pt_a, pt_b) 7 | sf_line <- sf_line(pt_a, pt_b) 8 | sf_poly <- sf_polygon(c(0, 0), c(0, 1), c(1, 1), c(1,0), c(0,0)) 9 | 10 | test_that("sf_objects correctly return sf objects", { 11 | expect_equal(class(sf_pt), c("sf", "data.frame")) 12 | expect_equal(class(sf_multipt), c("sf", "data.frame")) 13 | expect_equal(class(sf_line), c("sf", "data.frame")) 14 | expect_equal(class(sf_poly), c("sf", "data.frame")) 15 | }) 16 | 17 | test_that("sql_where returns correct SQL WHERE clauses", { 18 | expect_equal(sql_where(foo = "bar"), "foo = 'bar'") 19 | expect_equal( 20 | sql_where(foo = "bar", bar = "baz"), 21 | "foo = 'bar' AND bar = 'baz'" 22 | ) 23 | expect_equal( 24 | sql_where(foo = c("bar", "baz"), rel_op = "IN"), 25 | "foo IN ( 'bar' , 'baz' )" 26 | ) 27 | expect_equal( 28 | sql_where(foo = c("bar", "baz"), a = "b", rel_op = "IN"), 29 | "foo IN ( 'bar' , 'baz' ) AND a IN 'b'" 30 | ) 31 | }) 32 | 33 | test_that("get_sf_crs returns the correct CRS values for polygons", { 34 | expect_equal(get_sf_crs(iceland_poly), 4326) 35 | expect_equal(get_sf_crs(mke_county), 4326) 36 | }) 37 | 38 | test_that("sp_rel_lookup returns correct spatial relation character string", { 39 | sp_xref <- sp_rel_ref$sp.xref 40 | sp_xref2 <- gsub("e?s$", "", sp_xref) 41 | expect_equal(sp_rel_xref(sp_xref[1]), "esriSpatialRelContains") 42 | expect_equal(sp_rel_xref(sp_xref2[1]), "esriSpatialRelContains") 43 | expect_equal(sp_rel_xref("esriSpatialRelContains"), "esriSpatialRelContains") 44 | 45 | expect_equal(sp_rel_xref(sp_xref[2]), "esriSpatialRelCrosses") 46 | expect_equal(sp_rel_xref(sp_xref2[2]), "esriSpatialRelCrosses") 47 | expect_equal(sp_rel_xref("esriSpatialRelCrosses"), "esriSpatialRelCrosses") 48 | 49 | expect_equal(sp_rel_xref(sp_xref[3]), "esriSpatialRelEnvelopeIntersects") 50 | expect_equal(sp_rel_xref(sp_xref2[3]), "esriSpatialRelEnvelopeIntersects") 51 | expect_equal( 52 | sp_rel_xref("esriSpatialRelEnvelopeIntersects"), 53 | "esriSpatialRelEnvelopeIntersects" 54 | ) 55 | 56 | expect_equal(sp_rel_xref(sp_xref[4]), "esriSpatialRelIndexIntersects") 57 | expect_equal(sp_rel_xref(sp_xref2[4]), "esriSpatialRelIndexIntersects") 58 | expect_equal( 59 | sp_rel_xref("esriSpatialRelIndexIntersects"), 60 | "esriSpatialRelIndexIntersects" 61 | ) 62 | 63 | expect_equal(sp_rel_xref(sp_xref[5]), "esriSpatialRelIntersects") 64 | expect_equal(sp_rel_xref(sp_xref2[5]), "esriSpatialRelIntersects") 65 | expect_equal( 66 | sp_rel_xref("esriSpatialRelIntersects"), 67 | "esriSpatialRelIntersects" 68 | ) 69 | 70 | expect_equal(sp_rel_xref(sp_xref[6]), "esriSpatialRelOverlaps") 71 | expect_equal(sp_rel_xref(sp_xref2[6]), "esriSpatialRelOverlaps") 72 | expect_equal(sp_rel_xref("esriSpatialRelOverlaps"), "esriSpatialRelOverlaps") 73 | 74 | expect_equal(sp_rel_xref(sp_xref[7]), "esriSpatialRelRelation") 75 | expect_equal(sp_rel_xref(sp_xref2[7]), "esriSpatialRelRelation") 76 | expect_equal(sp_rel_xref("esriSpatialRelRelation"), "esriSpatialRelRelation") 77 | 78 | expect_equal(sp_rel_xref(sp_xref[8]), "esriSpatialRelTouches") 79 | expect_equal(sp_rel_xref(sp_xref2[8]), "esriSpatialRelTouches") 80 | expect_equal(sp_rel_xref("esriSpatialRelTouches"), "esriSpatialRelTouches") 81 | 82 | expect_equal(sp_rel_xref(sp_xref[9]), "esriSpatialRelWithin") 83 | expect_equal(sp_rel_xref(sp_xref2[9]), "esriSpatialRelWithin") 84 | expect_equal(sp_rel_xref("esriSpatialRelWithin"), "esriSpatialRelWithin") 85 | 86 | expect_error(sp_rel_xref("test")) 87 | }) 88 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/intro_to_arcpullr.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Introduction to arcpullr" 3 | date: "`r format(Sys.time(), '%d %B, %Y')`" 4 | vignette: > 5 | %\VignetteIndexEntry{Introduction to arcpullr} 6 | %\VignetteEncoding{UTF-8} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | output: 9 | html_document: 10 | theme: 11 | version: 5 12 | editor_options: 13 | markdown: 14 | wrap: 72 15 | --- 16 | 17 | To see more complete package documentation check out: 18 | 19 | https://pfrater.github.io/arcpullr/ 20 | 21 | ```{r, include = FALSE} 22 | knitr::opts_chunk$set( 23 | collapse = TRUE, 24 | comment = "#>" 25 | ) 26 | options(rmarkdown.html_vignette.check_title = FALSE) 27 | library(arcpullr) 28 | ``` 29 | 30 | 31 | ## URL's for examples 32 | 35 |
      36 |
      37 | ```{r} 38 | wdnr_base_url <- "https://dnrmaps.wi.gov/arcgis/rest/services" 39 | streams_layer_url <- "WT_SWDV/WT_Inland_Water_Resources_WTM_Ext_v2/MapServer/2" 40 | streams_url <- paste(wdnr_base_url, streams_layer_url, sep = "/") 41 | 42 | # the mke_county polygon is available as an exported object in arcpullr 43 | open_water_layer_url <- "WT_SWDV/WT_Inland_Water_Resources_WTM_Ext_v2/MapServer/3" 44 | hydro_url <- paste(wdnr_base_url, open_water_layer_url, sep = "/") 45 | 46 | wis_county_layer_url <- "https://datcpgis.wi.gov/arcgis/rest/services/Base/PolygonsExternal/MapServer/0" 47 | ``` 48 |
      49 |
      50 |
      51 | 52 | 53 | # Feature (i.e. vector) Layers 54 | 55 | ## The `get_spatial_layer()` function 56 | 57 | This is one of the core functions of the package, and allows users to pull Feature Service data from an ArcGIS REST API. 58 | 59 | ```{r, eval = FALSE} 60 | # url <- some url from an ArcGIS REST API layer 61 | layer <- get_spatial_layer(url) 62 | ``` 63 | 64 | The URL should be a specific layer from an ArcGIS REST API, such as the 65 | [Wisconsin Dep't. of Natural Resources Musky Streams 66 | layer](https://dnrmaps.wi.gov/arcgis/rest/services/WT_SWDV/WT_Designated_Waters_WTM_Ext/MapServer/19), 67 | for example. 68 | 69 | The `get_spatial_layer()` function will retrieve data from this layer, 70 | and format it to an object of class \code{sf} (*i.e.* of the R package [sf: 71 | Simple Features for R](https://r-spatial.github.io/sf/)). 72 | 73 | This function is also query-able both using both SQL code and ArcGIS's 74 | [Query (Feature 75 | Service)](https://developers.arcgis.com/rest/services-reference/query-feature-service-.htm) 76 | functionality. 77 | 78 | ### Querying Spatially via ArcGIS Feature Service 79 | 80 | Along with SQL, layers from an ArcGIS REST API may be queried spatially. 81 | This is accomplished with the `get_layer_by_*` family of functions. 82 | These functions are essentially a wrapper around `get_spatial_layer` 83 | that removes the abstraction of the spatial query syntax used by 84 | ArcGIS. These functions require a spatial object of class `sf` to be 85 | passed to the `geometry` argument. To test this out you can also quickly 86 | create simple `sf` objects using `sf_lines()`, `sf_points()`, or 87 | `sf_polygons()` to test out the service feature. 88 | 89 | ```{r, eval = FALSE} 90 | mke_waters <- get_layer_by_poly(url = streams_url, mke_county) 91 | ``` 92 | 93 | Spatial queries can be done with polygons, lines, or points...just use 94 | the respective `get_layer_by_*` function. See the 95 | [vignette on spatial querying](spatial_queries.html) for more detailed examples. 96 | 97 | ### Querying via SQL 98 | 99 | To query via SQL within the function the field name for the query of 100 | interest must be known. For example, 101 | 102 | ```{r, eval = FALSE} 103 | wi_river <- get_spatial_layer(hydro_url, where = "WATERBODY_ROW_NAME = 'Wisconsin River'") 104 | ``` 105 | 106 | For multiple WHERE clauses see the `?sql_where` function, which automates the 107 | creation of a WHERE clause. 108 | 109 | \ 110 | \ 111 | 112 | # Raster Layers 113 | 114 | arcpullr is capable of pulling raster layers as well (denoted as map and image 115 | layers by ArcGIS REST APIs). Utilize the `get_map_layer` and `get_image_layer` 116 | functions to pull these respective layers. See more information in the 117 | [vignette on raster layers](raster_layers.html) 118 | 119 | \ 120 | \ 121 | 122 | # Plotting Layers 123 | 124 | Layers retrieved via any of the `get_*_layer` functions may be plotted using an 125 | appropriate method which corresponds to the object type. For quick plotting we've 126 | also included the `plot_layer` function. This function will plot layers using 127 | `ggplot2` by default or can be switched to base graphics using the `plot_pkg` 128 | argument. 129 | 130 | ```{r pull_county_layer, warning = FALSE, echo = FALSE, eval = FALSE} 131 | wis_counties <- get_spatial_layer(url = wis_county_url) 132 | ``` 133 | 134 | ```{r show_layer_plotting, ref.block=c("pull_county_layer", "plot_county_layer"), eval = FALSE} 135 | ``` 136 | 137 | ```{r plot_county_layer, fig.height = 7, fig.width = 7, echo = FALSE} 138 | plot_layer(wis_counties) 139 | ``` 140 | 141 | 142 | -------------------------------------------------------------------------------- /vignettes/raster_layers.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Raster Layers" 3 | date: "`r format(Sys.time(), '%d %B, %Y')`" 4 | vignette: > 5 | %\VignetteIndexEntry{Raster Layers} 6 | %\VignetteEncoding{UTF-8} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | output: 9 | html_document: 10 | theme: 11 | version: 5 12 | editor_options: 13 | markdown: 14 | wrap: 72 15 | --- 16 | To see more complete package documentation check out: 17 | 18 | https://pfrater.github.io/arcpullr/ 19 |
      20 | ```{r, include = FALSE} 21 | knitr::opts_chunk$set( 22 | collapse = TRUE, 23 | comment = "#>" 24 | ) 25 | options(rmarkdown.html_vignette.check_title = FALSE) 26 | library(arcpullr) 27 | library(sf) 28 | wi_landcover <- terra::rast(system.file("wi_landcover.png", package = "arcpullr")) 29 | raster_cols <- terra::coltab(wi_landcover)[[1]] 30 | wi_landcover_legend <- 31 | wi_landcover_url |> 32 | get_layer_legend() |> 33 | match_legend_colors(raster_cols) |> 34 | dplyr::arrange(.data$value) 35 | attr(wi_landcover, "legend") <- wi_landcover_legend 36 | wi_aerial_imagery <- terra::rast(system.file("wi_aerial_imagery.png", package = "arcpullr")) 37 | ``` 38 | 39 | ```{r, echo = FALSE} 40 | # 41 | ``` 42 | 43 | 44 | 45 | `arcpullr` has the capability to query not only vector (Feature) layers, but 46 | also raster layers (both Map and Image service types). The syntax for these is 47 | generally the same as for the `get_layer_by_*` family of functions. Map and 48 | Image layers require a bounding box as part of the query, so both 49 | `get_map_layer` and `get_image_layer` have required arguments of a URL and an 50 | `sf` object. These functions pull the raster layers provided by the URL and return the layer as a SpatRaster object from the `terra` package. 51 | 52 | ## URL's for examples 53 | 56 |
      57 |
      58 | ```{r} 59 | # WDNR Server 60 | image_server <- "https://dnrmaps.wi.gov/arcgis_image/rest/services/" 61 | 62 | # WI Landcover Type URL 63 | landcover_path <- "DW_Land_Cover/EN_Land_Cover2_Lev2/MapServer" 64 | landcover_url <- paste0(image_server, landcover_path) 65 | 66 | # WI Leaf-off Aerial Imagery URL 67 | wi_leaf_off_path <- "DW_Imagery/EN_Image_Basemap_Latest_Leaf_Off/ImageServer" 68 | wi_aerial_imagery_url <- paste0(image_server, wi_leaf_off_path) 69 | 70 | # the wis_poly polygon is available as an exported object in arcpullr 71 | ``` 72 |
      73 |
      74 |
      75 | 76 | ## Map Layers 77 | 78 | The `get_map_layer` function takes a URL and an sf object. Since the query for 79 | this layer type on an ArcGIS REST Service requires a bounding box any sf object 80 | can be used (i.e. POLYGON, POINT, LINE, etc.) and a bounding box will be created 81 | using the extent of the shape. 82 | 83 | The example below pulls Wisconsin landcover types and plots them in a map. 84 | 85 | ```{r map_layer, eval = FALSE, echo = FALSE} 86 | wi_landcover <- get_map_layer(landcover_url, wis_poly) 87 | ``` 88 | 89 | ```{r show_map_plotting, ref.label=c('map_layer', 'plot_map_layer'), eval = FALSE} 90 | ``` 91 | 92 | ```{r plot_map_layer, fig.height = 7, fig.width = 7, echo = FALSE} 93 | plot_layer(wi_landcover) 94 | ``` 95 | 96 | ## Image Layers 97 | 98 | 99 | The `get_image_layer` function works the same as `get_map_layer` except that it 100 | queries from an Image layer. The easiest way to distinguish a Map layer from an 101 | Image layer is by checking the URL. Those from images will end with 102 | "ImageServer" whereas those from maps will end with "MapServer". Another way to 103 | check is to look a the "Supported Operations" at the bottom of the actual web 104 | page on the ArcGIS REST Service. It will say either "Export Image" or 105 | "Export Map". 106 | 107 | This example pulls with Wisconsin Leaf-off Aerial Imagery dataset from the 108 | Wisconsin Department of Natural Resources. 109 | 110 | ```{r, image_layer, eval = FALSE, echo = FALSE} 111 | wi_aerial_imagery <- get_image_layer(wi_aerial_imagery_url, wis_poly) 112 | ``` 113 | 114 | ```{r, plot_image_layer, fig.height = 5, fig.width = 5, echo = FALSE} 115 | plot_layer(wi_aerial_imagery) 116 | ``` 117 | --------------------------------------------------------------------------------