| an_filter | R Documentation |
A data frame of place names can be filtered according to name, geographic location, feature type, or other criteria. All text-related matches are by default treated as regular expressions and are case-insensitive: you can change this behaviour via the ignore_case and as_regex parameters.
an_filter( gaz, query, feature_ids, extent, feature_type, origin, origin_gazetteer, ignore_case = TRUE, as_regex = TRUE )
gaz |
data.frame or SpatialPointsDataFrame: as returned by |
query |
character: vector of place name terms to search for. Returned place names will be those that match all entries in |
feature_ids |
numeric: return only place names associated with the features identified by these identifiers. Currently these values can only be |
extent |
vector of c(longitude_min, longitude_max, latitude_min, latitude_max): if provided, search only for names within this bounding box. |
feature_type |
string: return only place names corresponding to feature types matching this pattern. For valid feature type names see |
origin |
string: return only place names originating from bodies (countries or organisations) matching this pattern. For valid |
origin_gazetteer |
string: return only place names originating from gazetteers matching this pattern. For valid gazetteer names see |
ignore_case |
logical: if |
as_regex |
logical: if |
data.frame of results
https://data.aad.gov.au/aadc/gaz/scar/, https://www.scar.org/data-products/place-names/
an_read, an_gazetteers, an_origins
## Not run:
g <- an_read(cache = "session")
## simple search for any place name containing the word 'William'
an_filter(g, query = "William")
## which bodies (countries or organisations) provided the names in our data?
an_origins(g)
## find names containing "William" and originating from Australia or the USA
an_filter(g, query = "William", origin = "Australia|United States of America")
## this search will return no matches
## because the actual place name is 'William Scoresby Archipelago'
an_filter(g, query = "William Archipelago")
## we can split the search terms so that each is matched separately
an_filter(g, query = c("William", "Archipelago"))
## or use a regular expression
an_filter(g, query = "William .* Archipelago")
## or refine the search using feature type
an_filter(g, query = "William", feature_type = "Archipelago")
## what feature types do we have in our data?
an_feature_types(g)
## for more complex text searching, use regular expressions
## e.g. names matching "West" or "East"
an_filter(g, query = "West|East")
## names starting with "West" or "East"
an_filter(g, query = "^(West|East)")
## names with "West" or "East" appearing as complete words in the name
## ["\b" matches a word boundary: see help("regex") ]
an_filter(g, query = "\\b(West|East)\\b")
## filtering by spatial extent
nms <- an_filter(g, extent = c(100, 120, -70, -65), origin = "Australia")
with(nms, plot(longitude, latitude))
with(nms, text(longitude, latitude, place_name))
## searching within the extent of an sp object
my_sp <- sp::SpatialPoints(cbind(c(100, 120), c(-70, -65)))
an_filter(g, extent = my_sp)
## or equivalently
an_filter(g, extent = bbox(my_sp))
## or using the sp form of the gazetteer data
gsp <- an_read(cache = "session", sp = TRUE)
an_filter(gsp, extent = my_sp)
## using the pipe operator
g %>% an_filter(query = "Ross", feature_type = "Ice shelf|Mountain")
g %>% an_near(loc = c(100, -66), max_distance = 20) %>%
an_filter(feature_type = "Island")
## find all names for feature 1589 and the naming
## authority for each name
an_filter(g, feature_ids = 1589)[, c("place_name", "origin")]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.