gisco_get_airports {giscoR}R Documentation

Get location of airports and ports from GISCO API

Description

Loads a sf object from GISCO API or your local library.

Usage

gisco_get_airports(
  year = "2013",
  country = NULL,
  cache_dir = NULL,
  update_cache = FALSE,
  verbose = FALSE
)

gisco_get_ports(
  year = "2013",
  country = NULL,
  cache_dir = NULL,
  update_cache = FALSE,
  verbose = FALSE
)

Arguments

year

Year of reference. Only year available right now is "2013".

country

Optional. A character vector of country codes. It could be either a vector of country names, a vector of ISO3 country codes or a vector of Eurostat country codes. Mixed types (as c("Italy","ES","FRA")) would not work. See also countrycode::countrycode().

cache_dir

A path to a cache directory. See About caching.

update_cache

A logical whether to update cache. Default is FALSE. When set to TRUE it would force a fresh download of the source .geojson file.

verbose

Logical, displays information. Useful for debugging, default is FALSE.

Details

gisco_get_airports() refer to Europe. All shapefiles provided in EPSG:4326.

gisco_get_ports() adds a new field CNTR_ISO2 to the original data identifying the country of the port. Worldwide information available. The port codes are aligned with UN/LOCODE standard.

Value

A POINT object on EPSG:4326.

About caching

You can set your cache_dir with gisco_set_cache_dir().

Sometimes cached files may be corrupt. On that case, try re-downloading the data setting update_cache = TRUE.

If you experience any problem on download, try to download the corresponding .geojson file by any other method and save it on your cache_dir. Use the option verbose = TRUE for debugging the API query.

For a complete list of files available check gisco_db.

Source

https://ec.europa.eu/eurostat/web/gisco/geodata/transport-networks

See Also

Other infrastructure: gisco_get_education(), gisco_get_healthcare()

Examples



library(sf)

greece <- gisco_get_countries(country = "EL", resolution = 3)
airp_gc <- gisco_get_airports(country = "EL")

library(ggplot2)

if (inherits(airp_gc, "sf")) {
  ggplot(greece) +
    geom_sf(fill = "grey80") +
    geom_sf(data = airp_gc, color = "blue") +
    labs(
      title = "Airports on Greece",
      shape = NULL,
      color = NULL,
      caption = gisco_attributions()
    )
}
##############################
#         Plot ports         #
##############################

ports <- gisco_get_ports()
coast <- giscoR::gisco_coastallines

# To Robinson projection :)

library(sf)
coast <- st_transform(coast, "ESRI:54030")
ports <- st_transform(ports, st_crs(coast))

if (inherits(ports, "sf")) {
  ggplot(coast) +
    geom_sf(fill = "#F6E1B9", color = "#0978AB") +
    geom_sf(data = ports, fill = "red", shape = 21) +
    theme_void() +
    theme(
      panel.background = element_rect(fill = "#C6ECFF"),
      panel.grid = element_blank(),
      plot.title = element_text(face = "bold", hjust = 0.5),
      plot.subtitle = element_text(face = "italic", hjust = 0.5)
    ) +
    labs(
      title = "Ports Worldwide", subtitle = "Year 2013",
      caption = "(c) European Union, 1995 - today"
    )
}



[Package giscoR version 0.5.1 Index]