query_gis: Query LAGOS GIS

Description Usage Arguments Examples

View source: R/query.R

Description

Query LAGOS GIS

Usage

1
2
3
4
5
6
7
8
query_gis(
  layer,
  id_name = NULL,
  ids = NULL,
  extent = character(0),
  crs = albers_conic(),
  gis_path = lagosusgis_path()
)

Arguments

layer

character layer name

id_name

selection column

ids

feature ids to select

extent

apply an arbitrary extent using an sf bbox

crs

character projection info defaults to lagosusgis_path()

gis_path

character path to LAGOSUS GIS gpkg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 

sf::st_layers(lagosusgis_path())
gdalUtils::ogrinfo(lagosusgis_path(), "hu12", so = TRUE)

states   <- query_gis("state")

library(mapview)
state    <- query_gis("state", "state_name", "Michigan")
res_iws  <- query_gis("ws", "lagoslakeid", c(34352))
res_lake <- query_gis("LAGOS_US_All_Lakes_1ha", "lagoslakeid", 34352)
res_pnt  <- query_gis("LAGOS_US_All_Lakes_1ha_points", "lagoslakeid", 34352)
mapview(state) + mapview(res_iws) + mapview(res_lake) + mapview(res_pnt)

res <- query_gis("ws", "lagoslakeid", c(7010))
res <- query_gis("hu12", "hu12_zoneid", c("hu12_1"))
res <- query_gis("hu8", "hu8_zoneid", c("hu8_100"))
res <- query_gis("hu4", "hu4_zoneid", c("hu4_5"))

# query multiple feature ids
res <- query_gis("ws", "lagoslakeid", c(7010, 1))

# query lake polygon from coordinates using extent argument
lake_coordinates <- query_gis("LAGOS_US_All_Lakes_1ha_points",
  "lagoslakeid", "1")

lake_polygon <- query_gis("LAGOS_US_All_Lakes_1ha",
  extent = sf::st_bbox(lake_coordinates))

## End(Not run)

jsta/LAGOSUSgis documentation built on Aug. 7, 2021, 4:10 a.m.