Skip to content

API for Creating, Reading, Adding and Removing GeoRegions

Creating GeoRegions

GeoRegions.GeoRegion Method
julia
GeoRegion(
    lon  :: Vector{<:Real},
    lat  :: Vector{<:Real};
    rotation :: Real = 0,
    ID   :: AbstractString = "",
    pID  :: AbstractString = "",
    name :: AbstractString = "",
    join :: Bool = true,
    save :: Bool = false,
    path :: AbstractString = homedir(),
    checkshape :: Bool = true,
    verbose    :: Bool = false,
    ST = String,
    FT = Float64
) -> geo :: GeoRegion{ST,FT}

Creates a GeoRegion.

Arguments

  • lon : A vector containing the longitude points.

  • lat : A vector containing the latitude points.

Keyword Arguments

  • ID : The keyword ID that will be used to identify the GeoRegion. If the ID is already in use, then an error will be thrown.

  • pID : The ID of the parent GeoRegion where information can be extracted from.

  • name : A name for the GeoRegion (meta information, can be used in Logging).

  • rotation : Rotation of GeoRegion from longitude/latitude in degrees.

  • join : If true, if the first and last coordinate points do not match, append the first coordinate again to close the shape.

  • save : If true, save the GeoRegion into the list of custom GeoRegions in the path specified by path.

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the user's home directory homedir().

  • checkshape : If true, then run isgeoshape() to check if the same shape already exists in the current project and predefined lists. Default is true.

  • verbose : If true, verbose logging for ease of monitoring. Default is false.

Returns

  • geo : A GeoRegion.
source

Retrieving GeoRegions

GeoRegions.GeoRegion Method
julia
GeoRegion(
    ID   :: AbstractString;
    path :: AbstractString = homedir(),
    verbose :: Bool = false
) -> geo :: GeoRegion

Extracts information of the GeoRegion with the ID ID. If no GeoRegion with this ID exists, an error is thrown.

Arguments

  • ID : The ID that will be used to identify the GeoRegion. If the ID is not valid (i.e. not being used), then an error will be thrown.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the user's home directory homedir().

  • verbose : Verbose logging for ease of monitoring? Default is false.

Returns

  • geo : A GeoRegion.
source

Adding Custom GeoRegions

GeoRegions.add Function
julia
add(
    geo  :: GeoRegion;
    path :: AbstractString = dirname(geo.path),
    verbose :: Bool = false
) -> nothing

Saves information on the GeoRegion geo to a directory specified by path.

Arguments

  • geo : The GeoRegion to be saved into the custom lists in path.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to dirname(geo.path).

  • verbose : Verbose logging for ease of monitoring? Default is false.

source

Overwriting Custom GeoRegions

GeoRegions.overwrite Function
julia
overwrite(
    geo  :: GeoRegion;
    path :: AbstractString = dirname(geo.path),
    verbose :: Bool = false
) -> nothing

Overwrites preexisting information associated with the ID geo.ID in path, with new information from the GeoRegion specified by geo.

Arguments

  • geo : The GeoRegion to be saved into the custom lists in path, overwriting any preexisting information associated with the ID geo.ID.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to dirname(geo.path).

  • verbose : Verbose logging for ease of monitoring? Default is false.

source

Removing Custom GeoRegions

After having loaded a Custom GeoRegion

Base.Filesystem.rm Function
julia
rm(
    geo  :: GeoRegion;
    path :: AbstractString = dirname(geo.path)
) -> nothing

Removes the GeoRegion geo from the custom lists specified in path. The GeoRegion must have exactly the same properties as the one in the custom list.

Arguments

  • geo : The GeoRegion to be removed from the custom lists in path.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the local package variable dirname(geo.path).
source

Based on the ID of a Custom GeoRegion

GeoRegions.rmID Function
julia
rmID(
    ID :: AbstractString;
    path :: AbstractString = dirname(geo.path)
) -> nothing

Removes any GeoRegion associated with the ID ID. ID must be exact.

Arguments

  • ID : The keyword ID that will be used to identify the GeoRegion. If the ID is not valid (i.e. not being used), then an error will be thrown.

Keyword Arguments

  • path : The path where the list of custom GeoRegions will be retrieved from. Defaults to the home directory homedir().
source