API for Creating, Reading, Adding and Removing GeoRegions
Creating GeoRegions
GeoRegions.GeoRegion Method
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
: Iftrue
, if the first and last coordinate points do not match, append the first coordinate again to close the shape.save
: Iftrue
, save the GeoRegion into the list of custom GeoRegions in the path specified bypath
.path
: The path where the list of custom GeoRegions will be retrieved from. Defaults to the user's home directoryhomedir()
.checkshape
: Iftrue
, then runisgeoshape()
to check if the same shape already exists in the current project and predefined lists. Default is true.verbose
: Iftrue
, verbose logging for ease of monitoring. Default isfalse
.
Returns
geo
: A GeoRegion.
Retrieving GeoRegions
GeoRegions.GeoRegion Method
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 directoryhomedir()
.verbose
: Verbose logging for ease of monitoring? Default isfalse
.
Returns
geo
: A GeoRegion.
Adding Custom GeoRegions
GeoRegions.add Function
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 inpath
.
Keyword Arguments
path
: The path where the list of custom GeoRegions will be retrieved from. Defaults todirname(geo.path)
.verbose
: Verbose logging for ease of monitoring? Default isfalse
.
Overwriting Custom GeoRegions
GeoRegions.overwrite Function
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 inpath
, overwriting any preexisting information associated with the IDgeo.ID
.
Keyword Arguments
path
: The path where the list of custom GeoRegions will be retrieved from. Defaults todirname(geo.path)
.verbose
: Verbose logging for ease of monitoring? Default isfalse
.
Removing Custom GeoRegions
After having loaded a Custom GeoRegion
Base.Filesystem.rm Function
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 inpath
.
Keyword Arguments
path
: The path where the list of custom GeoRegions will be retrieved from. Defaults to thelocal
package variabledirname(geo.path)
.
Based on the ID
of a Custom GeoRegion
GeoRegions.rmID Function
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 directoryhomedir()
.